What is a barrier and on which queue does it work?
The essence
A barrier is a task flag on your own concurrent queue that makes the task exclusive: the barrier block starts only after every task submitted before it has finished, and tasks submitted after it wait until it completes. Effectively the queue becomes serial for the duration of the barrier. On global queues the flag is ignored — they are shared by the process, and the block runs as a plain async. On a serial queue a barrier is pointless: everything is exclusive anyway.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep