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, what is the ratio of the number of page faults with T stored in row-major order to the number of page faults with T stored in column-major order?
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: A. 1024 : 1
Explanation
From the two preceding traces, row-major storage produces 17,408 page faults (every reference faults) while column-major storage produces only 17 page faults (one per page, sequential sweep). The ratio is therefore 17,408 : 17, and dividing both sides by 17 gives exactly 1024 : 1. This neat ratio is not a coincidence: it reflects that there are 1024 columns, and in row-major order every single element access faults (17,408 = 1024×17 faults) while in column-major order only 17 faults occur in total — so the ratio collapses to the column count, 1024. Hence option (i) is correct.More Programming Languages and Computer Graphics questions
- 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…
- Given memory access time as p nanoseconds and an additional q nanoseconds for handling a page fault, what is the effective memory access ti…
- Consider a machine with 16 GB of main memory and a 32-bit virtual address space, with page size 4 KB (frame size equals page size). If a pr…