3 ms·
Context switches on I/O are the same for 1:1 and M:N because you're eating the cost of a kernel to user context switch either way. Memory usage per thread is a
by pcwalton 8y ago
Context switches on I/O are the same for 1:1 and M:N because you're eating the cost of a kernel to user context switch either way.
Memory usage per thread is a property of the GC, not M:N threading. You can have very small stacks in a 1:1 implementation too.
- skyde 8y agothere is less context switches because you cant write some data to several distinct file descriptor using a single system call. You can also read data from several file descriptor in a single System Call. This way you significantly reduce the number of System call instead of doing one blocking read() per connection. I believe context switch round trip (from user space to kernel to user space) is much more expensive than simply switching between goroutine of the same process.