Chapter 3

Critical Section Solutions (Busy Waiting and Beyond)

Compare lock variable, strict alternation, TSL/XCHG, Dekker, and Peterson approaches.

Estimated time: 26 min

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 notes

Clear 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 clarity

Clear 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.

Question Bank Linked Here

Open all questions

How to answer linked exam questions

Full question bank

Extra clarity files

These are clearly marked additions, separate from source notes.