Dela Cruz Optimal Algorithm
Dela Cruz Optimal Algorithm
Example Scenario:
Consider a sequence of page requests: [7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2].
Assume a memory with a limited capacity (e.g., 3 frames).
Walk through each page request and determine which page should be replaced according
to the optimal page replacement policy.
Analysis Questions:
Why is the optimal page replacement algorithm considered impractical in real systems?
The Optimal Page Replacement algorithm is considered impractical in real systems
because it requires knowing exactly which pages will be accessed in the future, which
isn’t possible in real-time scenarios. In real systems, page access is unpredictable, so
we can’t accurately predict future accesses like the algorithm needs.
How could knowing the access pattern in advance affect system performance?
If we knew access patterns ahead of time, though, it could improve system
performance. The system could load only the pages it needs, reducing page faults and
making memory use more efficient. This would speed up applications by minimizing
delays caused by loading and swapping pages.
Submit:
• The manual trace of the optimal page replacement.
• Results of the program, including the number of page faults.
• Source code for the optimal page replacement program.
7 0 1 2 0 3 0 4 2 3 0 3 2 3
7 7 7 7 - 3 - 3 - - 3 - - -
0 0 0 0 4 0
1 2 2 2 2
Tristan Merline Dela Cruz BSCpE 4-1
Engr. Obamos November 04, 2024
Tristan Merline Dela Cruz BSCpE 4-1
Engr. Obamos November 04, 2024
def main():
print("Optimal Page Replacement Algorithm Simulation")
optimal_page_replacement(page_requests, frame_count)
if __name__ == "__main__":
main()