Cores and threads -confused

Discussion in 'Mac Pro' started by rdsii64, Jun 25, 2013.

  1. rdsii64 macrumors regular

    Joined:
    May 14, 2008
    #1
    Today I finally got to dive into my new(to me) 8 core 3.1. I fired up toast 11 to make a simple DVD. I opened up activity monitor because I wanted to see how much the cpu's were being used. Well when the encode started all 8 cores were pegged through the roof and the fans got louder. So I figured all 8 cores were working hard. Then just for fun I went to look at process thread. Since I have 8 cores and the cpu's don't hyper-thread I expected to see 8 threads. What I saw was 49 threads. When the encode finished and the writing started the threads dropped to 26 but all 8 cores were still seeing action.

    Could someone explain such a high thread count with only 8 cores and non hyper-threading cpu's.

    For what its worth. my new machine is chewing though this stuff pretty fast. way faster than my core2duo iMac, and we don't even want to talk about how fast handbrake is now.
     
  2. rabidz7 macrumors 65816

    rabidz7

    Joined:
    Jun 24, 2012
    Location:
    Ohio
    #2
    The threads in activity monitor are completely unrelated to CPU threads.
     
  3. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #3
    Hyperthreading is just a hardware mechanism in place to aid running multiple threads. It doesn't mean that a CPU must have Hyperthreading to use threads, or that it's some limiting ceiling on how many threads you can run at the same time.
     
  4. rdsii64 thread starter macrumors regular

    Joined:
    May 14, 2008
    #4
    That would seem to make a lot of sense now.
    thanks for the explanation.

    ----------

    Thanks for the explanation. It seems that I have some reading to do on things like hyper threading and multithreaded applications and what that stuff really means. In any respect this journey should prove to be a fun one. This thing is a beast compared to my imac of the same vintage.
     
  5. minifridge1138 macrumors 6502a

    Joined:
    Jun 26, 2010
    #5
    Don't worry about the confusion. It's confusing the first time you start reading about it.

    This is a stripped down explanation (and I still apologize for the length). I know I skipped on some details and glossed over some points, but here is the general idea:

    In the beginning, 1 cpu was 1 piece of silicon with 1 physical core on it.

    This 1 cpu could only do 1 thing at a time, but it was very fast. If you told it do do A, it did A very quickly (the act of doing A ran within 1 thread). If you told it to do A and B, it could do a little bit of work for A then switch and do a little bit of B. It did this so fast that the user thought it was doing A and B at the same time. It could continue switching back and forth between A and B until both were finished.
    In this simple scenario, you have 1 CPU with 1 physical core that was running 2 threads.

    Developers realized that there were some parts of their application that could run "at the same time" in multiple threads. A good example is your web browser. You can enter a URL, hit enter, but the browser is still "listening" to the mouse so you can hit the stop button. That's (at least) 2 threads: 1 thread to go to the URL and get the web page and 1 thread to listen for the mouse.

    So you still have A and B running, but A could have dozens or hundreds of threads and so could B. The faster the CPU, the faster it can switch between all the threads in A and B.

    This worked fine as long as the CPU clock speed (measured in GHz or MHz) kept getting faster, but eventually they couldn't make them faster. Manufacturers simply couldn't make them run faster without making them so hot that they melted (or you used liquid nitrogen to keep them cold).

    Enter hyper-threading: the CPU isn't just 1 little part. It's actually millions of parts working together. Some parts are used all the time and some parts designed for specific tasks (they could perform other tasks as well, but were REALLY good at their specific purpose). If you weren't doing anything that needed that specific task, then it just sat there doing nothing. Then they had a brilliant idea: what if you took those special parts and used them all the time to run a 2nd thread. It wouldn't be as efficient, but it would work. They called this hyper-threading.
    Now you could have 1 CPU with 1 physical core and 1 logical core (the term for the extra stuff that was now being put to use to pretend it is another CPU). At this point, you could actually work on 2 threads at the same time.

    Then they had another idea: what if instead of 1 CPU (that was hyper threaded) on 1 piece of silicon, you put 2 physical CPUs on 1 piece of silicon. Now you could process 4 threads at a time.

    This trend has continued. Your Mac Pro has 1 CPU with 4 Physical Cores that are Hyperthreaded and capable of running 8 threads at a time (1 X 4 X 2 = 8).

    The New Mac Pro (based on limited information) looks like it will have 1 cpu with 12 Physical CPU cores that are hypthreaded and capable of running 24 threads at a time.

    I hope this didn't confuse you any more. Feel free to ask questions and I'd be happy to explain anything that's confusing.

    Good Luck!!!
     
  6. rdsii64 thread starter macrumors regular

    Joined:
    May 14, 2008
    #6
    this makes good sense.

    Thanks for explaining this. So what I saw was the 49 threads that toast has to execute to encode a video. these "threads" were divided between the 8 physical cores (dual E5462's). So having 8 cores is like having 8 lanes on a road and the speed limit is 2.8 ghtz. The 49 threads in toast would be 49 little trucks running up and down that road to complete work. If I only had one 5462 the speed limit would still be 2.8ghtz but they would only have 4 lanes travel on and the encode would have taken longer because there would be more traffic on each lane.( each core would have had to process more threads). If toast was only a single threaded application there would only have been one truck on that huge 8 lane road and the other seven lanes would sit empty. If my trucks on a road analogy is even close I may just begin to understand this stuff.
     
  7. leman macrumors 604

    Joined:
    Oct 14, 2008
    #7
    Yes, this is a very good analogy :)
     
  8. minifridge1138 macrumors 6502a

    Joined:
    Jun 26, 2010
    #8
    I think you've got it.

    Enjoy your new Mac Pro. It's a very nice machine.
     
  9. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #9
    Hyperthreading is just intel's trademark of a general idea, the CPU can hold more than one context local to the CPU, meaning context switches are faster. It's not really running two things at the same time neither is it using other unused parts of the CPU.

    As an end user it's not really necessary to understand how it works or even what it is, the end result is faster code execution in general.
     
  10. Tesselator macrumors 601

    Tesselator

    Joined:
    Jan 9, 2008
    Location:
    Japan
    #10
  11. rezwits macrumors 6502a

    rezwits

    Joined:
    Jul 10, 2007
    Location:
    Las Vegas
    #11
    Threads, Cores, Virtual Cores

    Basically, and I mean basically damn it all you exception freaks, the Mac OS X lets processes create threads to do their tasks.

    An App (or process) can create a thread as it sees fit to do something. The system dispatches these threads to your cores, virtual cores included.

    That is the correlation (I.E. what they mean) with Hyper-Threading Intel CPUs. Essentially, a chip that can rip thru an assortment of threads. Giving time to each thread.

    One note tho, threads don't necessarily, terminate when they have been executed, there are runloops that are also threads.

    Laters...
     
  12. kevink2 macrumors 65816

    Joined:
    Nov 2, 2008
    #12
    Also, when a thread hits a blocking call, such as to the OS for disk access, etc, it will block and another of the 49 threads might be able to run.

    One of the downsides of hyperthreading vs a full core is that the CPU cores can share some resources internally to the core. So 2 hyperthreads are not generally as good as 2 cores. The first Intel CPU that supported hyperthreading gave it a bad reputation at first since, with no OS knowledge of hyperthreading, 2 threads may be scheduled that used the same limited on CPU resources, adversely affecting performance. In some cases, even slower than when disabling hyperthreading. Obviously, Intel has done a lot of work through the years to improve matters, and with more extensive CPU real estate, limits the loss.

    I'm sure that, as in anything computer related, you can find benchmarks that show hyperthreading in a bad light. Or benchmarks where 24 hyperthreads work twice as fast as the 12 cores single threaded each. Or even better, if the CPU can handle things better than the OS.
     

Share This Page