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

A program computes the row sums C = a of an array A that is 100 words by 100 wor

ID: 3741287 • Letter: A

Question

A program computes the row sums

C = a

of an array A that is 100 words by 100 words. Assume that the computer uses demand paging with a page size of 1000 words, and that the amount of main memory allotted for data is five page frames. Is there any difference in the page fault rate if A were stored in virtual memory by rows or columns? Let’s explore.

Whether you store by rows or columns, it’s the same total amount of memory (in this case). The software environment you use can actually change things, meaning locality is affected by both the reference order and data layout. The same computation can be written in MATLAB or C, for example. MATLAB will store the same column contiguously in memory, but C will store the same row. So for this problem, i is the row number and j is the column number.

a. Does the MATLAB expression cycle through the elements of a row, or of a column?

__________

b. c: _______

Assume you are writing in C, which will store the elements of an array row in contiguous memory. c. Across how many pages is a single row i spread? _______

d. Across how many pages is a column j spread? ______

e. Based on that, how many page loads are required for a row i._______

f. How many total page loads are required by the algorithm? ______

Now assume you write the algorithm in MATLAB, which will allocate memory by columns, storing the elements of an array column in contiguous memory.

g. Across how many pages is a row i spread? _______

h. Across how many pages is a column j spread? ______

i. Based on that, how many page loads are required for a row i._______

j. How many total page loads are required by the algorithm? ______

Explanation / Answer

a) The expression iterates over the row elements, and sums element of a row by adding row elements.

b) rows =100, colums =100 => total words =100*100=10000
Page size=1000, total number of pages required to hold entire array=10000/1000=10

c) row elements stored contiguously, page contain 100 words and row has 100 words,
Thus, single row is acorss one page

d) Considering solution in part (c) it can be concluded that a column spreads across 10 pages  

e) One page load required for arow i.

f) page loads required by the algorithm are 10


# aacording to Chegg policy we can solve maximum 4 subparts of a questions
Please post the remaining questions seperately

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