CS FundamentalsVery hardGATE CS (PYQ pattern)
A 512 x 512 matrix of 4-byte integers is stored row-major, starting at a page boundary, with 4 KB pages (so two rows per page). The code sums it column by column (for j { for i { s += a[i][j]; } }). The data TLB is fully associative with 128 entries and strict LRU, and only the matrix pages compete for it (the TLB starts empty). How many TLB misses occur for the matrix?
- A. 262144
- B. 256
- C. 131072
- D. 65536
Correct answer: C. 131072
A column pass visits rows 0..511 in order, i.e. the 256 pages cyclically, two consecutive accesses per page. With 128 LRU entries each page is evicted before the next pass, so every page costs 1 miss (then 1 hit): 256 x 512 = 131072. A 256-entry TLB would give only 256 misses; 262144 forgets that two rows share a page.
More Operating Systems questions
- With 3 frames, initially empty, the reference string is 4, 2, 1, 5, 2, 1, 3, 2, 4, 3, 1, 3, 2, 2, 5, 4, 5, 1, 3, 2, 4, 4. How many MORE…
- A 32-bit machine uses two-level paging with 4 KB pages, 4-byte entries and 10 + 10 + 12 address bits, so each page-table page maps 4 MB. A…
- Deadlock detection (multiple instances of 3 resource types) with 6 processes. Allocation: P0 (2,0,2), P1 (1,2,1), P2 (1,0,1), P3 (1,0,0)…
- Three processes all arrive at time 0 in the order A, B, C and are scheduled FCFS (non-preemptive on the CPU). Each alternates CPU burst…
- A 3-level feedback queue scheduler uses strict priority between levels. Level 0 has quantum 2 ms, level 1 has quantum 4 ms, level 2 is…
- Two processes i and j (j is the other one) use shared flag[2] (initially false) and turn to guard a critical section. Entry code of four…