Bölüm 6 · Simülatör

Synchronization Lab

← Bölüm 6
Mode
Actors 4
Capacity 2
Speed 1.5/s

Step 0/0 ✓ Inside 0 ⏸ Blocked 0

Synchronization Lab

Actors run a small program built from wait/signal operations on semaphores. A round-robin scheduler lets the next unblocked actor execute one operation per step, so you can watch who enters the critical section, who blocks in a semaphore’s FIFO queue and who wakes whom. The panel on the right lists every actor’s next operation and the latest events.

How to use

  • Pick a scenario: Mutex (shared counter), Semaphore (limited permits), Producer–Consumer (bounded buffer), Readers–Writers or Dining Philosophers.
  • The second row changes the variant (with or without a lock, which side is faster, ordered or naive forks), the number of actors (2–8) and the capacity (permits or buffer slots, 1–6).
  • ▶ plays; the step buttons move one operation back or forward, or jump to the start or end (at most 150 steps, or until a deadlock).
  • Compare runs the variants of the current scenario for 120 steps side by side.

Operations

wait(S)
S > 0: decrement. Else block in S’s FIFO queue.
signal(S)
Wake the first waiter (it gets the permit), else increment S.
Scheduler
Round-robin: next unblocked actor runs one operation.
Mutex
Binary semaphore around read → modify → write.
Race
Unsynchronized: two stale reads lose an update.
empty / full
Free / filled buffer slots.
rw_mutex
First reader locks, last reader unlocks; writers need it alone.
Ordered forks
Lower-numbered fork first breaks circular wait.
Deadlock
Every actor blocked: no one can signal.

Legend

ready ✓ inside critical section ⏸ blocked just acted

Keys

←→ stepSpace playHomeEndEsc close