Waiting for a Parallel Phase at a Barrier
A barrier lets participating workers continue only after the expected participants have reached the synchronization point.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two phases
Two workers prepare independent halves of an output. A later operation combining both needs a complete snapshot. Barrier participation can establish that both preparation steps finished. Task graph dependencies identify the wait.
Check failure and participant count
If one participant exits or never reaches the barrier, others may wait under the chosen API. Define failure behavior and use bounded waits where the contract allows.[1]
Track who can start the next phase
Three workers process separate blocks, and each then needs every block's summary. At the barrier, two ready workers wait until the final one arrives. Once all reach the required phase boundary, they can proceed using the published summaries under the synchronization contract. See task graphs.
Arrivals at t=2, 4, 7
First two cannot start the next phase before t=7 under this model
Last worker releases the phase boundary
Define what happens when a participant fails
A barrier can wait indefinitely if one required participant never arrives. Use the supported cancellation or failure policy and test a controlled failure. Check visibility of prior writes after passing the boundary.