Beyond Physical Memory
Last Problem of Virtualization of memory - what if virtual memory accessed
by all the programs > physical RAM in system
Sees eee eee
Goal - user should be able to write code independent of amount of RAM
available
Aside - Memory overlays
How? think of a big S/W program -> complex large library
Observation - programs only use a small amount of VAS at any given point
of time and thus only those pages can reside in memory to run your
program.
Remaining pages can be put aside on a larger (but slower) device.
Memory Fast but expensive & small
Hierarchy
YY Slow but large & cheaper
Mechanism: OS reserves a part of disk (SWAP space) to store the
VAS/pages that are not being actively used.
Swne SPAc& (m disk)
a Page Size,
Dénrw Preansa/
LAZY uwbe LAZY W
O
!
°
°
2 > oH
PZZLZZPP Nolid , not in memoy ( Susafped oub bo dis)
° Track? add Some information te PT
PTE
V=1, P=1 => Valid, PFN is the location of that Page
V=1, P=0 => Valid (ok to access) but page is not in RAM (reside in disk)
called "Page Fault/Page miss" -> OS brings in the page to RAM
OS needs the physical address of the page from disk
Algo. of Page Fault Control Flow
H/W: Virtual address VPN [Offset
Consult TLB: if hits :| PFN Offset
—— Tr
cess memory
If TLB miss: Fetch PTE
Extract PTE
is valid? not -> "segmentation fault"
is Permission OK? not -> "perm. violation"
is Present? not -> Page fault/miss
OS: Page Fault handler code
Find free physical frame?
if not -> swap out existing page to diskif yes -> bring in desired page & update PTE
return from trap
Expensive operation -> try to minimize
Page Replacement Policies - which one to replace so as to minimize
page faults