SlideShare a Scribd company logo
1 of 21
Storage Management

Page Replacement – LRU, Optimal




                                  1
HOME      PREVIOUS TOPIC NEXT
PREVIOUS QUESTION PAPERS FOR OS
CPP TUTORIALS
Recap

In the last class, you have learnt

•   Concepts of page replacement

•   Page replacement algorithm

•   FIFO


                                     3
Objective


    On completion of this class, you would be able

    to know

•   LRU algorithm

•   Optimal algorithm



                                                 4
Least Recently Used (LRU) Algorithm
•   LRU algorithm chooses that page that has not
    been used for the longest period of time
•   LRU algorithm looks at the pages which are
    already page faulted




                                                   5
LRU Page Replacement
The  LRU algorithm produces 12 page faults for
the reference string
7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1




                                                  6
Least Recently Used (LRU) Algorithm

Advantages

   LRU policy is often used as a page replacement

    algorithm

   It is quite good algorithm

   It is easy to choose that has already page faulted

    and not in use for long period
                                                     7
Least Recently Used (LRU) Algorithm


Disadvantages

   Problem is how to implement LRU replacement

   Require substantial hardware assistance

   Problem in determining the frame order by the

    time of last use

                                                    8
Optimal Algorithm
 Replace page that will not be used for longest
  period of time
 4 frames example
 Reference string : 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
                   1   4
                   2       6 page faults
                   3

                   4   5

How do you know this?
 Used for measuring how well your algorithm
  performs                                            10
Optimal Page Replacement
Reference string : 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0
1701




  The above optimal replacement algorithm
  causes only 9 page faults
                                               11
Optimal Example

12 references, 7
faults




                                     12
Optimal Page Replacement

Advantages

   Has    the lowest page fault rate

   It   never suffers from Belady’s anomaly

   Used    for comparison studies



                                               14
Optimal Page Replacement


Disadvantages

   Difficult   to implement

   It   requires future reference string




                                            15
Summary

    In this class, you have learnt
•   LRU page replacement algorithm
      - advantages and disadvantages
•   Optimal page replacement algorithm
       - advantages and disadvantages




                                         16
Frequently Asked Questions

1. What is meant by Page replacement?

2.Explain the LRU algorithms

3. What are the advantages and disadvantages of LRU?

4. Explain the concept of optimal Page replacement

  algorithm

5. Write the advantages and disadvantages of Optimal page

  replacement algorithm


                                                       17
Quiz
1. LRU algorithm chooses that page that has not been
    used for the ________period of time
    a) Shortest
    b) Longest
    c) Widest
    d) None




                                                       18
Quiz
2. __________has the lowest page fault rate
    a) FIFO
    b) LRU
    c) Optimal
    d) None

3. ___________ requires future reference string
 a) FIFO
 b) LRU
 c) Optimal
 d) None

                                                  19
Quiz
4. __________never suffers from Belady’s anomaly
 a) Optimal replacement
 b) LRU
 c) FIFO
 d) None
5. Algorithm Replace page that will not be used for longest
   period of time
 a) LRU
 b) Optimal replacement
 c) FIFO
 d) None
                                                         20
42 lru optimal

More Related Content

What's hot

Multi-core architectures
Multi-core architecturesMulti-core architectures
Multi-core architecturesnextlib
 
Computer architecture multi core processor
Computer architecture multi core processorComputer architecture multi core processor
Computer architecture multi core processorMazin Alwaaly
 
Multiprocessor
MultiprocessorMultiprocessor
MultiprocessorNeel Patel
 
Memory organisation ppt final presentation
Memory organisation ppt final presentationMemory organisation ppt final presentation
Memory organisation ppt final presentationrockymani
 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniquesDokka Srinivasu
 
Memory Organization
Memory OrganizationMemory Organization
Memory OrganizationAcad
 
Advanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPAdvanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPA B Shinde
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUBNusrat Mary
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43myrajendra
 
Limitations of memory system performance
Limitations of memory system performanceLimitations of memory system performance
Limitations of memory system performanceSyed Zaid Irshad
 
