by ori_b · 3y ago · 0 comments
You can do a millions to tens of millions kernel entries/exits per second per core. They're on the same order of magnitude as a single digit number of full cache misses.
So, expensive, but a lot less expensive than many people assume.
Edit: for some (outdated, 2018) measurements, https://eli.thegreenplace.net/2018/measuring-context-switchi...
But this is silly — shared nothing will have no substantial difference in the rate of context switches (or of syscalls) compared to a thread-per-core-shared-everything architecture. The architecture that actually loses is many-threads-per-core if it ends up in a small-batch mode in which it context switches once per request or so.
The other thing is 'io_uring', which is trying to come at the problem by removing context switching altogether by providing a cheap primitive for communicating with the kernel.
Hardware engineers are building systems for the applications of today. And the kernel developers are optimizing as well. It's all a moving target.
Dogma has no place here.