Introduction

Introduction

Concurrency is the notion of multiple things happening at the same time. With the proliferation of multicore CPUs and the realization that the number of cores in each processor will only increase, software developers need new ways to take advantage of them. Although operating systems like OS X and iOS are capable of running multiple programs in parallel, most of those programs run in the background and perform tasks that require little continuous processor time. It is the current foreground application that both captures the user’s attention and keeps the computer busy. If an application has a lot of work to do but keeps only a fraction of the available cores occupied, those extra processing resources are wasted.

In the past, introducing concurrency to an application required the creation of one or more additional threads.

Unfortunately, writing threaded code is challenging. Threads are a low-level tool that must be managed manually.

Given that the optimal number of threads for an application can change dynamically based on the current system load and the underlying hardware, implementing a correct threading solution becomes extremely difficult, if not impossible to achieve.

In addition, the synchronization mechanisms typically used with threads add complexity and risk to software designs without any guarantees of improved performance.

Both OS X and iOS adopt a more asynchronous approach to the execution of concurrent tasks than is traditionally found in thread-based systems and applications.

Rather than creating threads directly, applications need only define specific tasks and then let the system perform them.

By letting the system manage the threads, applications gain a level of scalability not possible with raw threads.

Application developers also gain a simpler and more efficient programming model.