Lecture-28MemoryManagement2
Lecture-28MemoryManagement2
Lecture – 20
(Memory Management – 2)
Page number (p) – used as an index into a page table which contains base address of each
page in physical memory
Page offset (d) – combined with base address to define the physical memory address that is
sent to the memory unit (no. Of bits required to represent the page size or word no of page)
frame number (f) – used to represent frame number which is a base address base address of
each page in physical memory
2. Consider the physical memory space is 64MB and 32-bit virtual address space. Page size is 4KB,
what is the approximate size of page table?
(a) 2 MB (b) 3MB (c ) 4 MB (d) 6 MB
Problems
3. Consider the virtual address space is 32 bit.
Page size=4KB. Page table entries of 4 byte. What is the approximate size of page table size?
(a)2MB (b) 3MB (c) 4 MB (d) 8MB
4. Consider the computer system implements 40 bit virtual address and Page size is 16KB, what is
the approximate size of page table, if each page table entry is 48 bits.
(a)398MB (b) 48 MB(c) 192 MB(d) 96MB
Hardware Implementation of Page-table
Case1: Implement the page table as a set of dedicated registers
Case2:-Keep the page table in main memory and a page table base register (PTBR)
Problem:- 2 memory accesses (one for page table and one for actual byte)
Solution of Case 2
TLB is high-speed cache memory.
It consists of two parts : key and value
Search is fast
Few of the page-table entries
When logical addresses is generated by the CPU, its page number is presented to the TLB.
If page number is found, its frame number is easily available and used to access the memory.
If not found in the TLB, a memory reference to the page table is made.
After accessing, we add the page number and frame number to the TLB.
Paging With TLB
Effective Access Time
• Associative Lookup = e time unit
• Assume memory cycle time is 1 microsecond
• Hit ratio (a) – percentage of times that a page number is found in TLB;
Sol:-
Problem 1 Solution
Consider that 80-percent hit ratio means that we find the desired page number in the
TLB 80 percent of the time.
Assume it takes 20 nanoseconds to search the TLB and 100 nanoseconds to access
memory.
Find the effective memory-access time.
Sol:-EAT= TLB hit (TLB access time+Memeory acc time)+(1-TLB hit) (TLB AT+2MAT)
=0.8(20+100)+0.2(20+200)
=96+44
= 140ns
Problem 2
If effective memory access time is given as 160ns. We assume 90-percent hit ratio
means that we find the desired page number in the TLB 90 percent of the time.
100 nanoseconds to access memory.
Find the TLB access time.
Sol:-
Problem 2
If effective memory access time is given as 160ns. We assume 90-percent hit ratio
means that we find the desired page number in the TLB 90 percent of the time.
100 nanoseconds to access memory.
Find the TLB access time.
Sol:-EAT= TLB hit (TLB access time+Memeory acc time)+(1-TLB hit) (TLB AT+2MAT)
160=0.9(T+100)+0.1(T+200)
160=1T+90+20
T= 50ns(TLB access time)
Memory Protection Using bit
Valid-invalid bit attached to each entry in the page table:
• “valid” indicates that the associated page is in the process logical address space, and is
thus a legal page
• “invalid” indicates that the page is not in the process logical address space
Shared Pages Concept
An advantages of paging is the possibility of sharing common code.
This is particularly important in time-sharing environment.
Shared code
• One copy of read-only (reentrant) code shared among processes (i.e., text
editors, compilers, window systems).
• Shared code must appear in same location in the logical address space of
all processes
• Non-Shared Memory
Total Size=6800KB
• Shared Memory
Total Size=950KB
Thank You
Any Questions?