20.8k views
5 votes
A process contains eight virtual pages on disk and is assigned a fixed allocation of four page frames in main memory. The following page trace occurs:

1, 0, 2, 2, 1, 7, 6, 7, 0, 1, 2, 0, 3, 0, 4, 5, 1, 5, 2, 4, 5, 6, 7, 6, 7, 2, 4, 2, 7, 3, 3, 2, 3

a. Show the successive pages residing in the four frames using the LRU replacement policy. Compute the hit ratio in main memory. Assume that the frames are initially empty

1 Answer

6 votes

Final answer:

The LRU (Least Recently Used) page replacement policy is used to track the successive pages residing in the four frames. The hit ratio in main memory can be calculated by dividing the number of hits by the total number of page references.

Step-by-step explanation:

The LRU (Least Recently Used) page replacement policy works by replacing the page that has not been used for the longest period of time. Using this policy, let's track the successive pages residing in the four frames:

  1. 1
  2. 1, 0
  3. 1, 0, 2
  4. 1, 0, 2
  5. 1, 0, 2, 1
  6. 0, 2, 7, 1
  7. 0, 6, 7, 1
  8. 0, 6, 7, 1
  9. 0, 6, 7, 1
  10. 0, 6, 7, 1
  11. 0, 6, 7, 1
  12. 0, 6, 3, 1
  13. 0, 6, 3, 4
  14. 0, 6, 3, 4
  15. 0, 6, 3, 4
  16. 0, 6, 5, 4
  17. 1, 6, 5, 4
  18. 2, 6, 5, 4
  19. 2, 6, 5, 4
  20. 2, 6, 5, 4
  21. 2, 6, 5, 4, 7
  22. 6, 5, 4, 7
  23. 6, 5, 4, 7
  24. 6, 5, 4, 7
  25. 6, 5, 4, 7
  26. 3, 5, 4, 7
  27. 3, 2, 4, 7
  28. 3, 2, 4, 7
  29. 3, 2, 4, 7
  30. 3, 2, 4, 7

The hit ratio in main memory can be calculated by dividing the number of hits (pages found in main memory) by the total number of page references. In this case, there are 18 hits and 32 page references, so the hit ratio is 18/32 = 0.5625 or 56.25%.

User Lea Hayes
by
9.1k points