Kernel mode constructs
I’ve been reading Jeffrey Richter’s book, CLR via C#, lately, and near the end of the book, I found this interest bit on threading.
He starts by telling us about two types of threading constructs: User-mode constructs that use special CPU instructions, and Kernel-mode constructs offered by Windows.
User-mode constructs handle all the thread management in the hardware, which means that it’s fast. When it blocks, Windows can’t tell. This is good because the OS won’t create a new thread (using resources). It’s bad, however, if the thread spins for a long time in the CPU, as it means that a CPU core is idle and can’t be used until the thread can be unblocked.