SlideShare a Scribd company logo
1 of 24
Overview
1. Why we need page replacement?
2. Basic page replacement technique.
3. Different type of page replacement algorithm and
their examples.
Why????
Limited physical memory --> limited number of
frame --> limited number of frame allocated to a
process.
Basic Page Replacement
1. Find the location of the desired page on the
disk.
2. Find a free frame
 If there is a free frame use it.
 No free frame – use page replacement algorithm to
select a victim frame.
 Write the victim frame to disk, change the frame and
page tables accordingly.
Basic Page Replacement (Contd)
3. Read the desired page into the newly freed frame,
change the page and frame tables.
4. Restart the user process.
Page Replacement
Victim
Swap desire
page in
Reset page
table for new
page
Change to
invaid
Page table
Frame
Valid
invalid bit
2
4
3
0
F
I
V
Swap out
victim page
1
Physical memory
Overhead
If no free frames - 2 page transfers.
Solution : Modify bit or Dirty bit.
Replacement Policy
Which page to be replaced?
Page removed should be the page least likely to be
referenced in the near future.
Most policies predict the future behavior on the basis
of past behavior.
Page faults versus number of frames
Number of frames
Number of page
faults
Replacement Algorithm
1. FIFO page replacement
2. Optimal page replacement
3. LRU page replacement
FIFO Page Replacement
Easy to understand and program.
Performance is not always good.
Belady’s Anomaly
Drawbacks - FIFO
A page which is being accessed quite often may also
get replaced because it arrived earlier than those
present
Ignores locality of reference. A page which was
referenced last may also get replaced, although there
is high probability that the same page may be needed
again.
FIFO – An Example
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7
0
7 7
0
1
2
0
1
2
3
1
2
3
0
4
3
0
4
2
0
4
2
3
0
2
3
0
1
3
0
1
2
7
1
2
7
0
2
7
0
1
Optimal Page Replacement
Lowest page fault rate of all algorithms
Free from Belady’s anomaly
Optimal Page Replacement (contd)
“Replace the page that will not be used for the longest
period of time.”
Requires future knowledge of the reference string.
Used for comparison studies.
OPR – An Example
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7
0
7 7
0
1
2
0
1
2
0
3
2
4
3
2
0
3
7
0
1
2
0
1
LRU Page Replacement
Free from Belady’s Anomaly.
Problem: How to order the frame defined by the time
of last use.
Solution:
 Counters
 Queue
LRU – An Example
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7
0
7 7
0
1
2
0
1
2
0
3
4
3
4
2
3
2
0
3
7
0
1
0
4
2
0
2
3
1
2
0
1
Ans: C
1. Dirty bit is used to show the
a. page with corrupted data
b. the wrong page in the memory
c. page that is modified after being loaded
into cache memory
d. page that is less frequently accessed.
Ans: C
2. What replacement policy is used by Windows NT
a. LRU
b. NFU
c. FIFO
d. Clock Replacement
e. None of the above
Reference String
4. The string of memory references is called
___________.
Belady’s Anomaly
5. FIFO page replacement suffers from
________________anomaly.
Page fault increases with increase in number of
frames.
6. What is Belady’s anomaly??
TRUE
7. Optimal Page Replacement algorithm has the
lowest page fault rate.
TRUE/FALSE

More Related Content

What's hot

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 
42 lru optimal
42 lru optimal42 lru optimal
42 lru optimalmyrajendra
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement AlgorithmsKashif Dayo
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmssangrampatil81
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory ManagementRahul Jamwal
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryrapunzel08
 
Allocation of Frames & Thrashing
Allocation of Frames & ThrashingAllocation of Frames & Thrashing
Allocation of Frames & Thrashingarifmollick8578
 
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
 
basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memoryAdarsh Patel
 
Virtual Memory in Windows
Virtual Memory in Windows Virtual Memory in Windows
Virtual Memory in Windows HanzlaRafique
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Pagingjeyaperumal
 
Translation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page TableTranslation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page TableDarshit Metaliya
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system Shaheen kousar
 

What's hot (20)

Page replacement
Page replacementPage replacement
Page replacement
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
42 lru optimal
42 lru optimal42 lru optimal
42 lru optimal
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement Algorithms
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Virtual memory ,Allocaton of frame & Trashing
Virtual memory  ,Allocaton of frame & TrashingVirtual memory  ,Allocaton of frame & Trashing
Virtual memory ,Allocaton of frame & Trashing
 
Virtual memory
Virtual memory Virtual memory
Virtual memory
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Allocation of Frames & Thrashing
Allocation of Frames & ThrashingAllocation of Frames & Thrashing
Allocation of Frames & Thrashing
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
 
Virtual Memory in Windows
Virtual Memory in Windows Virtual Memory in Windows
Virtual Memory in Windows
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
 
Translation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page TableTranslation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page Table
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
No sql
No sqlNo sql
No sql
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system
 

Similar to Pagereplacement algorithm(computional concept)

Similar to Pagereplacement algorithm(computional concept) (20)

Demand paging
Demand pagingDemand paging
Demand paging
 
OSCh10
OSCh10OSCh10
OSCh10
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
 
Ch09
Ch09Ch09
Ch09
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
Operating System
Operating SystemOperating System
Operating System
 
