SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
Dr.YNM
 
PIC-18 Microcontroller
PIC-18 MicrocontrollerPIC-18 Microcontroller
PIC-18 Microcontroller
ASHISH RANJAN
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
ilakkiya
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
Kamran Ashraf
 

Mais procurados (20)

Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Pipeline hazards in computer Architecture ppt
Pipeline hazards in computer Architecture pptPipeline hazards in computer Architecture ppt
Pipeline hazards in computer Architecture ppt
 
Array Processor
Array ProcessorArray Processor
Array Processor
 
Johnson counter
Johnson counterJohnson counter
Johnson counter
 
Three phase semi converter
Three phase semi converterThree phase semi converter
Three phase semi converter
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processing
 
Ccp
CcpCcp
Ccp
 
Multiprocessor system
Multiprocessor system Multiprocessor system
Multiprocessor system
 
Von Neumann vs Harvard Architecture
Von Neumann vs Harvard ArchitectureVon Neumann vs Harvard Architecture
Von Neumann vs Harvard Architecture
 
8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Automatic power factor correction
Automatic power factor correctionAutomatic power factor correction
Automatic power factor correction
 
The bus interface unit (biu)
The bus interface unit (biu)The bus interface unit (biu)
The bus interface unit (biu)
 
PIC-18 Microcontroller
PIC-18 MicrocontrollerPIC-18 Microcontroller
PIC-18 Microcontroller
 
Page replacement
Page replacementPage replacement
Page replacement
 
Emu8086
Emu8086Emu8086
Emu8086
 
Interrupts
InterruptsInterrupts
Interrupts
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
 
Apfc final seminar
Apfc final seminarApfc final seminar
Apfc final seminar
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
 

Destaque

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
Piyush Rochwani
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise Applications
Debajani Mohanty
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56
myrajendra
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44
myrajendra
 
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.53
myrajendra
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49
myrajendra
 
Operations on a directory 54(3
Operations on a directory 54(3Operations on a directory 54(3
Operations on a directory 54(3
myrajendra
 
38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentation
myrajendra
 
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
myrajendra
 
41 page replacement fifo
41 page replacement fifo41 page replacement fifo
41 page replacement fifo
myrajendra
 
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 allocation
myrajendra
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocation
myrajendra
 

Destaque (20)

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
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
 

Semelhante a 42 lru optimal

Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkVirtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
HKShab
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
myrajendra
 

Semelhante a 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
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
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...
 

Mais de 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