C-CS316 - Lect09 - Memory Management - Part 2
C-CS316 - Lect09 - Memory Management - Part 2
Operating Systems
C-CS316 Spring 2024
LECTURE 09:
Memory Management
Dr. Basma Hassan Dr. Ahmed Salama
[email protected] [email protected]
How ??
P=0 D= 0
F=5 D=0
P=3 D= 1
F=2 D=1
• Memory structures for paging can get huge using straight-forward methods
• One simple solution is to divide the page table into smaller units
• Hierarchical Paging
• Since the page table is paged, the page number is further divided into:
• a 10-bit page number
• a 10-bit page offset
where p1 is an index into the outer page table, and p2 is the displacement within the
page of the inner page table
• Known as forward-mapped page table
• Each element contains (1) the virtual page number (2) the value of the mapped page frame
(3) a pointer to the next element
• Virtual page numbers are compared in this chain searching for a match
• If a match is found, the corresponding physical frame is extracted
• Rather than each process having a page table and keeping track of all possible logical pages,
track all physical pages
• Entry consists of the virtual address of the page stored in that real memory location, with
information about the process that owns that page
• Decreases memory needed to store each page table, but increases time needed to search the
table when a page reference occurs
• Backing store – fast disk large enough to accommodate copies of all memory images
for all users; must provide direct access to these memory images
• Roll out, roll in – swapping variant used for priority-based scheduling algorithms;
lower-priority process is swapped out so higher-priority process can be loaded and
executed
• Major part of swap time is transfer time; total transfer time is directly proportional to
the amount of memory swapped
• System maintains a ready queue of ready-to-run processes which have memory
images on disk
Faculty of Computing and Information Sciences
Schematic View of Swapping