0% found this document useful (0 votes)
1 views24 pages

Virtual Memory Management - Final

This document discusses memory management concepts including limited RAM size, virtual memory, and demand paging. It explains page faults, page replacement algorithms (FIFO, LRU, ORA), and effective memory access time. Additionally, it includes numerical problem-solving examples related to these algorithms.

Uploaded by

tvganesann
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views24 pages

Virtual Memory Management - Final

This document discusses memory management concepts including limited RAM size, virtual memory, and demand paging. It explains page faults, page replacement algorithms (FIFO, LRU, ORA), and effective memory access time. Additionally, it includes numerical problem-solving examples related to these algorithms.

Uploaded by

tvganesann
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Memory Management Part - 2

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

P10 P11 P12 P20


CPU
P21 P22

RAM
Secondary Memory
Demand Paging

• It states that pages in main memory are loaded on demand.

• All pages of a process would not be swapped in together at once.


Virtual Memory

• 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.

• Virtual Memory is not a type of memory rather it is a concept.

• 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

P10 P11 P12 P20


CPU
P21 P22 P30 P31

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.

• Three algorithms used for page replacement

– FIFO (First In First Out)

– LRU (Least Recently Used)

– ORA (Optimal Replacement Algorithm)


FIFO (First In First Out)

• In case of page fault we delete that page from memory who came first among currently available
pages.

• Let’s discuss a numerical problem to understand it deeply.


FIFO (First In First Out)

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 ).

Page Reference String: 3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3


# of Page Faults and Page Hits
• Number of page faults =

• Number of page hits =


Least Recently Used Algorithm
LRU (Least Recently Used)
• In this algorithm we look back in the reference string from the current position.

• In case of page fault the we delete the page which has not been used for the longest time among all
available pages.

• Here deletion of pages is based upon their immediate past usage.

• 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.

• Let’s solve a numerical problem to understand it deeply.


LRU (Least Recently Used)

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 ).

Page Reference String: 3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3


# of Page Faults and Page Hits
• Number of page faults =

• Number of page hits =


Optimal Replacement Algorithm
ORA (Optimal Replacement Algorithm)
• This algorithm doesn’t believe in predicting the upcoming page rather it says to read the reference
string further to current position.

• 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.

• Let’s solve a numerical problem to understand it deeply.


ORA (Optimal Replacement Algorithm)

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

P10 P11 P12 P20


CPU
P21 P22 P30 P31

P32

Page Table
Physical Memory
Effective Memory Access Time Cont.
• EMAT = P*S + (1-P)*M

• Where P = Page Fault Rate

• S = Page Fault Service Time

• M = Main Memory Access Time


Any Query?

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

You might also like