Memory Management · Operating System
67 questions · asked in 27 of 27 years (2000–2026)
MCQ 43 · MSQ 4 · NAT 201-mark 36 · 2-mark 31
2000Questions per year2026
Questions 6–10 of 67
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):
The *-marked references cause page replacements.
Which one or more of the following could be the page replacement policy/policies in use?
The *-marked references cause page replacements.
Which one or more of the following could be the page replacement policy/policies in use?
One or more options are correct.
Answer: (D)
Read the replacements from the table. Reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2 (positions 1 to 13).
Page 4 (position 4) replaces 2 in {1, 2, 3}. Page 5 (position 5) replaces 3 in {1, 4, 3}. Page 6 (position 8) replaces 1 in {1, 4, 5}. Page 1 (position 11) replaces 4 in {6, 4, 5}. Page 3 (position 12) replaces 5 in {6, 1, 5}. Page 2 (position 13) replaces 6 in {6, 1, 3}.
Optimal evicts the page whose next use is farthest away, or that is never used again.
Position 4: next uses are 1 at 7, 2 at 13, 3 at 12, so 2 goes. Match.
Position 5: next uses are 4 at 6, 1 at 7, 3 at 12, so 3 goes. Match.
Position 8: next uses are 4 at 9, 5 at 10, 1 at 11, so 1 goes. Match.
Positions 11, 12, 13: every page in the frames is never used again, so any choice is optimal, and the evictions 4, 5, 6 are allowed. So the trace is consistent with Optimal.
LRU evicts the page used longest ago. At position 4 the frames hold 1, 2, 3 and page 1 was used earliest, but the trace evicts 2. Not LRU.
LFU evicts the page with the smallest use count. At position 8 the frames hold 1 (used at 1 and 7, count 2), 4 (used at 4 and 6, count 2) and 5 (count 1). LFU evicts 5, but the trace evicts 1. Not LFU.
MFU evicts the page with the largest use count. Counting all uses from the start of the string (counts are not reset when a page is reloaded), at position 12 the frames hold 6 (count 1), 1 (count 3, at positions 1, 7, 11) and 5 (count 2). MFU evicts 1, but the trace evicts 5. Not MFU. (If counts restarted at each reload, 1 would have count 1 and this step would fit, so the whole-history count is what rules MFU out.)
Answer: (D)
Page 4 (position 4) replaces 2 in {1, 2, 3}. Page 5 (position 5) replaces 3 in {1, 4, 3}. Page 6 (position 8) replaces 1 in {1, 4, 5}. Page 1 (position 11) replaces 4 in {6, 4, 5}. Page 3 (position 12) replaces 5 in {6, 1, 5}. Page 2 (position 13) replaces 6 in {6, 1, 3}.
Optimal evicts the page whose next use is farthest away, or that is never used again.
Position 4: next uses are 1 at 7, 2 at 13, 3 at 12, so 2 goes. Match.
Position 5: next uses are 4 at 6, 1 at 7, 3 at 12, so 3 goes. Match.
Position 8: next uses are 4 at 9, 5 at 10, 1 at 11, so 1 goes. Match.
Positions 11, 12, 13: every page in the frames is never used again, so any choice is optimal, and the evictions 4, 5, 6 are allowed. So the trace is consistent with Optimal.
LRU evicts the page used longest ago. At position 4 the frames hold 1, 2, 3 and page 1 was used earliest, but the trace evicts 2. Not LRU.
LFU evicts the page with the smallest use count. At position 8 the frames hold 1 (used at 1 and 7, count 2), 4 (used at 4 and 6, count 2) and 5 (count 1). LFU evicts 5, but the trace evicts 1. Not LFU.
MFU evicts the page with the largest use count. Counting all uses from the start of the string (counts are not reset when a page is reloaded), at position 12 the frames hold 6 (count 1), 1 (count 3, at positions 1, 7, 11) and 5 (count 2). MFU evicts 1, but the trace evicts 5. Not MFU. (If counts restarted at each reload, 1 would have count 1 and this step would fit, so the whole-history count is what rules MFU out.)
Answer: (D)
A computer system supports a logical address space of bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a -bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.
The value of is ___________ . (Answer in integer)
The value of is ___________ . (Answer in integer)
Answer: 11
The page size bytes, so the offset inside a page needs bits. The logical address space bytes, so the other bits make up the page-number part. This part is shared by the outer index ( bits) and the offset in the inner page table.
Each inner page table must fit exactly in one page (the usual assumption for multi-level paging). Each entry takes bytes, so one inner page table holds entries. This means the inner-table offset needs bits.
Now find b:
Answer: 11
Each inner page table must fit exactly in one page (the usual assumption for multi-level paging). Each entry takes bytes, so one inner page table holds entries. This means the inner-table offset needs bits.
Now find b:
Answer: 11
Consider a memory management system that uses a page size of . Assume that both the physical and virtual addresses start from 0. Assume that the pages , and are stored in the page frames , and , respectively. The physical address (in decimal format) corresponding to the virtual address (in decimal format) is ____
Answer: 6596
The page size .
Split the virtual address: this gives page 1 and offset 452.
Page 1 sits in frame 3.
So the physical address
Answer: 6596
Split the virtual address: this gives page 1 and offset 452.
Page 1 sits in frame 3.
So the physical address
Answer: 6596
Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?
One or more options are correct.
Answer: (B), (C), (D)
The MMU is a hardware unit placed between the CPU and the memory. Check each option:
- (A) The OS (software) allocates a page table for a new process when it creates the process. The MMU does not do this. Not its job.
- (B) The MMU translates a virtual address to a physical address by using the page table. True.
- (C) It raises a trap (page fault) when the page table entry is invalid or not present. True.
- (D) It raises a trap when a write is tried on a read-only page. True.
Answer: (B), (C), (D)
- (A) The OS (software) allocates a page table for a new process when it creates the process. The MMU does not do this. Not its job.
- (B) The MMU translates a virtual address to a physical address by using the page table. True.
- (C) It raises a trap (page fault) when the page table entry is invalid or not present. True.
- (D) It raises a trap when a write is tried on a read-only page. True.
Answer: (B), (C), (D)
Consider a 32-bit system with page size and page table entries of size 4 bytes each. Assume bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let denote the minimum and denote the maximum number of pages across the two levels of the page table of the process.
The value of is _____
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let denote the minimum and denote the maximum number of pages across the two levels of the page table of the process.
The value of is _____
Answer: 1028
The page size is so the page number has 20 bits. One page holds entries. So we use 10 bits for the outer level and 10 bits for the inner level. Each inner page-table page covers 1024 pages.
Minimum (X): the 2000 pages lie together inner pages, plus 1 outer page, so the total is 3.
Maximum (Y): each page falls in a different inner table. But the outer level has only 1024 entries so there are 1024 inner pages plus 1 outer page, which gives 1025.
Sum:
Answer: 1028
Minimum (X): the 2000 pages lie together inner pages, plus 1 outer page, so the total is 3.
Maximum (Y): each page falls in a different inner table. But the outer level has only 1024 entries so there are 1024 inner pages plus 1 outer page, which gives 1025.
Sum:
Answer: 1028
Keep practising
Topics in Operating System
System CallProcessThreadProcess SynchronizationDeadlockCPU SchedulingDisk Scheduling
Memory ManagementYou are here
File Systems