Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!



The following resources are shared between two threads running in the same core:
Cache
Branch prediction resources
Instruction fetch and decoding
Execution units
How is it implemented, under the covers?
The entire pipeline of the Nehalem-based processor core is set up to recognize 2 separate streams of instructions (one for each hardware thread). Various events cause the pipeline to switch from decoding and dispatching one stream to decoding/dispatching the other stream. All the resources in the pipeline are either shared or duplicated amongst the 2 hardware threads.
IA-32 Instruction Decode
The decode logic takes instruction bytes from the
streaming buffers and decodes them into uops. When
both threads are decoding instructions simultaneously,
the streaming buffers alternate between threads so that
both threads share the same decoder logic. The decode
logic has to keep two copies of all the state needed to
decode IA-32 instructions for the two logical processors
even though it only decodes instructions for one logical
processor at a time. In general, several instructions are
decoded for one logical processor before switching to
the other logical processor. The decision to do a coarser
level of granularity in switching between logical
processors was made in the interest of die size and to
reduce complexity.
Оригинальные регистры внутри процессора (AX, BX, CX, DX итд.) транслируются (или создаются псевдонимы) во внутренние, скрытые от программиста регистры.
MOV EAX,1
PUSH EAX
MOV EAX,2
ADD EBX,EAX
Путешествие через вычислительный конвейер процессора