Multicore & Synchronization

Which describes barrier synchronization in parallel programs?

  1. AIt creates a region that only one thread can enter at a time
  2. BThreads that arrive first wait at that point until all threads have arrived
  3. 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.
Practice this topic Back to topic

More Multicore & Synchronization questions

  1. When 64 cores continuously update one shared counter with atomic instructions, adding cores does not speed things up. What is the main reason?
  2. Which describes a NUMA (non-uniform memory access) system?
  3. Under the first-touch policy common on Linux NUMA systems (a page is placed in the memory of the node where the thread first writing it runs), what should programmers watch out for?
  4. Which is NOT a reason a parallel program fails to scale as cores are added?
  5. When splitting loop iterations among threads, which division suits iterations whose costs vary widely?