CPU numbering in a hyperlinked system

I'm trying to figure out how the OS (Windows, linux) assigns numbers to a logical processor in an environment with support for Hyper Streaming.

Both operating systems first assign numbers to physical processors, and then begin numbering the logical processor, or is there some other rule. for example, in 2 systems of a physical processor with a hyperthread, the OS assigns the number 0.2 to the first physical processor, and then to the 1.3-second physical processor ...?

Any links would be really appreciated.

Thanks in advance.

Regards, -Jay.

Edit: the answer to Alanโ€™s question: I need to know this, because in my work I need to associate various threads with specific processors in order to avoid context switching, and I want to make sure that certain THreads are associated with the section of physical processors. Thanks

+7
windows linux-kernel cpu-architecture hyperthreading
source share
2 answers

From what I know, it depends on how the CPU exposes its cores. When HT is turned on, there are no physical physical processors, but rather two logical processors per physical processor, so there is no difference if you run a thread on any logical processor. The only thing that matters is that the pairs of logical processors belong to each physical processor.

With single-core processors (e.g. Pentium 4 with HT) this is pretty straight forward, since you only have one pair - this is (0, 1). When using quad-core processors (e.g. Nehalem), logical pairs of cores (0.4), (1.5), (2.6) and (3.7). A model of the presence of all the first halves of each pair, as well as all the second halves of the shuold scale with future processors having even more cores.

The real question is, why do you need to know the location of the pair? Let the OS scheduler choose the right kernels for the correct threads - it does a pretty decent job.

+8
source share

You can look at /sys/devices/system/cpu/ to find information about the processors. A layout of the cores and their hyper-thread pairs can be found in /sys/devices/system/cpu/cpuN/topology/thread_siblings_list .

+4
source share

All Articles