Multicore & Synchronization
Which describes barrier synchronization in parallel programs?
- AIt creates a region that only one thread can enter at a time
- BThreads that arrive first wait at that point until all threads have arrived
- CAn instruction that stops memory operations from being reordered
Show answer and explanation
Answer: B. Threads that arrive first wait at that point until all threads have arrived
In simulations and similar work, all threads must finish one step's computation before moving to the next. With barrier synchronization, each thread stops at the barrier, and when the last thread arrives they all proceed. If the workload is uneven, fast threads spend more time waiting for slow ones, so dividing work evenly matters for performance.
- A. That is mutual exclusion with a lock.
- B. Correct. It keeps everyone in step phase by phase.
- C. That is a memory barrier, a different thing with a similar name.