44.1k views
0 votes
Consider the following page reference string :

1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
iii) For FIFO page replacement algorithms with 3 frames, the number of page faults is :
a) 16
b) 15
c) 14
d) 11

User Sloan
by
7.4k points

2 Answers

1 vote

Final answer:

To solve this problem, we can use the FIFO (First-In-First-Out) page replacement algorithm with 3 frames. By tracking the page references in the given string, we can determine the number of page faults that occur. In this case, the number of page faults is 15.

Step-by-step explanation:

To solve this problem, we can use the FIFO (First-In-First-Out) page replacement algorithm. This algorithm replaces the page that was first brought into memory when a page fault occurs. We are given a page reference string and need to find the number of page faults for a system with 3 frames.

Let's go step by step:

  • Initially, all frames are empty.
  • We start reading the page reference string from left to right.
  • If the page is not already in a frame, we add it to an available frame. If all frames are full, we replace the page in the oldest frame, as it was the first to be brought into memory.
  • We count the number of page faults, which is the number of times we had to replace a page.

In the given page reference string, using the FIFO page replacement algorithm with 3 frames, we count the following page faults:

  1. 1 → Page fault: 1 is added to an empty frame.
  2. 2 → Page fault: 2 is added to an empty frame.
  3. 3 → Page fault: 3 is added to an empty frame.
  4. 4 → Page fault: 4 is added to an empty frame.
  5. 2 → No page fault: 2 is already in memory.
  6. 1 → No page fault: 1 is already in memory.
  7. 5 → Page fault: 5 replaces the oldest page (1) in memory.
  8. 6 → Page fault: 6 replaces the oldest page (2) in memory.
  9. 2 → Page fault: 2 replaces the oldest page (3) in memory.
  10. 1 → Page fault: 1 replaces the oldest page (4) in memory.
  11. 2 → Page fault: 2 replaces the oldest page (5) in memory.
  12. 3 → Page fault: 3 replaces the oldest page (6) in memory.
  13. 7 → Page fault: 7 replaces the oldest page (2) in memory.
  14. 6 → Page fault: 6 replaces the oldest page (1) in memory.
  15. 3 → Page fault: 3 replaces the oldest page (5) in memory.
  16. 2 → Page fault: 2 replaces the oldest page (7) in memory.
  17. 1 → Page fault: 1 replaces the oldest page (6) in memory.
  18. 2 → Page fault: 2 replaces the oldest page (3) in memory.
  19. 3 → No page fault: 3 is already in memory.
  20. 6 → No page fault: 6 is already in memory.

Therefore, the correct answer is (b) 15 page faults.

User Piedad
by
8.2k points
3 votes

Final answer:

Using the FIFO page replacement algorithm with 3 frames, the number of page faults for the provided reference string is 15. The correct choice from the provided options is (b) 15.

Step-by-step explanation:

To solve this problem, we can use the FIFO (First-In-First-Out) page replacement algorithm. This algorithm replaces the page that was first brought into memory when a page fault occurs. We are given a page reference string and need to find the number of page faults for a system with 3 frames.

Let's go step by step:

Initially, all frames are empty.

We start reading the page reference string from left to right.

If the page is not already in a frame, we add it to an available frame. If all frames are full, we replace the page in the oldest frame, as it was the first to be brought into memory.

We count the number of page faults, which is the number of times we had to replace a page.

In the given page reference string, using the FIFO page replacement algorithm with 3 frames, we count the following page faults:

1 → Page fault: 1 is added to an empty frame.

2 → Page fault: 2 is added to an empty frame.

3 → Page fault: 3 is added to an empty frame.

4 → Page fault: 4 is added to an empty frame.

2 → No page fault: 2 is already in memory.

1 → No page fault: 1 is already in memory.

5 → Page fault: 5 replaces the oldest page (1) in memory.

6 → Page fault: 6 replaces the oldest page (2) in memory.

2 → Page fault: 2 replaces the oldest page (3) in memory.

1 → Page fault: 1 replaces the oldest page (4) in memory.

2 → Page fault: 2 replaces the oldest page (5) in memory.

3 → Page fault: 3 replaces the oldest page (6) in memory.

7 → Page fault: 7 replaces the oldest page (2) in memory.

6 → Page fault: 6 replaces the oldest page (1) in memory.

3 → Page fault: 3 replaces the oldest page (5) in memory.

2 → Page fault: 2 replaces the oldest page (7) in memory.

1 → Page fault: 1 replaces the oldest page (6) in memory.

2 → Page fault: 2 replaces the oldest page (3) in memory.

3 → No page fault: 3 is already in memory.

6 → No page fault: 6 is already in memory.

Therefore, the correct answer is (b) 15 page faults.

User Roman Samoilenko
by
7.0k points