Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following program: -#define Size 64 int A[Size; Size], B[Size; Size], C[Size; Size]; int register i, j; for (j = 0; j < Size;

Consider the following program:

-#define Size 64

int A[Size; Size], B[Size; Size], C[Size; Size];

int register i, j;

for (j = 0; j< Size; j ++)

for (i = 0; i< Size; i++)

C[i; j] = A[i; j] + B[i; j];

Assume that the program is running on a system using demand paging and the page size is 1 Kilobyte. Each integer is 4 bytes long. It is clear that each array requires a 16-page space. As an example, A[0, 0]-A[0, 63], A[1, 0]-A[1, 63], A[2, 0]-A[2, 63], and A[3, 0]-A[3, 63] will be stored in the first data page. A similar storage pattern can be derived for the rest of array A and for arrays B and C. Assume that the system allocates a 4-page working set for this process. One of the pages will be used by the program and three pages can be used for the data. Also, two index registers are assigned for i and j (so, no memory accesses are needed for references to these two variables).

a. Discuss how frequently the page fault would occur (in terms of number of times C[i, j] = A[i, j] + B[i, j] are executed).

b. Can you modify the program to minimize the page fault frequency?

c. What will be the frequency of page faults after your modification?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Baccalaureate Computer Science HL And SL Option A Databases Part I Basic Concepts

Authors: H Sarah Shakibi PhD

1st Edition

1542457084, 978-1542457088

More Books

Students also viewed these Databases questions