Earlier, I wrote about the SMT-awareness of the CFQ and BFS schedulers on Linux. Here, I do a similar test on the Mac OS X process scheduler.
- Core i7-3770K 3.5 GHz, 4 cores, 8 threads (2-way SMT)
- Mageia Linux, kernel 3.4.4, CFQ scheduler
- Mac OS X 10.7 (Update: Also 10.8)
- Workload: Independent ALU instructions (does not improve with SMT)
The thread scheduler on Mac OS X 10.8 behaves identically.
As more concurrent processes are run, the total throughput increases up to 4 threads on 4 cores. Due to the nature of the workload, SMT offers no additional throughput improvement. A good SMT-aware process scheduler would first assign threads to separate cores before doubling up threads on the same core. The CFQ scheduler is able to do that, but the OS X scheduler does not. It makes sub-optimal scheduling decisions when there are between 4 and 6 threads, choosing to assign two threads on the same core while leaving another core idle, causing a performance loss (11% loss at 4 threads).
Is the OS X process scheduler SMT-aware? Yes. Does it make good scheduling decisions? Not really, but still better than the BFS scheduler.