Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same column-averaging program as above, now consider T stored in row-major format. How many page faults will be encountered while running the program?
for j = 0 to 1023:
temp = 0
for i = 0 to 16:
temp = temp + T[i][j]
print(temp / 17.0)
temp = 0
for i = 0 to 16:
temp = temp + T[i][j]
print(temp / 17.0)
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. 17,408
Explanation
As shown for the hit-ratio question on this same program, row-major storage makes each of the 17 rows exactly one page, and the inner loop cycles through all 17 of those pages (0..16) using only 16 available frames — the classic LRU worst case where every reference is a fault, with no hits at all. The program makes a total of 17 rows × 1024 columns = 17,408 memory references, and since the hit ratio is 0, every one of them is a page fault. So the number of page faults equals the total number of references, 17,408, option (ii).More Programming Languages and Computer Graphics questions
- Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same colum…
- Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same colum…
- A virtual memory system uses the first-in-first-out (FIFO) page replacement policy and allocates a fixed number of frames to a process. Ass…
- Which of the following statement(s) is/are correct with respect to virtual memory? Statement I: Address translation is performed for every…
- Which of the statement is not true in regards to virtual memory? (i) The main objective for using virtual memory is to increase the effecti…
- For the following page reference string: 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5 — the number of page faults that occur using the Least Recently…