3 ms·
Could you link to further reading about how a CPU-based scheduler works? The wikipedia article [1] only mentions OS-level scheduling, and I was always under the
by andreyf 17y ago
Could you link to further reading about how a CPU-based scheduler works? The wikipedia article [1] only mentions OS-level scheduling, and I was always under the impression that the CPU knew nothing of threads or processes.
CPU based task scheduler can task switch on cache miss, or availability of single pieces of a CPU (like an adder).
Can't the CPU just signal an interrupt for those, and let the OS scheduler handle it?
1. http://en.wikipedia.org/wiki/Scheduling_(computing) http://en.wikipedia.org/wiki/Scheduling_(computing)
- wmf 17y agoMultithreaded processors have multiple hardware threads. An SMT processor schedules instructions, mostly ignoring which thread they come from. An SoEMT processor schedules hardware threads, usually switching on a cache miss or similar stall event. http://en.wikipedia.org/wiki/Multithreading_(computer_hardware) http://en.wikipedia.org/wiki/Multithreading_(computer_hardwa... Can't the CPU just signal an interrupt for those, and let the OS scheduler handle it? This is usually not efficient because handling an interrupt takes nearly as long as a cache miss (and let us not consider the case where the interrupt handler itself triggers a cache miss), but Intel did a prototype on the Itanium that worked this way.
- ars 17y agoSee http://en.wikipedia.org/wiki/Instruction_level_parallelism http://en.wikipedia.org/wiki/Instruction_level_parallelism A CPU scheduler (instruction unit) does not schedule threads or processes - instead it schedules instructions (assembly instructions). A thread might block while waiting for IO (disk, net, user input, etc). An instruction might block because it's waiting for the cache to load its data, or it might block because it does not have an available execution unit. A modern CPU has, for example, 4 units that can add, 2 that can multiply, 1 for floating point, another for memory IO, another that does XOR, etc, etc. If one of those is busy you try to find an instruction that can make use of an idle unit. It's often hard to find an instruction because they often depend on each other, so you have to do them in order. With hyperthreading you have double the number of available instructions to choose from (and those two instruction streams are independent of each other). The biggest problem with hyperthreading is the cache. Memory is very slow, so you cache memory locally, with hyperthreeading you have twice as much data to cache, so some data is evicted - this is bad. Some tasks will be slower because of this, but most won't.
- deleted 17y ago[deleted]