







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of virtual memory, its management techniques, and solutions to memory management problems. Topics include paging, page table management, and the role of the memory management unit (mmu).
Typology: Study notes
1 / 13
This page cannot be seen from the preview
Don't miss anything!








What is virtual memory? Virtual memory management z Paging Page table management
Access time decreases
Capacity decreases
Cost increases
How to allocate memory to processes? Partitions are created at load times?
Memory at system start up
Three processes started
OS Process 1^ Process 2^ Process 3
Second processes is finished
OS Process 1^ Process 3
A large fourth process arrives. Process 3 is relocated. How to relocate a process? Expensive.
OS Process 1^ Process 3^ Process 4
Virtual memory of process on disk
Real memory of system
Map (translate) virtual address to real
VM is conceptual It is constructed on disk Size of VM is not limited (usually larger than real memory) All process addresses refer to the VM image When the process executes all VM addresses are mapped on to real memory Virtual Memory contents are loaded into the memory on demand
Virtual and real memory are divided into fixed sized pages Programs are divided into pages A process address (both in virtual & real memory) has two components
Virtual Address Space Physical Address Space
virtual page number
offset in page
physical page number
offset in page
Translate virtual page number to physical page number
When process pages are transferred from VM to real memory, page numbers must be mapped from virtual to real memory addresses This mapping is done by software & hardware When the process is started only the first page (main) is loaded. Other pages are loaded on demand.
The position and function of the MMU
Internal Operation of the MMU
Note that virtual address is 16 bits (64K virtual memory)
But the physical address is 15 bits (32K real memory)
Assume: 64K Virtual Memory 32K Real Memory 4K Page size
Index of page table is the virtual page #
Page Table (^0) Page frame #
Page protection
Reference bit Modification bit
Validity bit
Page Table Entry
During the execution every page reference is checked against the page map table entry If the validity bit is set (ie., page is in memory) execution continues If the page is not in memory a page fault (interrupt - trap) occurs and the page is fetched into memory If the memory is full, pages are written back using a page replacement algorithm
Process 1Virtual Address Space (^) Physical Address Space
Process 2 Virtual^0 Address Space
3 4 1
5 2
0 6 2
1
0
Page tables
Physical Memory
PID
Page Tables in OS Memory...
Process 1 Virtual Address Space
Physical Address Space
Process 2 Virtual^0 Address Space
Consider a logical address space of 1024 pages of 1024 bytes each, mapped onto a physical address space of 512 frames. z What is the format of the virtual address? z What is the format of the physical address? z What is the size of a page table for this process? z Calculate the physical address corresponding to the virtual address 2032 (in decimal)? Use the page table on the right.
โฆ
1 33
1 3
1 14
1 6
Physical address
V