DSA Factory
Free Synchronization lessonsSynchronization · Stage 0 · The problem: sharing data · Step 2

The critical-section problem

Define what a correct solution must guarantee, and see Peterson's classic software solution. About 14 minutes.

Quick check

A scheme makes two threads strictly alternate in their critical sections, thread 0 then thread 1, always. Which requirement does it break?

  1. AProgress: a thread that doesn't want to enter can hold the other up
  2. BMutual exclusion
  3. CBounded waiting
Show the answer

Progress: a thread that doesn't want to enter can hold the other up. If thread 0 never wants in again, thread 1 waits for its turn forever.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve