OS & Hardware

On a multicore system, when the OS modifies a page-table entry to revoke a mapping, what must be done?

  1. AFlushing only its own core's TLB is enough; other cores automatically use the correct translation
  2. BMaking sure the stale translation is removed from other cores' TLBs too
  3. CNothing; every TLB is updated at the same moment the page table is written
Show answer and explanation

Answer: B. Making sure the stale translation is removed from other cores' TLBs too

On many CPUs, unlike caches, TLBs are not kept coherent by hardware, so other cores' TLBs may still hold the translation from before the page table was changed. Left alone, other cores could still access the revoked page. The OS therefore removes the stale entry from other cores, either by sending inter-processor interrupts or by using instructions that broadcast the invalidation, and waits for completion. This is a TLB shootdown, and it gets more expensive as core counts rise.

  • A. Other cores' TLBs may still hold the stale translation.
  • B. Correct. Stale translations must be removed from other cores' TLBs too.
  • C. On many CPUs, TLB coherence is not maintained automatically.
Practice this topic Back to topic

More OS & Hardware questions

  1. What generally happens when a program accesses an address the OS has not allocated?
  2. In a mechanism that maps a file into memory (such as mmap), what happens when the file's contents are read?
  3. When writing small data one byte at a time, why is accumulating it in a user-space buffer and writing in bulk faster than calling a system call each time?
  4. What is the main purpose of giving a CPU a privileged (kernel) mode and a user mode?
  5. What is the mechanism by which applications ask the OS to perform tasks such as file I/O?