Lecture 6.1
Lecture  6.1Lecture  6.1
Lecture 6.1Mr SMAK
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systemsvampugani
 
Register Organization and Instruction cycle
Register Organization and Instruction cycleRegister Organization and Instruction cycle
Register Organization and Instruction cycleMuhammad Ameer Mohavia
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 

What's hot (20)

Parallel processing
Parallel processingParallel processing
Parallel processing
 
Array Processor
Array ProcessorArray Processor
Array Processor
 
Multi-core architectures
Multi-core architecturesMulti-core architectures
Multi-core architectures
 
Computer architecture multi core processor
Computer architecture multi core processorComputer architecture multi core processor
Computer architecture multi core processor
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
 
Memory organisation ppt final presentation
Memory organisation ppt final presentationMemory organisation ppt final presentation
Memory organisation ppt final presentation
 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniques
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
Chapter 3 principles of hci
Chapter 3 principles of hciChapter 3 principles of hci
Chapter 3 principles of hci
 
Advanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPAdvanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILP
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUB
 
Self organising list
Self organising listSelf organising list
Self organising list
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
Limitations of memory system performance
Limitations of memory system performanceLimitations of memory system performance
Limitations of memory system performance
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Lecture 6.1
Lecture  6.1Lecture  6.1
Lecture 6.1
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Register Organization and Instruction cycle
Register Organization and Instruction cycleRegister Organization and Instruction cycle
Register Organization and Instruction cycle
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 

Viewers also liked

Page replacement
Page replacementPage replacement
Page replacementsashi799
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsDebajani Mohanty
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56myrajendra
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44myrajendra
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement AlgorithmsKashif Dayo
 
File directory definition 54(2)
File directory definition 54(2)File directory definition 54(2)
File directory definition 54(2)myrajendra
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53myrajendra
 
ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileSAP Technology
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49myrajendra
 
