Zootal said:
I don't get this - what can hyperthreading do that a good cpu scheduler
can't do?
Leverage otherwise idle resources in the core. A core typically has
two or more integer ALU's and one or more floating point ALU's. These
allow superscaler behaviour (i.e. multiple instructions can be in flight
at the same time (multiple issue)). However, for many instruction streams, not all
of the ALU's and FPU's are used, so a second 'logical' processor (the
hyperthread) can be made available to the operating system to take advantage
of those idle resources.
Note that even with HT/SMT, the operating system sees them as two
distinct cores, even though they aren't really stand-alone cores.
A four physical core processor with SMT will appear to the
operating system as 8 logical cores.
If I have two virtual cores, I have to have two schedulers running
(one for each virtual cpu), each with their own set of queues and each with
50% cpu time. Is that more efficient then one single scheduler that has 100%
cpu time?
There is only one scheduler in a typical operating system. It schedules
across all logical cores and is typically NUMA and SMT aware in order to
make optimal scheduling decisions. NUMA awareness means scheduling
user threads/tasks on a CPU close to memory. SMT aware schedulers understand
that resources are shared and attempt to schedule related threads (i.e.
threads from the same process/job/task) on the secondary threads.
scott