Skip to contentSkip to conversation

Quick question about hyper-threading

DISCUSSION Timothy Miller 2 participants 2 messages Apr 13, 2003

lore
Share & tools
lore
#0 lore raw

On a hyper-threaded CPU, it seems to me that there could be a lot of cache-thrashing if the two processes running are completely unrelated. On the other hand, if one process has two threads, then they would benefit (or hurt less) from the cache-sharing, because they share the same memory space. Does the HT-aware scheduler attempt to take this into account by scheduling two related threads to run simultaneously on the same CPU as often as possible (unless you're in a multi-processor system and another CPU would otherwise be idle)?

#1 lore raw
Quoted 8 lines · Timothy Miller

On a hyper-threaded CPU, it seems to me that there could be a lot of cache-thrashing if the two processes running are completely unrelated. On the other hand, if one process has two threads, then they would benefit (or hurt less) from the cache-sharing, because they share the same memory space. Does the HT-aware scheduler attempt to take this into account by scheduling two related threads to run simultaneously on the same CPU as often as possible (unless you're in a multi-processor system and another CPU would otherwise be idle)?

No, the current scheduler (HT or stock 2.5) does not do this.

Your theories are correct. It would be interesting to try this and see.

It is nontrivial to do the ->mm checks in the scheduler though - certainly they cannot be done easily (if at all) in constant-time (i.e., it won't be O(1)).

Robert Love