SlideShare a Scribd company logo
1 of 12
PAGE REPLACEMENT
ALGORITHMS
(FIFO/LRU/OPT)
A PRESENTATION BY ARIJIT ROY
COMPUTER SCIENCE & ENGG. DEPT., 2ND YEAR
HOOGHLY ENGINEERING & TECHNOLOGY COLLEGE
FIFO PAGE REPLACEMENT ALGORITHM
Suppose, all the page frames are filled with
different pages.
Now a new page request occurs.
This required page is not present in any
frame.
Then the page which came first, that will
swap out from the frame.
New page will swap in to that empty frame.
Q. Suppose there are page requests 5,2,3,2,7,1,3,4,5,1.
Assume there are 3 frames in RAM. Show the page
replacement by FIFO algorithm and calculate – number of
page hits and page faults, Hit ratio and miss ratio.
5 2 3 2 7 1 3 4 5 1
Q. Suppose there are page requests 5,2,3,2,7,1,3,4,5,1.
Assume there are 3 frames in RAM. Show the page
replacement by FIFO algorithm and calculate – number of
page hits and page faults, Hit ratio and miss ratio.
5 2 3 2 7 1 3 4 5 1
5 5
2
5
2
3
5
2
3
7
2
3
7
1
3 3
1
7 7
1
4 4
1
5 5
1
4
Page Hit Page Fault
No. of Page Hit = 3
No. of Page Fault = 7
 Hit Ratio = (No.
of Page Hit /
Total Pages) =
3/10
 Miss Ratio =
(No. of Page
Fault / Total
Pages) = 1- Hit
Ratio = 7/10
LRU PAGE REPLACEMENT ALGORITHM
Suppose, all the page frames are filled with
different pages.
Now a new page request occurs.
This required page is not present in any
frame.
Then the page which is least recently used
that will swap out.
New page will swap in to that empty frame.
Q. Suppose there are page requests 2,3,1,2,4,1,6,2,5,4.
Assume there are 3 frames in RAM. Show the page
replacement by LRU algorithm and calculate – number of
page hits and page faults, Hit ratio and miss ratio.
2 3 1 2 4 1 6 2 5 4
Q. Suppose there are page requests 2,3,1,2,4,1,6,2,5,4.
Assume there are 3 frames in RAM. Show the page
replacement by LRU algorithm and calculate – number of
page hits and page faults, Hit ratio and miss ratio.
2 3 1 2 4 1 6 2 5 4
2 2 2 2 2 2 6 6 6 4
2
55111111
3 3 3 4 4 4 2 2
No. of Page Hit = 2
No. of Page Fault = 8
 Hit Ratio = (No.
of Page Hit /
Total Pages) =
2/10 = 1/5
 Miss Ratio = (No.
of Page Fault /
Total Pages) = 1 –
Hit Ratio = 8/10 =
4/5Page Hit Page Fault
OPTIMAL PAGE REPLACEMENT ALGORITHM
Suppose, all the page frames are filled with
different pages.
Now a new page request occurs.
This required page is not present in any
frame.
Then the page which is used most later that
will swap out.
New page will swap in to that empty frame.
Q. Suppose there are page requests 2,1,5,3,4,2,5,1,2,5.
Assume there are 3 frames in RAM. Show the page
replacement by Optimal page replacement algorithm and
calculate – number of page hits and page faults, Hit ratio and
miss ratio.
2 1 5 3 4 2 5 1 2 5
Q. Suppose there are page requests 2,1,5,3,4,2,5,1,2,5.
Assume there are 3 frames in RAM. Show the page
replacement by Optimal page replacement algorithm and
calculate – number of page hits and page faults, Hit ratio and
miss ratio.
2 1 5 3 4 2 5 1 2 5
Page FaultPage Hit
2 2
1
5
2
1
5
2
3
5
4
2 2
4
5
2
4
5
2
1
5
2
1
5
2
1
5
3 is not present. So it will use in far future.4 is not present. So it will use in further future.
No. of Page Hit = 4
No. of Page Fault = 6
 Hit Ratio = (No.
of Page Hit /
Total Pages) =
4/10 = 2/5
 Miss Ratio = (No.
of Page Fault /
Total Pages) = 1 –
Hit Ratio = 6/10 =
3/5
THAT’S ALL FOR THE DAY
There is a set of problems from this algorithms
are already given. You can download it from the
link given below.
Link - https://drive.google.com/open?id=10kDzksl-
aaPcAESSTB3f30nnxBDhftvL
Link is also given in description box.
You can mail me the answer sheet on
byte2bytelearn@gmail.com
HOPE YOU GUYS ENJOY THIS SLIDE.
SEE YOU IN THE NEXT VIDEO.
STAY HOME, STAY SAFE.

