Mastering Grand Central Dispatch

Episode 1 Plus

What Is Grand Central Dispatch


You've probably heard about Grand Central Dispatch and chances are that you've used it in some of your projects. This series takes a close look at Grand Central Dispatch. Before exploring the API of Grand Central Dispatch, we find out what it is and what problem it solves.

Episode 2 Plus

Working With Dispatch Queues


Dispatch queues are an integral part of Grand Central Dispatch. In this episode, we cover the fundamentals of dispatch queues. Let's start with an example.

Episode 3 Plus

Serial and Concurrent Dispatch Queues


You should now have a fundamental understanding of dispatch queues. A dispatch queue is responsible for managing the execution of blocks of work. Grand Central Dispatch determines which thread is used for the execution of a block of work. Developers unfamiliar with Grand Central Dispatch wrongly assume that a dispatch queue is tied to a particular thread. Remember that Grand Central Dispatch doesn't make a guarantee as to which thread is used for the execution of a block of work submitted to a dispatch queue.

Episode 4 Plus

Main and Global Dispatch Queues


The application we worked with in the previous episodes creates and manages a serial dispatch queue and a concurrent dispatch queue. Creating a dispatch queue manually is fine, but it isn't always necessary. Grand Central Dispatch manages a handful of dispatch queues your application can use. The main dispatch queue is one of these dispatch queues. In this episode, we find out which dispatch queues Grand Central Dispatch provides and when you should consider using them.

Episode 5 Plus

Synchronous and Asynchronous Execution


Up until now we submitted blocks of work to a dispatch queue by invoking the async(execute:) method. In this episode, we explore how Grand Central Dispatch handles the execution of a block of work. Work can be executed synchronously or asynchronously. What does that mean? What is the difference? And what are the risks?