Define Mutual Exclusion, Critical Section, Race Condition.
Chapter 3
Critical Section Solutions (Busy Waiting and Beyond)
Compare lock variable, strict alternation, TSL/XCHG, Dekker, and Peterson approaches.
These are methods to ensure only one process enters critical section at a time.
You must know why some classic solutions fail despite seeming correct.
Busy-Waiting Approaches
From notesClear explanation
Early software/hardware methods rely on repeatedly checking conditions until entry is possible.
What it really means
Standing at a locked door and checking every second wastes effort compared to being notified.
Key takeaway
Correctness can be achieved, but efficiency may be poor.
Why Some Approaches Fail
Added clarityClear explanation
Lock-variable and strict alternation fail due to race windows or progress violations; hardware atomic instructions improve correctness.
What it really means
The tricky part is not setting a flag, but setting-and-checking atomically.
Key takeaway
Atomicity and fairness conditions matter more than code length.
- - Calling shared lock variable always safe
- - Missing progress violation in strict alternation
- - Ignoring busy waiting CPU waste
- - Good solution should satisfy mutual exclusion, progress, bounded waiting
- - Disabling interrupts is not general user-process solution
- - Peterson works for two processes but still busy-waits
Exam lens for this topic
What evaluators usually expect in structured exam answers.
Must-use keywords
- - peterson
- - test and set
- - shared lock variable
- - strict alternation
- - disabling interrupts
Answer flow
- - Write exact definition in first line
- - Explain mechanism in ordered bullets
- - Add one short example or scenario
- - Close with key takeaway and one exam keyword
Practice Questions
Explain Peterson's solution using algorithm.
Source: Summer 2024 Q3(B) OR
Answer focus: Variables, entry/exit protocol, and limitations.
Explain shared lock variable using algorithm.
Source: Summer 2025 Q3(B)
Answer focus: Algorithm + race flaw explanation.
Practice from papers (end-of-topic set)
These paper questions map directly to this topic. Solve now, then compare your structure with linked topics.
Explain test-and-set lock mechanism in IPC.
Explain Peterson's solution using algorithm.
Explain shared lock variable using algorithm.
Explain Peterson's solution using algorithm.
Explain shared lock variable using algorithm.
Explain disabling interrupts using algorithm.
Question Bank Linked Here
Open all questionsDefine Mutual Exclusion, Critical Section, Race Condition.
Explain test-and-set lock mechanism in IPC.
Explain Peterson's solution using algorithm.
Explain shared lock variable using algorithm.
Explain Peterson's solution using algorithm.
Explain shared lock variable using algorithm.
Explain disabling interrupts using algorithm.
How to answer linked exam questions
Full question bankSummer 2023 Q3(A)
Define Mutual Exclusion, Critical Section, Race Condition.
Answer pattern: one-line definition, key properties, and one short real-world use case.
Winter 2023 Q3(B)
Explain test-and-set lock mechanism in IPC.
Answer pattern: concept -> intuition -> steps -> concluding point with one application.
Summer 2024 Q3(B) OR
Explain Peterson's solution using algorithm.
Answer pattern: concept -> intuition -> steps -> concluding point with one application.
Winter 2024 Q3(B)
Explain shared lock variable using algorithm.
Answer pattern: concept -> intuition -> steps -> concluding point with one application.
Winter 2024 Q3(B) OR
Explain Peterson's solution using algorithm.
Answer pattern: concept -> intuition -> steps -> concluding point with one application.
Summer 2025 Q3(B)
Explain shared lock variable using algorithm.
Answer pattern: concept -> intuition -> steps -> concluding point with one application.
Extra clarity files
These are clearly marked additions, separate from source notes.