Question

In: Computer Science

Determine for the following code how many pages are transferred between disk and main memory. Assume...

Determine for the following code how many pages are transferred between disk and main memory. Assume each page has 1024 words, the active memory set size is 512 (i. e., at any time no more than 512 pages may be in main memory), and the replacement strategy is LRU (the Least Recently Used page is always replaced); also assume that all 2D arrays are of size (1:2048, 1:2048), with each array element occupying one word, for I := 1 to 2048 do for J :=1 to 2048 do { A[J,I]:=A[J,I]*B[I,J] } provided the arrays are mapped into the main memory space in column-major order,

Solutions

Expert Solution

SOLUTION -

Since the arrays are mapped into the main memory space in coulmn-major order. Hence element A[I, J] , A[I+1,J], A[I+2,J],... are contiguosly located.

Now in array A, once A[I, J] is loaded into a page for the first time, then the elements A[I, J] , A[I+1,J],...,A[I+1023,J] will also be loaded into the main memory space. But since the next element to access after A[I, J] will be A[I, J+1] which is not in the main memory. Hence every access to A[I, J] with 1 <= I <=2048 will cause a page-fault.

Also since there are only 512 pages but there are 2048 possible index of column and row numbers, hence once a page holding element A[I, J] is loaded into the main memory, then it will not persist till the requirement of A[I, J+1] because of being replaced by that time using LRU replacement strategy.

Hence total number of page fault due to array A will be 2048*2048= 222 page faults

Now since array B is accesses column-wise. Hence once element B[I,J] is loaded for first time then B[ I+1023, J] will also be in same page if B[I, J] is starting element in a page.

Hence our of 222 accesses to array B, total number of page faults = 222 / 1024 =212 page faults

Hence, total number of page transfer between disk and main memory =

222 +  212 = 212 * (1024 + 1 ) = 1024 * 212    

IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK YOU!!!!!!!!----------


Related Solutions

The main difference between implicit and explicit memory?
The main difference between implicit and explicit memory?
Suppose that a system uses DMA for data transfer from disk controller to main memory. Further...
Suppose that a system uses DMA for data transfer from disk controller to main memory. Further assume that it takes t1 nsec on average to acquire the bus and t2 nsec to transfer one word over the bus (t1 >> t2). After the CPU has programmed the DMA controller, how long will it take to transfer 1000 words from the disk controller to main memory, if (a) word-at-a-time mode is used? (b) burst mode is used? Assume that commanding the...
-If we assume we place the following MIPS code starting at location 8000 in memory, what...
-If we assume we place the following MIPS code starting at location 8000 in memory, what is the MIPS machine code for this code? Show the machine codes in decimal. Please explain each instruction and specify its type ( R format, I format, or J format). k corresponds to register $s4, j corresponds to register $s1, i corresponds to register $s0, and the base of the array v is in $a0 addi $s1,$s0,-1 label2: slti $t0, $s1, 0 bne $t0,...
1.Note: The following code is written only in main -- you assume there is an array...
1.Note: The following code is written only in main -- you assume there is an array bag and you are not adding any methods to that bag. Write the main program to create two array bags of type string. Place 5 strings of your choice in the first bag and 5 strings (of your choice) in the second bag. Your program must: a) determine if there are any strings in the first bag that appears in the second bag as...
The main objective of the financial statements is to determine how many employees the company can...
The main objective of the financial statements is to determine how many employees the company can afford to hire each year. to provide useful information to investors and creditors to make decisions about a business. to show the profit of a company. to allow customers to determine whether a company will honour its product warranties.
Please show work: How many electrons are transferred in the following redox reaction when it is...
Please show work: How many electrons are transferred in the following redox reaction when it is balanced with the smallest possible integer coefficients? MnO4–(aq) + NH4+(aq) → Mn(OH)2(s) + N2H4(aq) (basic solution) [Note that H2O(l) and OH–(aq) may have to be added where necessary to balance the equation.]
Assume a 64Kx8 Memory is designed using 16Kx1 RAM chips. How many address lines must be...
Assume a 64Kx8 Memory is designed using 16Kx1 RAM chips. How many address lines must be decoded externally to each 16K RAM chip?
For the following reaction, determine the number of electrons transferred. If the reaction is not a...
For the following reaction, determine the number of electrons transferred. If the reaction is not a redox reaction, please enter “0” for your answer. 3CuS(s)+8HNO3​(aq) = 3CuSO4​(aq)+8NO(g)+4H2​O(l)
translation: Genetic code; codon. How many codons are there? How many code for amino acids? What...
translation: Genetic code; codon. How many codons are there? How many code for amino acids? What do the others do? What is the genetic code? tRNA; anticodon; aminoacyl-tRNA synthetase. What key role do aminoacyl-tRNA synthetases play in translation? Why is there more than one? Ribosome structure. What are ribosomes made of? Where are they made? Why are there 3 tRNA binding sites? Translation initiation complex Why wouldn't a transcribed mRNA not be translated immediately? Elongation & translocation in translation. In...
Distinguish between explicit and implicit memory. How is implicit memory research inform the continuing debate in...
Distinguish between explicit and implicit memory. How is implicit memory research inform the continuing debate in psychology regarding the unconscious determinants of behavior? Make explicit reference to behaviors that may have important personal and social consequences in your answer
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT