Pseudocode · three rounds
One thread per CTA executes the protocol. Barrier full lives on CTA 0 and needs one arrival per phase. Initialization is complete.
P = producer arrivals
C = completed consumer waits
Each arrival advances the phase; parity = phase % 2.
The search stops a branch when the producer completes a second phase before the consumer observes the first.
Reachable states · L = pseudocode line
Try each enabled event
After either of the first two arrivals, the consumer can finish its wait or the producer can arrive again. The search explores both choices. Red states mark a phase completed before the preceding phase was observed.
All three rounds complete
Each wait at line 6 observes its phase before the next arrival completes another phase. The path reaches P3 C3: three arrivals and three completed waits.
The second arrival overtakes the first wait
The prefix P0 C0 → P1 C0 → P2 C0 reaches phase 2, with parity back at 0. The phase-1 arrival at line 3 overtakes the consumer's phase-0 wait at line 6. The checker can return this prefix as the counterexample.