Skip to content

UGC NET CS 2023System Software and Operating System › Memory ManagementVerified

UGC NET CS 2023 PYQ: Consider the following program fragment that deals with a table $\mathrm{T}$ with 17 rows and 1024 columns,…

Consider the following program fragment that deals with a table $\mathrm{T}$ with 17 rows and 1024 columns, computing an average for each column and printing it to screen ( $\mathrm{i}$ is row index and $\mathrm{j}$ is column index):

for $\mathrm{j}=[0 \ldots . .1023]\{$
temp $=0$
for $\mathrm{i}=[0 \ldots 16]$
temp $=$ temp $+T[i][j]$
print ( temp 17.0) ;}

$\mathrm{T}$ [i] [i] and temp are 32 bit floating point values and memory is word addressable. The temporary variable temp is kept in a processor register so access to temp does not involve a memory reference. The main memory is page and holds 16 pages of size 1024 words, the page replacement policy is "least recently used ", If $\mathrm{T}$ is stored in the virtual address space in row major format.

What is the main memory hit ratio?

  1. A
    0
    Correct answer
  2. B
    1
  3. C
    2
  4. D
    3

Answer

(A) 0

Approach

Count page faults by tracking which page each access to T hits under LRU, given row-major storage and only 16 frames.

Reviewed by UGC IQ Editorial Team.