问题
Kernel-level threads (like Linux and some *BSD systems) or something else? If there is any difference, I'm using pthreads.
回答1:
They are Mach threads.
回答2:
Old question, but could use some more detail and accuracy:
The underlying threads in XNU (the OS X and iOS kernel) are indeed Mach threads, but these are generally hidden from user mode. Instead, there are BSD threads (also known as uthreads) over them, which are more accessible via the system calls (such as #360, bsdthread_create, and friends). PThreads actually further wrap these threads. In this way, a call to pthread create falls through to the system call bsdthread_create, which in turn (in kernel mode) invokes thread_create.
Mach calls can be called directly from user mode (via the Mach Interface Generator, MIG generated files in /usr/include/mach/*). This comes in very useful for debugging/tracing/hacking threads. But otherwise, for all intents UNIX-like, you're better off with the pthreads wrapper which (for the most part) is portable.
来源:https://stackoverflow.com/questions/4466457/what-type-of-threads-does-os-x-have