19.9k views
5 votes
Computer with paged virtual memory system references the pages in following order: 3, 4, 6, 10, 3, 5, 3,

5, 4, 5, 3. Main memory can hold four pages at a time. Assume that initially none of the referenced pages is
in the main memory.
List the pages in main memory after each reference when replacement policy for pages is:
A. FIFO (First in – first out: the page that has been in the main memory for the longest time is selected
B. LRU (Least recently used – the page that was referenced longest time ago is selected for
replacement)
How many page replacements (page faults) are required? You can assume that initially main memory does
not contain any of the referenced pages.

User Frank Luke
by
6.7k points

1 Answer

4 votes

Final answer:

When using FIFO and LRU replacement policies for pages in a paged virtual memory system, the pages in the main memory change after each reference. The number of page replacements (page faults) varies depending on the policy used.

Step-by-step explanation:

When using the FIFO (First in, First out) replacement policy for pages in a computer with paged virtual memory, the pages in the main memory are replaced based on the order they entered the memory. In this case, the main memory can hold four pages at a time. After each reference, the pages in the main memory would be as follows:

  1. 3
  2. 3, 4
  3. 3, 4, 6
  4. 3, 4, 6, 10
  5. 4, 6, 10, 3
  6. 6, 10, 3, 5
  7. 10, 3, 5, 3
  8. 3, 5, 3, 5
  9. 3, 4, 5, 5
  10. 4, 5, 3, 5
  11. 5, 3, 5, 3

Using the FIFO policy, there will be 7 page replacements (page faults) in total.

When using the LRU (Least Recently Used) replacement policy, the page that has been referenced the longest time ago is replaced. In this case, the main memory can hold four pages at a time. After each reference, the pages in the main memory would be as follows:

  1. 3
  2. 3, 4
  3. 3, 4, 6
  4. 3, 4, 6, 10
  5. 4, 6, 10, 3
  6. 6, 10, 3, 5
  7. 3, 6, 10, 5
  8. 5, 3, 6, 10
  9. 3, 5, 6, 10
  10. 3, 5, 4, 10
  11. 3, 5, 4, 5

Using the LRU policy, there will be 6 page replacements (page faults) in total.

User Atmo
by
8.4k points