SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Explore the Page
Replacement
Algorithms
Table of Contents
Introduction to the page
replacement algorithms
Why we use Page
replacement Algorithm ?
Working of algorithms
Here, we conclude the topic
Working
Conclusion
Introduction Why Page Repleacement
Introduction
● The page replacement algorithm decides which
memory page is to be replaced.
● The process of replacement is sometimes called
swap out or write to disk.
● Page replacement is done when the requested
page is not found in the main memory (page fault).
● There are two main aspects of virtual memory,
Frame allocation and Page Replacement.
● If the Page Found then it is called as Page Hit.
● If the page not found then it is called Page Fault.
● Page Hit/Page fault=Hit Ratio
Types of Page Replacement Algorithms
There are various page replacement algorithms. Each algorithm has a different method by
which the pages can be replaced.
1. Optimal Page Replacement algorithm → this algorithms replaces the page which will not
be referred for so long in future. Although it can not be practically implementable but it
can be used as a benchmark. Other algorithms are compared to this in terms of
optimality.
2. Least recent used (LRU) page replacement algorithm → this algorithm replaces the page
which has not been referred for a long time. This algorithm is just opposite to the optimal
page replacement algorithm. In this, we look at the past instead of staring at future.
3. FIFO → in this algorithm, a queue is maintained. The page which is assigned the frame
first will be replaced first. In other words, the page which resides at the rare end of the
queue will be replaced on the every page fault.
●
Page replacement algorithms are an important part
of virtual memory management and it helps the OS
to decide which memory page can be moved out,
making space for the currently needed page.
However, the ultimate objective of all page
replacement algorithms is to reduce the number of
page faults.
WORKING
This is the simplest page replacement algorithm. In this algorithm, the operating system keeps
track of all pages in the memory in a queue, the oldest page is in the front of the queue. When
a page needs to be replaced page in the front of the queue is selected for removal.
Example- Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3 page frames .Find the
number of page faults.
FIFO
FIFO example
● Initially, all slots are empty, so when 1, 3, 0 came they are allocated to the empty slots —
> 3 PageFaults.
●
when 3 comes, it is already in memory so —> 0 Page Faults.
●
Then 5 comes, it is not available in memory so it replaces the oldest page slot i.e 1. —>1
Page Fault.
●
6 comes, it is also not available in memory so it replaces the oldest page slot i.e 3 —>1
Page Fault.
●
Finally, when 3 come it is not available so it replaces 0 1 page fault
● In this algorithm, pages are replaced which would not be used for the longest duration of
time in the future.
Example - :Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, with 4 page
frame. Find number of page fault.
Optimal Page Replacement
Optimal Page Replacement example
● Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults
0 is already there so —> 0 Page fault.
●
when 3 came it will take the place of 7 because it is not used for the longest duration of time in the
future.—>1 Page fault.
●
0 is already there so —> 0 Page fault..
●
4 will takes place of 1 —> 1 Page Fault.
● Now for the further page reference string —> 0 Page fault because they are already available in the
memory.
●
Optimal page replacement is perfect, but not possible in practice as the operating system cannot know
future requests. The use of Optimal Page replacement is to set up a benchmark so that other
replacement algorithms can be analyzed against it.
In this algorithm, page will be replaced which is least recently used.
Example - Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2 with 4 page
frames . Find number of page faults.
LRU(Least Recently Used)
LRU example
● Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page
faults
●
0 is already their so —> 0 Page fault.
●
when 3 came it will take the place of 7 because it is least recently used —>1 Page fault
●
0 is already in memory so —> 0 Page fault.
●
4 will takes place of 1 —> 1 Page Fault
●
Now for the further page reference string —> 0 Page fault because they are already
available in the memory.
Conclusion
Pge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdf

More Related Content

PPTX
Distributed and clustered systems
PPT
Page Replacement
PPT
Thrashing allocation frames.43
PPTX
Demand paging
PPTX
Virtual Memory
PPTX
Operating system paging and segmentation
PPTX
Disk Scheduling Algorithm in Operating System
Distributed and clustered systems
Page Replacement
Thrashing allocation frames.43
Demand paging
Virtual Memory
Operating system paging and segmentation
Disk Scheduling Algorithm in Operating System

What's hot (20)

PPTX
contiguous memory allocation.pptx
PDF
8 memory management strategies
PPT
System call
PPTX
Virtual memory management in Operating System
PPTX
Allocating of Frames.pptx
PPTX
Demand paging
PDF
Operating systems system structures
PPT
Virtual memory
PPT
Disk scheduling
PPT
Introduction to System Calls
DOCX
Parallel searching
PPTX
Allocation of Frames & Thrashing
DOCX
Amdahl`s law -Processor performance
PPTX
VIRTUAL MEMORY
PPTX
Microkernel
PPTX
Paging and segmentation
PPT
Multiprocessor Systems
PPTX
Operating system interview question
PPTX
Combined paging and segmentation
PPTX
Kernel. Operating System
contiguous memory allocation.pptx
8 memory management strategies
System call
Virtual memory management in Operating System
Allocating of Frames.pptx
Demand paging
Operating systems system structures
Virtual memory
Disk scheduling
Introduction to System Calls
Parallel searching
Allocation of Frames & Thrashing
Amdahl`s law -Processor performance
VIRTUAL MEMORY
Microkernel
Paging and segmentation
Multiprocessor Systems
Operating system interview question
Combined paging and segmentation
Kernel. Operating System
Ad

Similar to Pge Replacement Algorithm.pdf (20)

