What is a CPU thread and how is it related to logical threads in code?

前端 未结 5 1744
执念已碎
执念已碎 2021-01-12 10:10

I have been seeing in the literature for some of the newer CPU\'s such as the Intel Xeon \"Nehalem-EX\" as having 8 cores and 16 threads. What are they talking about here? I

5条回答
  •  萌比男神i
    2021-01-12 10:52

    Hyperthreading (INTEL's trademark by the way) allows each thread to actually run simultaneously. So in this case you could run 8X2 application threads at the same time.

    From the brochure ...

    Intel Nehalem Architecture built on Intel's unique 45nm high-k metal gate technology process

     Up to **8 cores** per processor
     Up to **16 threads per processor** with Intel® Hyper-threading
     2.3 billion transistors
    

    Compare this to single-CPU, single core systems where each thread must be scheduled and at most only one thread will be active - that one running CPU bound task and the others waiting on an I/O transfer.

    Originally threading was used either to model a set of concurrent activities (not model not actually run in parallel) or to produce the appearance of a system which was responsive even while doing I/O. For example without threading, your word-processor would appear to stall while saving a doc.

    For many years I resisted the idea of having multiple threads in my desktop applications - it complicated the code and potentially reduced performance - think of all those mutex operations which require the OS kernel to get involved. With the advent of actually parallel execution of threads, my objections are reduced but I still believe that multiple processes rather than multiple threads in a single process is a better approach.

    Chris

提交回复
热议问题