More Related Content

What's hot

Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithmsMazin Alwaaly
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page tableduvvuru madhuri
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentationRanjeet Kumar
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Implementation of page table
Implementation of page tableImplementation of page table
Implementation of page tableguestff64339
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentationhamza haseeb
 
Ram and-rom-chips
Ram and-rom-chipsRam and-rom-chips
Ram and-rom-chipsAnuj Modi
 
Timing and control
Timing and controlTiming and control
Timing and controlchauhankapil
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)Mahesh Kumar Attri
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formatsMazin Alwaaly
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxSumalatha A
 

What's hot (20)

Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithms
 
Page replacement
Page replacementPage replacement
Page replacement
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Implementation of page table
Implementation of page tableImplementation of page table
Implementation of page table
 
Memory management
Memory managementMemory management
Memory management
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentation
 
Instruction code
Instruction codeInstruction code
Instruction code
 
Ram and-rom-chips
Ram and-rom-chipsRam and-rom-chips
Ram and-rom-chips
 
Timing and control
Timing and controlTiming and control
Timing and control
 
Data Hazard and Solution for Data Hazard
Data Hazard and Solution for Data HazardData Hazard and Solution for Data Hazard
Data Hazard and Solution for Data Hazard
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
Stack organization
Stack organizationStack organization
Stack organization
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 

Similar to FIFO, LRU, OPTIMAL Page Replacement Algorithm

Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...MdAlAmin187
 
Pge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdfPge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdf82NehaPal
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OSC.U
 
Page replacement algorithm
Page replacement algorithmPage replacement algorithm
Page replacement algorithmLavina Gehlot
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt completeKalai Selvi
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacementVaibhav Khanna
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryWayne Jones Jnr
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Operating system 39 first in first out algorithm
Operating system 39 first in first out algorithmOperating system 39 first in first out algorithm
Operating system 39 first in first out algorithmVaibhav Khanna
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Siddhi Viradiya
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfHarika Pudugosula
 

Similar to FIFO, LRU, OPTIMAL Page Replacement Algorithm (20)

Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...
 
Pge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdfPge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdf
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
Virtual memory
Virtual memory Virtual memory
Virtual memory
 
OSCh10
OSCh10OSCh10
OSCh10
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
 
Page replacement algorithm
Page replacement algorithmPage replacement algorithm
Page replacement algorithm
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
 
Ch09
Ch09Ch09
Ch09
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
 
Operating System
Operating SystemOperating System
Operating System
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
Distributed Operating System_3
Distributed Operating System_3Distributed Operating System_3
Distributed Operating System_3
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Operating system 39 first in first out algorithm
Operating system 39 first in first out algorithmOperating system 39 first in first out algorithm
Operating system 39 first in first out algorithm
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)
 
page_fault pbm.ppt
page_fault pbm.pptpage_fault pbm.ppt
page_fault pbm.ppt
 
Page replacement alg
Page replacement algPage replacement alg
Page replacement alg
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
 

Recently uploaded

power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 

Recently uploaded (20)

young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 

