Hardware Threads vs Software Threads

Let me start with some background concepts. A single computing component which has more than one independent actual central processing units called coresĀ  is a multi-core processor, these cores are the units that read and execute program instructions. That makes it possible to run instructions at the same time, in parallel.

In order to take advantage of multiple physical cores, it is necessary to run many processes or to run more than one thread in a single process, creating multi-threaded code.

However, each physical core can offer more than one hardware thread, also known as a logical core or logical processor.

Each running program in Windows is a process. Each process creates and runs one or more threads, known as software threads to differentiate them from the previously explained hardware threads

A process has at least one thread, the main thread. An operating system scheduler shares out the available processing resources fairly between all the processes and threads it has to run. Windows scheduler assigns processing time to each software thread. When Windows scheduler runs on a multi-core microprocessor, it has to assign time from a hardware thread, supported by a physical core, to each software thread that needs to run instructions. As an analogy, you can think of each hardware thread as a swim lane and a software thread as a swimmer.

Windows Operating System recognizes each hardware thread as a schedulable logical processor. Each logical processor can run code for a software thread. A process that runs code in multiple software threads can take advantage of hardware threads and physical cores to run instructions in parallel. Windows scheduler can decide to reassign one software thread to another hardware thread to load-balance the work done by each hardware thread. Because there are usually many other software threads waiting for processing time, load balancing will make it possible for these other threads to run their instructions by organizing the available resources.

Leave a Reply

Your email address will not be published. Required fields are marked *


seven − = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>