3 ms·
I've found very little documentation on this, but apparently the kernel optimizes multiple thread pools to prevent excessive context switches. (Consider an N-co
by wmf 17y ago
I've found very little documentation on this, but apparently the kernel optimizes multiple thread pools to prevent excessive context switches. (Consider an N-core system where multiple processes each create N worker threads of their own.)
- scott_s 17y agoDo you mean process migration (rescheduling a process/thread on a different core, which does bad things to caches) instead of context switching (switching between different processes/threads on the same core, which requires saving registers to memory and does bad things to caches)? If so, any decent modern scheduler tries to avoid migrating threads.
- wmf 17y agoWhen I said context switching I meant context switching. Now that you mention it, GCD may also reduce thread migrations. I'm just speculating since we don't know how GCD works.