Unit 4 Part 2
Unit 4 Part 2
*Note: 210 = 1K, 220 = 1M, 230 = 1G, 240 = 1T, 250 = 1P
In Operating System (Memory Management Technique: Paging), for each process page table
will be created, which will contain Page Table Entry (PTE). This PTE will contain information
like frame number (The address of main memory where we want to refer), and some other
useful bits (e.g., valid/invalid bit, dirty bit, protection bit etc.). This page table entry (PTE) will
tell where in the main memory the actual page is residing.
Now the question is where to place the page table, such that overall access time (or reference
time) will be less.
The problem initially was to fast access the main memory content based on address generated
by CPU (i.e. logical/virtual address). Initially, some people thought of using registers to store
page table, as they are high-speed memory so access time will be less.
The idea used here is, place the page table entries in registers, for each request generated from
CPU (virtual address), it will be matched to the appropriate page number of the page table,
which will now tell where in the main memory that corresponding page resides. Everything
seems right here, but the problem is register size is small (in practical, it can accommodate
maximum of 0.5k to 1k page table entries) and process size may be big hence the required page
table will also be big (let’s say this page table contains 1M entries), so registers may not hold
all the PTE’s of Page table. So this is not a practical approach.
To overcome this size issue, the entire page table was kept in main memory. But the problem
here is two main memory references are required:
1. To find the frame number
2. To go to the address specified by frame number
To overcome this problem a high-speed cache is set up for page table entries called a
Translation Lookaside Buffer (TLB). Translation Lookaside Buffer (TLB) is nothing but a
special cache used to keep track of recently used transactions. TLB contains page table entries
that have been most recently used. Given a virtual address, the processor examines the TLB if
a page table entry is present (TLB hit), the frame number is retrieved and the real address is
formed. If a page table entry is not found in the TLB (TLB miss), the page number is used to
index the process page table. TLB first checks if the page is already in main memory, if not in
main memory a page fault is issued then the TLB is updated to include the new page entry.
Effective memory access time (EMAT): TLB is used to reduce effective memory access
time as it is a high speed associative cache.
EMAT = h*(c+m) + (1-h)*(c+2m) where h*(c+m) refers t0 TLB HIT and (1-h)*(c+2m)
refers to TLB MISS
where, h = hit ratio of TLB
m = Memory access time
c = TLB access time
Numerical on TLB
Q1. If memory access time is 400µs and TLB access time is 50µs and TLB hit%
is 90%. Find the average instruction access time and effective memory access
time.
Sol.
Given:
m= 400µs, c= 50µs, h= 0.9
If TLB is not present,
Then Total memory access time = 2 x m = 2 x 400µs = 800 µs (*solve only if
asked*)
If TLB is present,
Then Effective memory access time (EMAT) = h*(c+m) + (1-h)*(c+2m)
Data Storage Page table stores the page Segmentation table stores the
8
data. segmentation data.