Machine-translated by Google. Questions are authored in English.
Top

Virtual Memory and Page Replacement Questions and Answers

Direction for [ Question No: 1 To 1 ] :

Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right):

initiallyafter
-1*2*3*4*5*416*451*3*2*
-1111111666662
--224444444111
---33555555533

1.

The *-marked references cause page replacements.

Which one or more of the following could be the page replacement policy/policies in use?

Exam Year(s)

GATE CS - 2025,

Answer: D

The policy could only be the Optimal page replacement policy.

Check each replacement against the policies, counting for LFU and MFU every reference made to a page so far:

  • Reference 4 (frames 1, 2, 3): page 2 is replaced. Optimal evicts the page used farthest in the future: 1 is next used at the 7th reference, 3 at the 12th, 2 at the 13th, so 2 goes. LRU would evict 1, the least recently used, so LRU is ruled out.
  • Reference 6 (frames 1, 4, 5): page 1 is replaced. Optimal agrees (next uses: 4 at the 9th, 5 at the 10th, 1 at the 11th). LFU would evict 5, referenced once, against twice for 1 and 4, so LFU is ruled out.
  • Reference 3, the 12th (frames 6, 1, 5): page 5 is replaced. Page 1 has by then been referenced three times, 5 twice and 6 once, so MFU would evict 1, ruling MFU out. Optimal is free to evict 5, since none of the three pages is used again.

The remaining replacements (5 replaces 3, 1 replaces 4, 2 replaces 6) also agree with Optimal, so it is consistent with every step.

Please log in or register to report this question.

2.

Which of the following is a storage allocation scheme in which secondary memory can be addressed as though it were part of the main memory?

Exam Year(s)

DSSSB TGT - 2023,

Answer: A

Virtual memory is the storage allocation scheme in which secondary memory (the disk) can be addressed as if it were part of main memory, so a program can be larger than the physical RAM. Secondary memory is the storage itself and not the scheme, and CPU registers and CPU buffers are small fast storage inside or beside the processor, not a way of addressing the disk as memory. A page of a program that is not in RAM is kept on the disk and brought in when needed, so the program behaves as if it had a much larger memory than is installed.

Please log in or register to report this question.

3.

In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?

Exam Year(s)

GATE CS - 2016,

Answer: D

The algorithm is FIFO (First In First Out).

FIFO can suffer from Belady’s anomaly: for some reference strings, giving a process more frames produces more page faults. The standard example is the string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5, which causes 9 faults with 3 frames but 10 with 4.

LRU and OPT are stack algorithms: the set of pages in memory with \(k\) frames is always a subset of the set with \(k + 1\) frames, so adding frames can never increase the faults. MRU, which evicts the most recently used page, is not the algorithm the anomaly is known for; FIFO is the classic case.

Please log in or register to report this question.

4.

Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is \(M\) units if the corresponding memory page is available in memory, and \(D\) units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is \(X\) units.

Which one of the following is the correct expression for the page fault rate experienced by the process?

Exam Year(s)

GATE CS - 2018,

Answer: B

The page fault rate is \((X - M) / (D - M)\).

If \(p\) is the page fault rate, a fraction \(p\) of accesses take \(D\) units and the rest take \(M\) units, so the measured average is

\[ \begin{aligned} X &= (1 - p)M + pD \\ X - M &= p(D - M) \\ p &= \frac{X - M}{D - M} \end{aligned} \]

Check: if no access faults, \(X = M\) and \(p = 0\); if every access faults, \(X = D\) and \(p = 1\). The option \((D - M)/(X - M)\) is the reciprocal and exceeds 1. \((D - X)/(D - M)\) is the hit rate \(1 - p\), and \((X - M)/(D - X)\) is the ratio of faults to hits.

Please log in or register to report this question.

Loading…
Tags: Virtual Memory and Page Replacement Questions and Answers || Virtual Memory and Page Replacement MCQ Questions and Answers || Virtual Memory and Page Replacement GK Questions and Answers || Virtual Memory and Page Replacement GK MCQ Questions || Virtual Memory and Page Replacement Multiple Choice Questions and Answers || Virtual Memory and Page Replacement GK || GK on Virtual Memory and Page Replacement || Operating Systems Questions and Answers || Operating Systems MCQ Questions and Answers || Operating Systems GK Questions and Answers || GK on Operating Systems