Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A matrix of 32-bit integers, x[512][32] (i.e. 512 rows with 32 elements per row)

ID: 3813723 • Letter: A

Question

A matrix of 32-bit integers, x[512][32] (i.e. 512 rows with 32 elements per row) resides at memory address 3EA4000 on a machine with a virtual memory system that employs 8192-byte pages. Assume that the amount of physical memory available to contain pages from the matrix is 32768 bytes, and that an LRU page replacement algorithm is used. Initially, all page map table entries are invalid (i.e., none of the required pages are in memory). Considering only the page faults generated in referencing the matrix (i.e. ignoring those that might result from instruction fetches or the loop indices), indicate how many page faults would occur in executing the C language instruction sequence shown below. Note that in the C language, matrices are stored in row major order (i.e. one row after another). a) for (j = 0; j < 30; j++) { for (k = 0; k < 350; k++) x[k][j] = x[k][j] + 1; } Number of page faults due to accessing the matrix = _____. Explain how you arrived at your answer. b) Suppose that instead of 8192-byte pages, the system employs 4096-byte pages and has a total of eight 4096-byte frames of physical memory. The same LRU page replacement algorithm is used and all page map table entries are initially set to invalid. Considering only the page faults generated in referencing the matrix (i.e. ignoring those that might result from instruction fetches or the loop indices), indicate how many page faults would occur in executing the C language instruction sequence shown below using row major storage order for the matrix. k = 0; while( k < 350 ) { j = 0; while( j < 30) { x[k][j] = x[k][j] + 1; j = j + 2; } k = k + 2; } Number of page faults due to accessing the matrix = _____

Explanation / Answer

import java.io.*;
class LRU   
}
return temp;
}
public static void main(String args[])throws IOException the dimensions of the array”);
int n=Integer.parseInt(br.readLine());
int a[]=new int[n];
int flag[]=new int[n];
System.out.println(“enter the elements”);
for(int i=0;i&lt;n;i++)
int b[]=new int[3];
int c[]=new int[3];
for(int i=0;i&lt;3;i++)
for(int i=0;i&lt;n;i++)
}
if (flag[i]==0 &amp;&amp; b[2]==-1)   
}
}   
if(flag[i]==0)
}
System.out.println(“no of hits”+hit);
System.out.println(“no of faults”+faults);
System.out.println(“hit ratio”+(hit*100)/(hit+faults));
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote