Serial vs concurrent queue — what's the difference?
The essence
- Serial — runs tasks strictly one at a time, in submission order; the next starts after the previous one finishes. Exactly one thread at any moment, so a serial queue is a simple, reliable way to serialize access to data.
- Concurrent — tasks start in submission order but may run simultaneously on several threads and finish in any order. How many threads to use is up to GCD.
sync/async is a different axis: whether the caller waits. Any queue can be used either way.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep