Semaphore state interaction example

3 Processes: P1, P2, P3

Initial state: S=1

State 1: S=1, P1 wait(S) -> P1 proceeds Since S > 0, P1 does not block, proceeds

State 2: S=0, P2 wait(S) -> P2 suspended Since S <= 0, P2 is suspended (waiting)

State 3: S=0, P3 signal(S) -> P3 proceeds Since S <= 0,

End State: S=1