How are cores assigned to threads?

Discussion in 'Mac Pro' started by gkroeger, Jan 21, 2008.

  1. gkroeger macrumors member

    Sep 15, 2007
    How are cores allocated to threads and processes? Is this a hardware feature of the motherboard chipset, or does the OS control? For example, with an octo-core MacPro, would the second thread be assigned to the second CPU, or the second core of the first CPU? It would seem like balancing across CPU's would make best use of memory bus architecture?

    The reason I wonder is whether a system that typically only uses 4 cores would run faster with a two processor system than with one quad-core chip.

  2. astrostu macrumors 6502

    Feb 15, 2007
    I'm sure folks will correct me fairly quickly if I'm wrong, but I'm pretty sure this is a feature of the OS (hence one of the big things was that 10.5 was "multi-core optimized" or whatever).

    And in my experience, at least with 10.4, it doesn't just have one thread per core, but it will trade them off. Which honestly doesn't make sense to me (except for heat issues) because it takes time to shuffle it from one processor to another.
  3. trainguy77 macrumors 68040

    Nov 13, 2003
    Yeah the OS handles it. I don't think anyone really knows other then apple exactly how it makes its decisions we can only guess. But 10.5 was a big improvement over 10.4 For example in 10.4 if you had one CPU intensive task it would "jump" from core to core staying on one for a couple seconds then moving on. This makes it have to move the L2 Cache between processors not the best plan. Now it stays on one core for the most part.
  4. newtech macrumors 6502

    Jun 2, 2007
    In OS X 10.5 there will almost always be multiple threads running on each core. X will seek to balance the load across all cores for best performance. Hopping between cores in the same processor incurs no penalty as the L2 is shared.
  5. trainguy77 macrumors 68040

    Nov 13, 2003
    Yes but 10.4 didn't care which processor had the L2 cache data. So it would jump one after another between all 4 of my cores, which are based on 2 CPUs so 2 L2 caches.
  6. Lord Zedd macrumors 6502a

    Lord Zedd

    Oct 24, 2007
    Denver, Colorado
    Leopard "hops" the load between CPUs every 10 seconds or so on my machine.

Share This Page