Distributed Operating System_3
Distributed Operating System_3Distributed Operating System_3
Distributed Operating System_3
 
page replacement.pptx
page replacement.pptxpage replacement.pptx
page replacement.pptx
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
 
Lecture 43
Lecture 43Lecture 43
Lecture 43
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
 
O ssvv82014
O ssvv82014O ssvv82014
O ssvv82014
 
Replacement.ppt operating system in BCA cu
Replacement.ppt operating system in BCA cuReplacement.ppt operating system in BCA cu
Replacement.ppt operating system in BCA cu
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
 
Memory management
Memory managementMemory management
Memory management
 
Galvin-operating System(Ch10)
Galvin-operating System(Ch10)Galvin-operating System(Ch10)
Galvin-operating System(Ch10)
 
4.-CSE-3201_OL1_Paging.pdf
4.-CSE-3201_OL1_Paging.pdf4.-CSE-3201_OL1_Paging.pdf
4.-CSE-3201_OL1_Paging.pdf
 

More from Siddhi Viradiya

network convergence problem and solutions
network convergence  problem and solutionsnetwork convergence  problem and solutions
network convergence problem and solutionsSiddhi Viradiya
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)Siddhi Viradiya
 
chapter 1 intoduction to operating system
chapter 1 intoduction to operating systemchapter 1 intoduction to operating system
chapter 1 intoduction to operating systemSiddhi Viradiya
 
functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with exampleSiddhi Viradiya
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of treeSiddhi Viradiya
 

More from Siddhi Viradiya (7)

network convergence problem and solutions
network convergence  problem and solutionsnetwork convergence  problem and solutions
network convergence problem and solutions
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
 
chapter 1 intoduction to operating system
chapter 1 intoduction to operating systemchapter 1 intoduction to operating system
chapter 1 intoduction to operating system
 
functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with example
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
 
global warming ch-07
 global warming ch-07 global warming ch-07
global warming ch-07
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
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
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
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 Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
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
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
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 Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 

Pagereplacement algorithm(computional concept)

  • 1.
  • 2. Overview 1. Why we need page replacement? 2. Basic page replacement technique. 3. Different type of page replacement algorithm and their examples.
  • 3. Why???? Limited physical memory --> limited number of frame --> limited number of frame allocated to a process.
  • 4. Basic Page Replacement 1. Find the location of the desired page on the disk. 2. Find a free frame  If there is a free frame use it.  No free frame – use page replacement algorithm to select a victim frame.  Write the victim frame to disk, change the frame and page tables accordingly.
  • 5. Basic Page Replacement (Contd) 3. Read the desired page into the newly freed frame, change the page and frame tables. 4. Restart the user process.
  • 6. Page Replacement Victim Swap desire page in Reset page table for new page Change to invaid Page table Frame Valid invalid bit 2 4 3 0 F I V Swap out victim page 1 Physical memory
  • 7. Overhead If no free frames - 2 page transfers. Solution : Modify bit or Dirty bit.
  • 8. Replacement Policy Which page to be replaced? Page removed should be the page least likely to be referenced in the near future. Most policies predict the future behavior on the basis of past behavior.
  • 9. Page faults versus number of frames Number of frames Number of page faults
  • 10. Replacement Algorithm 1. FIFO page replacement 2. Optimal page replacement 3. LRU page replacement
  • 11. FIFO Page Replacement Easy to understand and program. Performance is not always good. Belady’s Anomaly
  • 12. Drawbacks - FIFO A page which is being accessed quite often may also get replaced because it arrived earlier than those present Ignores locality of reference. A page which was referenced last may also get replaced, although there is high probability that the same page may be needed again.
  • 13. FIFO – An Example 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 7 0 7 7 0 1 2 0 1 2 3 1 2 3 0 4 3 0 4 2 0 4 2 3 0 2 3 0 1 3 0 1 2 7 1 2 7 0 2 7 0 1
  • 14. Optimal Page Replacement Lowest page fault rate of all algorithms Free from Belady’s anomaly
  • 15. Optimal Page Replacement (contd) “Replace the page that will not be used for the longest period of time.” Requires future knowledge of the reference string. Used for comparison studies.
  • 16. OPR – An Example 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 7 0 7 7 0 1 2 0 1 2 0 3 2 4 3 2 0 3 7 0 1 2 0 1
  • 17. LRU Page Replacement Free from Belady’s Anomaly. Problem: How to order the frame defined by the time of last use. Solution:  Counters  Queue
  • 18. LRU – An Example 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 7 0 7 7 0 1 2 0 1 2 0 3 4 3 4 2 3 2 0 3 7 0 1 0 4 2 0 2 3 1 2 0 1
  • 19. Ans: C 1. Dirty bit is used to show the a. page with corrupted data b. the wrong page in the memory c. page that is modified after being loaded into cache memory d. page that is less frequently accessed.
  • 20. Ans: C 2. What replacement policy is used by Windows NT a. LRU b. NFU c. FIFO d. Clock Replacement e. None of the above
  • 21. Reference String 4. The string of memory references is called ___________.
  • 22. Belady’s Anomaly 5. FIFO page replacement suffers from ________________anomaly.
  • 23. Page fault increases with increase in number of frames. 6. What is Belady’s anomaly??
  • 24. TRUE 7. Optimal Page Replacement algorithm has the lowest page fault rate. TRUE/FALSE