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 column-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: D. 17
Explanation
In column-major order, T[i][j] sits at linear address j·17+i, and since the inner loop varies i fastest while j is the slow outer index, the program's references increase by exactly 1 word every step — a single, strictly sequential sweep through all 17×1024 = 17,408 words of the array. That is exactly 17,408 / 1024 = 17 pages, visited once each, strictly in order, with no page ever revisited. Since every page is referenced for the first (and only) time exactly once, the total number of page faults equals the number of distinct pages touched, which is 17, option (iv).More System Software and Operating System 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…
- 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…
- 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…
- Given memory access time as p nanoseconds and an additional q nanoseconds for handling a page fault, what is the effective memory access ti…