Virtual Memory Management - Final
Virtual Memory Management - Final
Agenda
• In this module we will cover
– Problem with Limited RAM size
– Virtual Memory
– Demand Paging
– Page Fault and Page Replacement
– Page Replacement Algorithms and Numerical Problem Solving on them
• FIFO, LRU, ORA
– Effective Memory Access Time
– Thrashing
Demand Paging
P1 P2 P3
RAM
Secondary Memory
Demand Paging
• Because of concept of demand paging programmer / user has an illusion (virtual copy) of memory.
• Since user have this virtual copy (imaginary) memory so he doesn’t have o take care about the size of
process or degree of multi programing up to a certain limit.
• Which gives an illusion (freedom) to a programmer / user to start as many processes he wants.
• Or a programmer / user can have an immensely bigger process whose size if bigger than main
memory.
Page Fault and Page Replacement
Page Fault & Page Replacement
P1 P2 P3
P32
Page Table
Physical Memory
Page Replacement Algorithms
• When CPU demands a page to process and it is not available in main memory, this situation is called
Page Fault.
• In case of page fault that page has to bring from secondary memory to main memory.
• And one of the page from main memory would be swapped out to secondary memory.
• In case of page fault we delete that page from memory who came first among currently available
pages.
Consider the following page reference string and apply the FIFO algorithm to find out total number of page
faults and page hits during allocation of memory (assuming that total number of available frames is 4 ).
• In case of page fault the we delete the page which has not been used for the longest time among all
available pages.
• Basically this algorithm believes in locality of reference and it assumes that the pages who are
currently in use they would be required in near future.
Consider the following page reference string and apply the LRU algorithm to find out total number of page
faults and page hits during allocation of memory (assuming that total number of available frames is 4 ).
• So in case of page fault it says to look forward in the reference string and remove such a page which
is not used any further in the string.
• In case if all of them are used than check which of them is farthest, remove it in case of any page
fault.
Consider the following page reference string and apply the ORA algorithm to find out total number of page
faults and page hits during allocation of memory (assuming that total number of available frames is 4 ).
Page Reference String: 3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3
Effective Memory Access Time
EMAT (Effective Memory Access Time)
P1 P2 P3
P32
Page Table
Physical Memory
Effective Memory Access Time Cont.
• EMAT = P*S + (1-P)*M
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Summary
• In this module we have covered
– Problem with Limited RAM size
– Virtual Memory
– Demand Paging
– Page Fault and Page Replacement
– Page Replacement Algorithms and Numerical Problem Solving on them
• FIFO, LRU, ORA
– Effective Memory Access Time
– Thrashing
Thank You
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited