Chapter 8
GCD Implementation
In this chapter, I explain how GCD is implemented in order to give you a better understanding of how it works. And then I explain one functionality of GCD called “data source,” which relates to the XNU kernel event.
Dispatch Queue
This section shows how GCD is implemented. We especially look at the GCD structure and then see how a Block is executed on the dispatch queue.
Kernel-Level Implementation
From its functionality, we can guess that GCD uses the following components.
- A FIFO queue in the C language-level to manage the added Blocks
- Lightweight semaphore for concurrency control by atomic functions
- A container in the C language-level to manage threads
If that is all, it doesn’t need kernel-level implementation. ...
Get Pro Multithreading and Memory Management for iOS and OS X now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.