Guardian Programmer's Guide

Table Of Contents
Synchronizing Processes
Guardian Programmer’s Guide 421922-014
26 - 3
How Binary Semaphores Work
At t0, the four processes have not been started.
At t1, process D is accessing the shared area, C has reached a critical section and has
entered the wait group, B has been started and is executing a noncritical section, and
A is still waiting to be started.
At t2, D is still holding the lock, and A, B, and C are waiting for the lock.
At t3, C and D are executing noncritical sections, A now owns the lock and has
exclusive access to the shared area, and B is still waiting.
At t4, D has finished executing, A and C are executing noncritical sections, and B has
access to the shared area.
Finally, at t5, all four processes have finished.
Table 26-1. Process Synchronization
Not
Executing
Executing
Non-
critical
Section
Executing
C
ritical
Section
Waiting
t0 A,B,C,D
t1 A B D C
t2 D A,B,C
t3 C,D A B
t4 D A,C B
t5 A,B,C,D