PPTX
Page replacement algorithm
PPTX
operating system notes about virtual memory 4.pptx
PPTX
virtual memory Operating system
PPT
PPT
Ch10 OS
 
PDF
final_unit_6_spos_notes_2023/24 pattern.pdf
PPT
Unit 2chapter 2 memory mgmt complete
PDF
PPTX
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
PDF
Adobe Scan 06-Jan-2023.pdf demand paging document
PPT
VM Page Replacement
PPTX
Operating system 38 page replacement
PDF
Virtual Memory Management Part - II.pdf
PPT
PPT
Operating System
PPTX
Page replacement_Architecture ppt (213015018+213015017).pptx
PPTX
page replacement.pptx
PDF
Distributed Operating System_3
Page replacement algorithm
operating system notes about virtual memory 4.pptx
virtual memory Operating system
Ch10 OS
 
final_unit_6_spos_notes_2023/24 pattern.pdf
Unit 2chapter 2 memory mgmt complete
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
Adobe Scan 06-Jan-2023.pdf demand paging document
VM Page Replacement
Operating system 38 page replacement
Virtual Memory Management Part - II.pdf
Operating System
Page replacement_Architecture ppt (213015018+213015017).pptx
page replacement.pptx
Distributed Operating System_3
Ad

Recently uploaded (20)

PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
web development for engineering and engineering
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
Artificial Intelligence
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Sustainable Sites - Green Building Construction
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Safety Seminar civil to be ensured for safe working.
PPT
Project quality management in manufacturing
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
additive manufacturing of ss316l using mig welding
Lecture Notes Electrical Wiring System Components
web development for engineering and engineering
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Construction Project Organization Group 2.pptx
Artificial Intelligence
CH1 Production IntroductoryConcepts.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Sustainable Sites - Green Building Construction
Model Code of Practice - Construction Work - 21102022 .pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
OOP with Java - Java Introduction (Basics)
Safety Seminar civil to be ensured for safe working.
Project quality management in manufacturing
Foundation to blockchain - A guide to Blockchain Tech
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...

Pge Replacement Algorithm.pdf

  • 2. Table of Contents Introduction to the page replacement algorithms Why we use Page replacement Algorithm ? Working of algorithms Here, we conclude the topic Working Conclusion Introduction Why Page Repleacement
  • 3. Introduction ● The page replacement algorithm decides which memory page is to be replaced. ● The process of replacement is sometimes called swap out or write to disk. ● Page replacement is done when the requested page is not found in the main memory (page fault). ● There are two main aspects of virtual memory, Frame allocation and Page Replacement. ● If the Page Found then it is called as Page Hit. ● If the page not found then it is called Page Fault. ● Page Hit/Page fault=Hit Ratio
  • 4. Types of Page Replacement Algorithms There are various page replacement algorithms. Each algorithm has a different method by which the pages can be replaced. 1. Optimal Page Replacement algorithm → this algorithms replaces the page which will not be referred for so long in future. Although it can not be practically implementable but it can be used as a benchmark. Other algorithms are compared to this in terms of optimality. 2. Least recent used (LRU) page replacement algorithm → this algorithm replaces the page which has not been referred for a long time. This algorithm is just opposite to the optimal page replacement algorithm. In this, we look at the past instead of staring at future. 3. FIFO → in this algorithm, a queue is maintained. The page which is assigned the frame first will be replaced first. In other words, the page which resides at the rare end of the queue will be replaced on the every page fault. ●
  • 5. Page replacement algorithms are an important part of virtual memory management and it helps the OS to decide which memory page can be moved out, making space for the currently needed page. However, the ultimate objective of all page replacement algorithms is to reduce the number of page faults.
  • 7. This is the simplest page replacement algorithm. In this algorithm, the operating system keeps track of all pages in the memory in a queue, the oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal. Example- Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3 page frames .Find the number of page faults. FIFO
  • 8. FIFO example ● Initially, all slots are empty, so when 1, 3, 0 came they are allocated to the empty slots — > 3 PageFaults. ● when 3 comes, it is already in memory so —> 0 Page Faults. ● Then 5 comes, it is not available in memory so it replaces the oldest page slot i.e 1. —>1 Page Fault. ● 6 comes, it is also not available in memory so it replaces the oldest page slot i.e 3 —>1 Page Fault. ● Finally, when 3 come it is not available so it replaces 0 1 page fault
  • 9. ● In this algorithm, pages are replaced which would not be used for the longest duration of time in the future. Example - :Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, with 4 page frame. Find number of page fault. Optimal Page Replacement
  • 10. Optimal Page Replacement example ● Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults 0 is already there so —> 0 Page fault. ● when 3 came it will take the place of 7 because it is not used for the longest duration of time in the future.—>1 Page fault. ● 0 is already there so —> 0 Page fault.. ● 4 will takes place of 1 —> 1 Page Fault. ● Now for the further page reference string —> 0 Page fault because they are already available in the memory. ● Optimal page replacement is perfect, but not possible in practice as the operating system cannot know future requests. The use of Optimal Page replacement is to set up a benchmark so that other replacement algorithms can be analyzed against it.
  • 11. In this algorithm, page will be replaced which is least recently used. Example - Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2 with 4 page frames . Find number of page faults. LRU(Least Recently Used)
  • 12. LRU example ● Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults ● 0 is already their so —> 0 Page fault. ● when 3 came it will take the place of 7 because it is least recently used —>1 Page fault ● 0 is already in memory so —> 0 Page fault. ● 4 will takes place of 1 —> 1 Page Fault ● Now for the further page reference string —> 0 Page fault because they are already available in the memory.