2
$\begingroup$

Since a processing core with hyperthreading enabled is presented as two or more cores to the operating system, it can run completely different processes with different, isolated virtual memory spaces. There must be a mechanism that guarantees process address space isolation. How is it done in Intel hyperthreaded CPUs with regards to L1 cache? I can think of three possibilities:

1) virtual-physical address mapping is done before L1 (could add delay to L1);

2) each virtual core has its own L1 cache (costs space on the die);

3) only different threads of the same process are allowed to be hyperthreaded (must be implemented in the OS kernel)

Or is it something completely different?

$\endgroup$
3
  • $\begingroup$ Welcome to Computer Science! The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! $\endgroup$
    – Raphael
    Commented Mar 5, 2018 at 12:08
  • 2
    $\begingroup$ For option 1, you could have a VIPT (Virtually indexed Physically Tagged) cache and it wont add a delay in the critical path. $\endgroup$
    – Isu
    Commented Mar 5, 2018 at 16:12
  • $\begingroup$ @ D.W. With "how is it solved" I meant there must be a solution that guarantees that process memory spaces stay isolated. From your answer below it seems that 1) is valid. I'll add a sentence to make the question more clear $\endgroup$
    – Andy
    Commented Mar 5, 2018 at 16:26

1 Answer 1

1
$\begingroup$

In modern Intel processors, the virtual-physical mapping is done in parallel with the lookup into the L1 cache. There is a trick that gets the effect of doing lookups on virtual addresses, without actually having to complete the virtual-physical mapping before the cache lookup (and thus avoiding the delay you are worried about). See https://stackoverflow.com/q/19039280/781723 and https://software.intel.com/en-us/articles/how-memory-is-accessedfor details of how they make this work.

There is only one L1 cache per physical core. The two virtual cores on the same physical core share the same L1 cache. See, e.g., https://stackoverflow.com/q/27797424/781723 and https://stackoverflow.com/q/32979067/781723.

Different processes can be hyperthreaded on the same physical core.

In general, you can often find answers to these questions by reading the Intel reference manuals.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.