FIFO, LRU, OPTIMAL Page Replacement Algorithm

  • 1. PAGE REPLACEMENT ALGORITHMS (FIFO/LRU/OPT) A PRESENTATION BY ARIJIT ROY COMPUTER SCIENCE & ENGG. DEPT., 2ND YEAR HOOGHLY ENGINEERING & TECHNOLOGY COLLEGE
  • 2. FIFO PAGE REPLACEMENT ALGORITHM Suppose, all the page frames are filled with different pages. Now a new page request occurs. This required page is not present in any frame. Then the page which came first, that will swap out from the frame. New page will swap in to that empty frame.
  • 3. Q. Suppose there are page requests 5,2,3,2,7,1,3,4,5,1. Assume there are 3 frames in RAM. Show the page replacement by FIFO algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 5 2 3 2 7 1 3 4 5 1
  • 4. Q. Suppose there are page requests 5,2,3,2,7,1,3,4,5,1. Assume there are 3 frames in RAM. Show the page replacement by FIFO algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 5 2 3 2 7 1 3 4 5 1 5 5 2 5 2 3 5 2 3 7 2 3 7 1 3 3 1 7 7 1 4 4 1 5 5 1 4 Page Hit Page Fault No. of Page Hit = 3 No. of Page Fault = 7  Hit Ratio = (No. of Page Hit / Total Pages) = 3/10  Miss Ratio = (No. of Page Fault / Total Pages) = 1- Hit Ratio = 7/10
  • 5. LRU PAGE REPLACEMENT ALGORITHM Suppose, all the page frames are filled with different pages. Now a new page request occurs. This required page is not present in any frame. Then the page which is least recently used that will swap out. New page will swap in to that empty frame.
  • 6. Q. Suppose there are page requests 2,3,1,2,4,1,6,2,5,4. Assume there are 3 frames in RAM. Show the page replacement by LRU algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 2 3 1 2 4 1 6 2 5 4
  • 7. Q. Suppose there are page requests 2,3,1,2,4,1,6,2,5,4. Assume there are 3 frames in RAM. Show the page replacement by LRU algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 2 3 1 2 4 1 6 2 5 4 2 2 2 2 2 2 6 6 6 4 2 55111111 3 3 3 4 4 4 2 2 No. of Page Hit = 2 No. of Page Fault = 8  Hit Ratio = (No. of Page Hit / Total Pages) = 2/10 = 1/5  Miss Ratio = (No. of Page Fault / Total Pages) = 1 – Hit Ratio = 8/10 = 4/5Page Hit Page Fault
  • 8. OPTIMAL PAGE REPLACEMENT ALGORITHM Suppose, all the page frames are filled with different pages. Now a new page request occurs. This required page is not present in any frame. Then the page which is used most later that will swap out. New page will swap in to that empty frame.
  • 9. Q. Suppose there are page requests 2,1,5,3,4,2,5,1,2,5. Assume there are 3 frames in RAM. Show the page replacement by Optimal page replacement algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 2 1 5 3 4 2 5 1 2 5
  • 10. Q. Suppose there are page requests 2,1,5,3,4,2,5,1,2,5. Assume there are 3 frames in RAM. Show the page replacement by Optimal page replacement algorithm and calculate – number of page hits and page faults, Hit ratio and miss ratio. 2 1 5 3 4 2 5 1 2 5 Page FaultPage Hit 2 2 1 5 2 1 5 2 3 5 4 2 2 4 5 2 4 5 2 1 5 2 1 5 2 1 5 3 is not present. So it will use in far future.4 is not present. So it will use in further future. No. of Page Hit = 4 No. of Page Fault = 6  Hit Ratio = (No. of Page Hit / Total Pages) = 4/10 = 2/5  Miss Ratio = (No. of Page Fault / Total Pages) = 1 – Hit Ratio = 6/10 = 3/5
  • 11. THAT’S ALL FOR THE DAY There is a set of problems from this algorithms are already given. You can download it from the link given below. Link - https://drive.google.com/open?id=10kDzksl- aaPcAESSTB3f30nnxBDhftvL Link is also given in description box. You can mail me the answer sheet on byte2bytelearn@gmail.com
  • 12. HOPE YOU GUYS ENJOY THIS SLIDE. SEE YOU IN THE NEXT VIDEO. STAY HOME, STAY SAFE.