3 ms·
How is this better than any other threadpool library?
by grogers 17y ago
How is this better than any other threadpool library?
- wmf 17y agoI'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.
- scott_s 17y agoSystem-wide integration and being able to assume it's always present. You're right in that, as far as I can tell, there are no new ideas in GCD. But it's integrated into the language, compiler, runtime system, kernel, and developers can assume that it is present on any Mac OS 10.6 and greater. That makes a big difference. Further discussion: http://news.ycombinator.com/item?id=782399 http://news.ycombinator.com/item?id=782399