Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

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)

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top