Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In SMT (simultaneous multithreading) processors in which threads share the TLB, how does the TLB differentiate one thread's access from the other one? Each thread has its own set of pages loaded into memory, and independent threads do not share pages. I would guess there is some kind of hardware support for that in TLB, like some extra bits. But I would like to know more details.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If threads share a TLB, there is no need to differentiate one thread's access from another one. If threads share a vm, they have the exact same view of memory. If they don't, then they don't share a TLB.

share|improve this answer
    
if threads are from different processes, then they don't have the same view of memory. So their virtual to physical page mapping is different. In SMT processors, two (or more, depending on implementation) threads from different processes can be run at the same time. So as far as I know, they share the same TLB. –  aminfar Jan 27 '12 at 4:06
1  
There are two different basic TLB designs. In one, the TLB is per-virtual-core, and the entire TLB is flushed if the vm changes. In the other, the TLB can be shared among cores or not, is not flushed when the vm changes, but contains a tag indicating which vm the entry is for. –  David Schwartz Jan 27 '12 at 4:09
    
@aminfar, AFAIK if the threads are from two different processes, then I don't think that's any different than 2 processes sharing the TLB. Some cpus support sharing (TLB entries are marked to identify the process to which it belongs), others clear the TLB on context switch. –  Peon Jan 27 '12 at 4:13
1  
@aminfar The section you cite mentions Address Space Numbers (the same thing as ASIDs, sometimes called Process IDs), which are defined for the Alpha ISA. (Number is probably a more correct but less common name since numbers may be reused [with appropriate TLB invalidations] so they are not unique identifiers which is somewhat implied by ID.) These are the "extra bits" that distinguish the pages from different processes (address spaces). –  Paul A. Clayton Oct 5 at 18:51
1  
@aminfar Threads within a process (in the usual way that threads are handled) do not have different page access permissions or other metadata and so do not need any distinction in the TLB. –  Paul A. Clayton Oct 6 at 1:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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