1

我对操作系统中的内存管理有疑问。我知道缓存是一个临时存储位置,用于加速内存访问,而 TLB 用于加速从虚拟地址到物理地址的转换。

  1. 现在如果生成一个虚拟内存地址,第一步是什么?
  2. 如果第一步是引用TLB并生成物理地址,那么第二步是什么?(是否引用缓存以查看该数据是否存储在缓存中)?
  3. 现代计算机是否使用 TLB?
  4. cpu怎么知道页表在哪里?
4

1 回答 1

2
  1. It depends what you mean by "generated". If you really meant "read", then the first step would be to be either to look into the TLB if the address has already been translated or, if your cache supports virtual addresses, to look in the cache itself to see if there is an entry corresponding to that virtual address (and if it belongs to the appropriate process, the virtual address itself is not enough).
  2. If the first step was a virtual to physical translation, then the cache is for physical addresses. Assuming you want to read, then indeed the next step would be to look at the cache.
  3. Yes they do. Most processors using virtual memory use TLB.
  4. Yes, however it depends on your architecture. On an Intel(x86) processor, for instance, the page table pointer is stored into the cr3 register.
于 2013-05-18T16:04:21.893 回答