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.
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.
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. ...