Difference between Cache and Translation LookAside Buffer[TLB]

ぐ巨炮叔叔 提交于 2020-01-10 08:49:52

问题


What is the difference between Cache and Translation LookAside Buffer [TLB] ?


回答1:


From Wiki:

In computer science, a cache (pronounced /kæʃ/, kash) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. In other words, a cache operates as a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, it can be used in the future by accessing the cached copy rather than re-fetching or recomputing the original data.

whereas

A Translation lookaside buffer(TLB) is a CPU cache that memory management hardware uses to improve virtual address translation speed. It was the first cache introduced in processors. All current desktop and server processors (such as x86) use a TLB. A TLB has a fixed number of slots that contain page table entries, which map virtual addresses to physical addresses. It is typically a content-addressable memory (CAM), in which the search key is the virtual address and the search result is a physical address.

Also have a look at this.




回答2:


Cache stores the actual contents of the memory.

TLB on the other hand, stores only mapping. TLB speeds up the process of locating the operands in the memory.

Cache speeds up the process of reading those operands by copying them to a faster physical memory.




回答3:


Cache is to buffer memory accesses - actual reads and writes to memory. TLA buffer is to buffer mappings from virtual addresses in the address space of the process to physical addresses in memory - the service operations accompanying memory accesses.




回答4:


TLB is a special kind of cache which is associated with CPU.When We are Using Virtual Memory we need TLB for faster translation of virtual address to physical address. TLB only store page_no , offset, frame_no and some control bits. While Cache is for storing block of data which are used frequently. After getting physical address from the TLB/page_table we look for that address in cache if it is not found there,than we look for main memory.(fig 8.10 william stalling 6e)



来源:https://stackoverflow.com/questions/1973473/difference-between-cache-and-translation-lookaside-buffertlb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!