ios - How does Grand Central Dispatch really use the operating system? -
I have a solid idea of how GCD works, but I want to know more about "Operating System Management" Internal. "Gtc: suffix =" text-gt; It seems that almost every technical explanation of working with the Grand Central Dispatch "Operating System" is completely different. I will explain some of my findings.
"This is a daemon that is global from a OS that delivers tasks to many cores."
I'm not stupid enough to believe.
"Support has been created in the kernel to be aware of all GCD applications. GCD applications work in the concert with Kernel, which includes logical decision-making methods, App. "
This synchronization scheme seems to be very slow compared to managing logic in the application.
"The GCD is fully present application and uses the current system load as the metric for how it behaves."
It seems to be more realistic to me, but I only saw a statement like this one.
What is actually going on here? Is this just a library, or is it a complete system?
This is a library, but there are some kernel optimizations to allow for system level control. From, what happens is that an additional interface is pthread_workqueue
, which tells GCD to the kernel that it wants a thread to run a particular function, but does not actually start a thread (It's basically an extension). At that point the kernel can choose to start that continuity or can not depend on the system load.
So, a global system is a comprehensive structure that manages the GCD thread in the kernel, and the second answer is correct. The mistake you are making is thinking that there is a synchronization that is going to cost somebody. Scheduling does not matter what GCD has done, a new interface is used which not only determines the scheduler whether or not to run the thread on the basis of their relative priority, but to make this thread or To destroy or not well
This is an (important) optimization, but it is not strictly necessary, and Freebad Port does not really support the system's extended content. If you want to see the actual interface, then that implementation is in Apple, and you can see the stub entry point which uses the kernel to start the workscube in their ASM stubes. You can also go crawling through XNU so that you really want to see how this stub will grow.