Translation Lookaside Buffer (TLB) in Operating System (OS)

Translation lookaside buffer

Translation Look aside Buffer

On this page we will discuss about Translation look aside buffer (TLB) in operating system (OS) . A translation look aside buffer (TLB) is a memory cache that stores recent translations of virtual memory to physical addresses for faster retrieval.

Translation Look aside Buffer in Operating System

Translation look aside buffer in operating system overcomes the problem the occurs in paging. So, to understand the concept of translation look aside buffer which should have a knowledge about paging and it’s disadvantages that TLB overcomes.

Paging in Operating System

  • Paging is a memory management scheme that permits the physical address space of a process to be non-contiguous.
  • Paging avoids external fragmentation and the need for compaction.
  • The basic method for implementing paging involves breaking physical memory into fixed-sized blocks called frames and breaking  logical memory into blocks of same size called pages.
  • When a process is executed, its pages are loaded into any available memory frames from their source file (a file system or the backing store).
  • The backing store is divided into fixed-sized blocks that are the same size as the memory frames or clusters of multiple frames.

Disadvantages of Paging

  • Longer memory access time.
  • Internal fragmentation to every last page of the process.
  • Large memory space is required as page table pre stored in main memory as well.

Translation Look aside Buffer(TLB)

  1. Translation look aside buffer (TLB) is a special, small, fast-lookup hardware cache.
  2. The TLB is associative, high-speed, memory.
  3. Each entry in the TLB consists of two parts: a key (or tag) and a value.
  4. when the associative memory is presented with an item, the item is compared with all keys simultaneously.
  5. If the item is found, the corresponding value field is returned.
  6. Typically, the number of entries in a TLB is small, often numbering between 64 and 1,0241.
  7. The TLB is used with pages tables in the following way :
Translation Look aside Buffer (TLB)_
  1. The TLB contains only a few of the page-table entries. When a logical address is generated by the CPU, its page number is presented to the TLB.
  2. if the page number is found (known as TLB hit), its frame number is immediately available and is used to access memory.
  3. If the page number is not found in the TLB (known as TLB miss) a memory reference to the page table must be made.
  4. when the frame number is obtained, we can use it to access memory.
  5. In addition, we add the page number and frame number to the TLB, so that they will be found quickly on the next reference.
  6. If  the TLB is already full of entries, the operating system must select one for replacement.
  7. Replacement policies range from least recently used (LRU) to random.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription