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.

If the TLB gets flushed everytime a program does a context switch, then when that program is run again, where does the TLB go to reload its table? Also, if the table gets flushed, then how are other programs prevented from writing into memory that belongs to that program?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It starts out empty and is reloaded as accesses occur.

The TLB is an optimization that avoids reading slower page table information to locate application memory; in particular, memory access control is done form the page tables, not the TLB.

And the reason you clear it is two-fold: because if you didn't, accesses from the next process might go to your process's memory (the exact opposite of your presumption!), and because it could conceivably be used to snoop on your process's memory and/or activity.

share|improve this answer
    
I read in a book that the TLB has its own table, and it only goes to the page table only if nothing is found in its own table. –  tony_sid Mar 5 '11 at 4:01

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.