2079 10

BIT204 ยท 2079 ยท 5 marks

What is TLB? Explain the importance of TLB in conversion of logical address to physical address.

What is TLB? Explain the importance of TLB in conversion of logical address to physical address. [5]

Operating SystemsChapter 8: Virtual Memory and PagingTranslation Lookaside Buffer

Quick answer

A Translation Lookaside Buffer (TLB) is a small, fast hardware cache (associative memory) that stores recently used page table entries. It acts as a high-speed lookup table used by the Memory Management Unit (MMU) to speed up the translation of logical (virtual) addresses to physical addresses.

Translation Lookaside Buffer (TLB)

Definition

Note: No specific reference notes were found for this topic; the answer is based on standard OS theory as taught in BSc CSIT curriculum.


Structure of TLB

Each entry in the TLB contains:

Page NumberFrame Number
pf

The TLB is implemented using associative memory, meaning all entries are searched simultaneously (in parallel), making lookup extremely fast.


Importance of TLB in Logical to Physical Address Conversion

Without TLB, every memory access requires two memory accesses:

  1. One to fetch the page table entry (from main memory)
  2. One to access the actual data/instruction

TLB eliminates this overhead in most cases.

Step-by-Step Address Translation with TLB

Logical Address = (Page Number p, Offset d)
                        |
                   Search TLB
                  /           \
            TLB Hit          TLB Miss
               |                 |
        Get frame f        Access Page Table
               |            (in main memory)
               |                 |
               |           Get frame f
               |           Update TLB
               |                 |
               +--------+--------+
                        |
              Physical Address = (f, d)
                        |
                  Access Memory

Case 1: TLB Hit

  • The page number p is found in the TLB.
  • The corresponding frame number f is retrieved directly.
  • Physical address = f * page_size + d
  • Only one memory access is needed (for actual data).

Case 2: TLB Miss

  • The page number p is not found in the TLB.
  • The page table in main memory is accessed to find frame f.
  • The entry (p, f) is loaded into TLB for future use.
  • Physical address is then formed.
  • Two memory accesses are needed.

Effective Memory Access Time (EMAT)

$$EMAT = \alpha \times (T_{TLB} + T_m) + (1 - \alpha) \times (T_{TLB} + 2T_m)$$

Where:

  • $\alpha$ = TLB hit ratio
  • $T_{TLB}$ = TLB access time
  • $T_m$ = Main memory access time

A high hit ratio (typically 90-99%) means most accesses are fast, greatly reducing average memory access time.


Summary of Importance

PointExplanation
SpeedAvoids slow page table lookup in main memory on a hit
EfficiencyReduces average memory access time significantly
TransparencyWorks automatically without programmer involvement
LocalityExploits temporal/spatial locality of memory references

In conclusion, TLB is a critical hardware component that makes paged memory systems practical and efficient by caching frequently used address translations.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.