Home /
Expert Answers /
Computer Science /
please-use-only-c-programming-language-2-determine-for-the-following-code-how-many-pages-are-tr-pa759
(Solved):
Please use only C++ programming Language
2. Determine for the following code how many pages are tr ...
Please use only C++ programming Language
2. Determine for the following code how many pages are transferred between disk and main memory (you must count reads and writes separately!), assuming each page has 1000 words, the active memory set size is 2000 (i. e., at any time no more than 2000 pages may be in main memory), and the replacement strategy is LRU (the Least Recently Used page is always replaced); also assume that all two-dimensional arrays are of size \( (1: 4000,1: 4000) \), with each array element occupying one word, \( \mathrm{N}=4000 \) for I := 1 to 4000 do for \( J:=1 \) to 4000 do \( \{A[I, J]:=A[I, J] \star B[I, J] ; B[I, J]:=C[N-I+1, J] * C[J, I]\} \) provided the arrays are mapped into the main memory space (a) in row-major order, (b) in column-major order.
Answer: The no. of pages needed to store matrix B = 2048*2048/1024 = 4096 pages The no. of pages needed to store matrix A = 2048*2048/1024 = 4096 pages here no. of operations = 2048*2048 [ A[I;J] = A[I,J] *B[J,I] is performed 2048