Operations on a directory 54(3
Operations on a directory 54(3Operations on a directory 54(3
Operations on a directory 54(3myrajendra
 
38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentationmyrajendra
 
Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58myrajendra
 
41 page replacement fifo
41 page replacement fifo41 page replacement fifo
41 page replacement fifomyrajendra
 
File management53(1)
File management53(1)File management53(1)
File management53(1)myrajendra
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocationmyrajendra
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocationmyrajendra
 

Viewers also liked (20)

Page replacement
Page replacementPage replacement
Page replacement
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Page replacement
Page replacementPage replacement
Page replacement
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise Applications
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement Algorithms
 
File directory definition 54(2)
File directory definition 54(2)File directory definition 54(2)
File directory definition 54(2)
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53
 
ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg File
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49
 
Operations on a directory 54(3
Operations on a directory 54(3Operations on a directory 54(3
Operations on a directory 54(3
 
33
3333
33
 
38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentation
 
Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58
 
41 page replacement fifo
41 page replacement fifo41 page replacement fifo
41 page replacement fifo
 
File management53(1)
File management53(1)File management53(1)
File management53(1)
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocation
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocation
 

Similar to 42 lru optimal

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
 
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 and page replacement algorithm
Virtual memory and page replacement algorithmVirtual memory and page replacement algorithm
Virtual memory and page replacement algorithmMuhammad Mansoor Ul Haq
 
Comparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptxComparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptxSureshD94
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxDivyaKS18
 
Pge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdfPge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdf82NehaPal
 
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkVirtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkHKShab
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system Shaheen kousar
 
page replacement.pptx
page replacement.pptxpage replacement.pptx
page replacement.pptxhomipeh
 
Hybrid Page Replacement Algorithm
Hybrid Page Replacement AlgorithmHybrid Page Replacement Algorithm
Hybrid Page Replacement AlgorithmIJSRED
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacementVaibhav Khanna
 
An input enhancement technique to maximize the performance of page replacemen...
An input enhancement technique to maximize the performance of page replacemen...An input enhancement technique to maximize the performance of page replacemen...
An input enhancement technique to maximize the performance of page replacemen...eSAT Journals
 
Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithmsMazin Alwaaly
 

Similar to 42 lru optimal (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...
 
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)
 
Virtual memory and page replacement algorithm
Virtual memory and page replacement algorithmVirtual memory and page replacement algorithm
Virtual memory and page replacement algorithm
 
Practical 9
Practical 9Practical 9
Practical 9
 
Page replacement alg
Page replacement algPage replacement alg
Page replacement alg
 
page_fault pbm.ppt
page_fault pbm.pptpage_fault pbm.ppt
page_fault pbm.ppt
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Comparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptxComparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptx
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
 
Pge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdfPge Replacement Algorithm.pdf
Pge Replacement Algorithm.pdf
 
Page Replacement
Page ReplacementPage Replacement
Page Replacement
 
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkVirtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system
 
page replacement.pptx
page replacement.pptxpage replacement.pptx
page replacement.pptx
 
Hybrid Page Replacement Algorithm
Hybrid Page Replacement AlgorithmHybrid Page Replacement Algorithm
Hybrid Page Replacement Algorithm
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
An input enhancement technique to maximize the performance of page replacemen...
An input enhancement technique to maximize the performance of page replacemen...An input enhancement technique to maximize the performance of page replacemen...
An input enhancement technique to maximize the performance of page replacemen...
 
Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithms
 

More from myrajendra (20)

Fundamentals
FundamentalsFundamentals
Fundamentals
 
Data type
Data typeData type
Data type
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 

42 lru optimal

  • 2. HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS
  • 3. Recap In the last class, you have learnt • Concepts of page replacement • Page replacement algorithm • FIFO 3
  • 4. Objective On completion of this class, you would be able to know • LRU algorithm • Optimal algorithm 4
  • 5. Least Recently Used (LRU) Algorithm • LRU algorithm chooses that page that has not been used for the longest period of time • LRU algorithm looks at the pages which are already page faulted 5
  • 6. LRU Page Replacement The LRU algorithm produces 12 page faults for the reference string 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 6
  • 7. Least Recently Used (LRU) Algorithm Advantages  LRU policy is often used as a page replacement algorithm  It is quite good algorithm  It is easy to choose that has already page faulted and not in use for long period 7
  • 8. Least Recently Used (LRU) Algorithm Disadvantages  Problem is how to implement LRU replacement  Require substantial hardware assistance  Problem in determining the frame order by the time of last use 8
  • 9.
  • 10. Optimal Algorithm  Replace page that will not be used for longest period of time  4 frames example  Reference string : 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 1 4 2 6 page faults 3 4 5 How do you know this?  Used for measuring how well your algorithm performs 10
  • 11. Optimal Page Replacement Reference string : 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1701 The above optimal replacement algorithm causes only 9 page faults 11
  • 13.
  • 14. Optimal Page Replacement Advantages  Has the lowest page fault rate  It never suffers from Belady’s anomaly  Used for comparison studies 14
  • 15. Optimal Page Replacement Disadvantages  Difficult to implement  It requires future reference string 15
  • 16. Summary In this class, you have learnt • LRU page replacement algorithm - advantages and disadvantages • Optimal page replacement algorithm - advantages and disadvantages 16
  • 17. Frequently Asked Questions 1. What is meant by Page replacement? 2.Explain the LRU algorithms 3. What are the advantages and disadvantages of LRU? 4. Explain the concept of optimal Page replacement algorithm 5. Write the advantages and disadvantages of Optimal page replacement algorithm 17
  • 18. Quiz 1. LRU algorithm chooses that page that has not been used for the ________period of time a) Shortest b) Longest c) Widest d) None 18
  • 19. Quiz 2. __________has the lowest page fault rate a) FIFO b) LRU c) Optimal d) None 3. ___________ requires future reference string a) FIFO b) LRU c) Optimal d) None 19
  • 20. Quiz 4. __________never suffers from Belady’s anomaly a) Optimal replacement b) LRU c) FIFO d) None 5. Algorithm Replace page that will not be used for longest period of time a) LRU b) Optimal replacement c) FIFO d) None 20