Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following two-dimensional array: int X[64][64]; Suppose that a system has 10 page frames and each frame is 256 words large (an integer occupies

Consider the following two-dimensional array: int X[64][64];

Suppose that a system has 10 page frames and each frame is 256 words large (an integer occupies one word). Programs that manipulate the X array fit into exactly one page and always occupy page 0. The data are swapped in and out of the other three frames. The X array is stored in row-major order (i.e., X[0][1] follows X[0][0] in memory). Which of the two code fragments shown below will generate the lowest number of page faults? Explain and compute the total number of page faults for each code fragment. (Assume that the program instructions are not included in these calculations)

Fragment A

for (int j = 0; j < 64; j++)

for (int i = 0; i < 64; i++)

X[i][j] = 0;

Fragment B

for (int i = 0; i < 64; i++)

for (int j = 0; j < 64; j++)

 X[i][j] = 0;

Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

Step: 1

Given that the X array is stored in a rowmajor order the fragment B will generate lowest number ... 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_2

Step: 3

blur-text-image_3

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

Modern Operating Systems

Authors: Andrew S. Tanenbaum, Herbert Bos

4th edition

013359162X, 978-0133591620

More Books

Students also viewed these Operating System questions

Question

Discuss Machiavellis importance to the history of psychology.

Answered: 1 week ago

Question

Define server and explain 3 types of servers

Answered: 1 week ago