3 ms·
How about OS X? (and, how does that work when calling into userspace APIs that assume fixed 1:1 thread/stack correlation)
by teacup50 11y ago
How about OS X?
(and, how does that work when calling into userspace APIs that assume fixed 1:1 thread/stack correlation)
- 4ad 11y agoOn OS X Go does its own system calls, ignoring the OS X guidlines. Go uses M:N scheduling, but you still have N threads with (relatively) large stacks. When calling into C code, Go switches stacks, so it runs on the (relatively) large stack where C code can run. Of course there's some overhead associated with this, but system call overhead is large on its own compared to this anyway. During the system call the thread (obviously) can't run any other Go code, but that's ok, the runtime makes sure there are always threads available to run user Go code (that's one reason why the runtime stands between user code and system calls).