A virtual memory system has an address space of 8K words, a memory space of 4K words, and page and block sizes of 1K words. The following page reference changes occur during a time interval. (Only page changes are listed. If the same page is referenced again, it is not listed twice).
4 2 0 1 2 6 1 4 0 1 0 2 3 5 7
Determine the four pages that are resident in main memory after each page reference
change if the replacement algorithm used is (i) FIFO (ii) LRU
Answers
Answer:
The correct answer is explained below.
Explanation:
(i) FIFO (First-In-First-Out) Algorithm:
The main memory starts with no data stored in it.
Reference Change Page Reference Pages in Memory
1 - 4 - 4
2 - 2 - 4, 2
3 - 0 - 4, 2, 0
4 - 1 - 4, 2, 0, 1
5 - 2 - 4, 2, 0, 1
6 - 6 - 2, 0, 1, 6
7 - 1 - 0, 1, 6, 2
8 - 4 - 1, 6, 2, 4
9 - 0 - 6, 2, 4, 0
10 - 1 - 2, 4, 0, 1
11 - 0 - 4, 0, 1, 2
12 - 2 - 0, 1, 2, 4
13 - 3 - 1, 2, 4, 3
14 - 5 - 2, 4, 3, 5
15 - 7 - 4, 3, 5, 7
(ii) LRU (Least Recently Used) Algorithm:
The main memory starts with no data stored in it.
Reference Change Page Reference Pages in Memory
- - Empty
1 4 4
2 2 4, 2
3 0 4, 2, 0
4 1 4, 2, 0, 1
5 2 4, 0, 1, 2
6 6 0, 1, 2, 6
7 1 0, 2, 6, 1
8 4 2, 6, 1, 4
9 0 6, 1, 4, 0
10 1 1, 4, 0, 2
11 0 4, 0, 2, 1
12 2 0, 2, 1, 4
13 3 2, 1, 4, 3
14 5 1, 4, 3, 5
15 7 4, 3, 5, 7
When the main memory is full and there is no available space, the LRU algorithm replaces the page that has been used the least recently.
To learn more about FIFO, visit:
https://brainly.in/question/513002
To learn more about LRU, visit:
https://brainly.in/question/6912926
#SPJ1