Semaphore mutual exclusion with a firing sequence
Two processes share one semaphore token, laid out left to right; a firing sequence is played from the initial marking so the diagram shows the resulting state and which transition is enabled next.
For the concurrency engineer
Scenario
Processes A and B each cycle Ready → Enter → Critical → Exit and back. A single Semaphore token is shared between them, so only one process can be in its critical section at a time. The net also replays a short run — A enters and leaves, then B enters — so you see the state after those three steps instead of the starting state.
Annotation key
layout: lr— lay the net out left to rightplace Name *1— a place holding one token at the start; no*means emptytransition Name— an action that moves tokensA -> B— an arc from a place to a transition, or from a transition to a placefire: EnterA, ExitA, EnterB— transitions to fire in order, starting from the initial marking
How to read
The two process cycles mirror each other, with the Semaphore between them feeding both Enter transitions and refilled by both Exit transitions. After the firing sequence, A is back in ReadyA, B holds its token in CriticalB, and the Semaphore is empty. So EnterA cannot fire — it needs the semaphore token — and the only enabled transition is ExitB. No marking ever puts tokens in CriticalA and CriticalB together; that is the mutual-exclusion guarantee.