Q164: Page faults using FIFO page replacement policy

This is in continuation with Q79.

Using FIFO page replacement policy, assume that the page request follows the following order:

3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4

Question 164: If there are total 4 page frames in the system, how many page faults will be there?

Options:

  1. 0
  2. 6
  3. 9
  4. 10

Solution:  Following will be the sequence of pages in memory, pages in red will be the ones which will be replaced.

Newest Page 3 2 1 0 0 0 4 3 2 1 0 4
  3 2 1 1 1 0 4 3 2 1 0
  3 2 2 2 1 0 4 3 2 1
Oldest Page 3 3 3 2 1 0 4 3 2

Hence, the correct answer is the last option. This is an example of Belady’s anomaly, that is, increasing number of page frames results in increase in the number of page faults.

Q102: Why do we need access control bits in page table entries?

Question #102: Why do we need access control bits in page table entries?

  1. Because the pages might be shared.
  2. Some pages might contain executable code, which is read-only.
  3. Some pages contain data, so there shouldn’t be any instructions that should execute from that memory space.

Options:

A. All of the options 1, 2 and 3 are correct.

B. Only option 1 is correct.

C. Only options 2 and 3 are correct.

D. Only options 1 and 2 are correct.

Solution: The correct answer is C. Executable code should only be read-only and any attempt to write on that space should be trapped. Similarly any data should be read or written, but any attempt to execute from that address space should be trapped!

Q79: Page faults using FIFO page replacement policy

Using FIFO page replacement policy, assume that the page request follows the following order:

3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4

Question 79: If there are total 3 page frames in the system, how many page faults will be there?

  1. 0
  2. 6
  3. 9
  4. 10

Solution: Following will be the sequence of pages in memory, pages in red will be the ones which will be replaced.

Newest Page 3 2 1 0 3 2 4 4 4 1 0 0
  3 2 1 0 3 2 2 2 4 1 1
Oldest Page 3 2 1 0 3 3 3 2 4 4

Hence, the correct answer is option 3.

Q73: Shared pages between two processes

Question 73: Consider the following situation where process X and Y’s page table is shown. VPFN refers to virtual page frame number in virtual memory address space and PFN refers to page frame number in physical memory.

page_table\

Which of the following statement is true?

  1. Physical page frame number 4 is shared between virtual PFN 1 of Process Y and virtual PFN 3 of Process X.
  2. Physical page frame number 0 is shared between virtual PFN 2 of Process Y and virtual PFN 3 of Process X.
  3. Physical page frame number 4 is shared between virtual PFN 1 of Process X and virtual PFN 3 of Process Y.
  4. No physical page is shared.

Solution: Page table of Process X maps its VPFN 3 to PFN 4, and page table of Process Y maps its VPFN 1 of Process Y to PFN 4. The correct answer is option 1.

Q11: Access pattern in memory

Question #11: Consider the hypothetical scenario where there are 4 pages in physical memory and 3 processes are running simultaneously on 3 different processors. Following is the access pattern which repeats over and over again.
Access pattern of P1: {a, b, b, c, b}, {a, b, b, c, b}, …
Access pattern of P2: {p, q, q, q, p}, {p, q, q, q, p}, …
Access pattern of P3: {x, x, x, y, z}, {x, x, x, y, z}, …
Which of the following is a sensible choice of 3 pages which could always remain in memory?

 

Options:

  1. b, q, x

  2. a, b, x

  3. b, p, x

  4. Can’t say

 

Solution:

Process P1 accesses ‘b’ the most, P2 accesses ‘q’ the most, and P3 accesses ‘x’ the maximum times. So if these 3 pages are present always and the remaining pages in memory can be used for other accesses. Hence, the correct answer is option 1.