Serial vs Concurency Queue
Last updated
Last updated
Link:
A serial Dispatch Queue performs only one task at the time. Serial queues are often used to synchronize access to a specific value or resource to prevent data races to occur.
A concurrent queue allows us to execute multiple tasks at the same time. Tasks will always start in the order they’re added but they can finish in a different order as they can be executed in parallel. Tasks will run on distinct threads that are managed by the dispatch queue. The number of tasks running at the same time is variable and depends on system conditions.
A DispatchQueue
task can be run synchronously or asynchronously. The main difference occurs when you create the task.
Synchronously starting a task will block the calling thread until the task is finished
Asynchronously starting a task will directly return on the calling thread without blocking