Open In App

Advantages and Disadvantages of various Page Replacement algorithms

Improve
Improve
Like Article
Like
Save
Share
Report

Page Scheduling, involves many different algorithms which have their Advantages and Disadvantages. 

1. First In First Out (FIFO):

  • Advantages –
    1. It is simple and easy to understand & implement.
    2. It is efficiently used for small systems
    3. It does not cause more overheads
    4. Simplicity: FIFO is a simple and easy-to-implement algorithm. It does not require complex data structures or sophisticated calculations.
    5. Fairness: FIFO algorithm is fair in the sense that all pages have an equal chance of being replaced. The oldest page is replaced first, regardless of its usage frequency or importance.
    6. No starvation: The FIFO algorithm does not suffer from starvation, which means that a page will eventually be replaced if it has been in memory for a long time, even if it is frequently used.
    7. Predictability: The FIFO algorithm is predictable in the sense that the order in which pages are replaced is deterministic and does not depend on the page usage patterns or history.
    8. Low overhead: FIFO requires minimal overhead because it only needs to maintain a simple queue of pages in memory, making it a good choice for systems with limited resources.
  • Disadvantages –
    1. The process effectiveness is low.
    2. When we increase the number of frames while using FIFO, we are giving more memory to processes. So, page fault should decrease, but here the page faults are increasing. This problem is called as Belady’s Anomaly.
    3. Every frame needs to be taken account off.
    4. It uses an additional data structure.
    5. Poor performance: FIFO may not provide optimal performance because it does not take into account the usage patterns or importance of the pages. It may result in frequent page faults and unnecessary disk I/O operations, especially if the workload is complex or memory demands are high.
    6. Inefficient use of memory: FIFO can lead to inefficient use of memory because it replaces the oldest page, regardless of its usage frequency or importance. As a result, some pages that are rarely used or not important may occupy memory for a long time, while other more critical pages may be swapped out frequently.
    7. Susceptibility to thrashing: FIFO may be susceptible to thrashing, which occurs when the system spends a significant amount of time swapping pages in and out of memory without making progress on the actual workload. This happens when the number of pages needed by the workload exceeds the available physical memory, and the FIFO algorithm does not efficiently manage the page swapping.
    8. Unfairness: Although FIFO is fair in the sense that it treats all pages equally, it may not be fair from the perspective of the workload or the user. Some pages may be more important than others, and replacing them first can lead to degraded performance or even application crashes.
    9. No consideration of future usage: FIFO does not consider the future usage of pages, which means that it may replace a page that will be needed again soon, leading to increased page faults and decreased performance.

2. Least Recently Used (LRU):

  • Advantages –
    1. It is open for full analysis.
    2. In this, we replace the page which is least recently used, thus free from Belady’s Anomaly.
    3. Easy to choose page which has faulted and hasn’t been used for a long time.
    4. Good performance: LRU is designed to replace the page that has not been accessed for the longest time. It is considered a “smart” algorithm because it takes into account the usage history of pages, and it can lead to fewer page faults and faster application response times.
    5. Efficient use of memory: LRU leads to efficient use of memory because it replaces the page that has not been used for the longest time. This means that pages that are rarely used or not important are more likely to be swapped out, freeing up memory for more critical pages.
    6. No thrashing: LRU is less susceptible to thrashing compared to FIFO because it considers the usage history of pages. It can detect which pages are being used frequently and prioritize them for memory allocation, reducing the number of page faults and disk I/O operations.
    7. Fairness: LRU is considered a fair algorithm because it takes into account the usage history of pages and replaces the least recently used page first. This means that pages that are rarely used or not important are more likely to be swapped out, making room for more frequently used pages.
    8. Good balance between complexity and performance: LRU is more complex than FIFO, but it is still relatively simple and easy to implement compared to other algorithms like optimal page replacement. It strikes a good balance between complexity and performance, making it a popular choice for many operating systems.
  • Disadvantages –
    1. It requires additional Data Structure to be implemented.
    2. Hardware assistance is high.
    3. In LRU error detection is difficult as compared to other algorithms.
    4. It has limited acceptability.
    5. LRU are very costly to operate.

3. Optimal Page Replacement (OPR):

  • Advantages –
    1. Complexity is less and easy to implement.
    2. Assistance needed is low i.e Data Structure used are easy and light.
    3. Optimal performance: The optimal page replacement algorithm is designed to replace the page that will not be used for the longest time in the future. It provides the best possible performance because it minimizes the number of page faults and maximizes the number of hits.
    4. Efficient use of memory: Optimal page replacement leads to efficient use of memory because it replaces the page that will not be used for the longest time in the future. This means that pages that are rarely used or not important are more likely to be swapped out, freeing up memory for more critical pages.
    5. No thrashing: Optimal page replacement is less susceptible to thrashing compared to FIFO or LRU because it considers the future usage of pages. It can detect which pages are being used frequently and which pages are likely to be used in the future, prioritizing them for memory allocation and reducing the number of page faults and disk I/O operations.
    6. Fairness: Optimal page replacement is considered a fair algorithm because it takes into account the future usage of pages and replaces the page that will not be used for the longest time in the future. This means that pages that are rarely used or not important are more likely to be swapped out, making room for more frequently used or critical pages.
    7. Ideal for analysis and simulation: Optimal page replacement is ideal for analysis and simulation because it provides an upper bound on the performance of other page replacement algorithms. It can be used to compare the performance of other algorithms and evaluate their effectiveness.
  • Disadvantages –
    1. OPR is perfect, but not possible in practice as the operating system cannot know future requests.
    2. Error handling is tough.

While FIFO and LRU have their share of advantages and disadvantages, OPR is used as a benchmark to measure the performance of other algorithms. So according to the situation appropriate algorithm is used.


Last Updated : 09 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads