Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1091781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:35:01+00:00 2026-05-16T23:35:01+00:00

Homework: Consider the two-dimensional array A: int A[][] = new int[200][200]; where A[0][0] is

  • 0

Homework:

Consider the two-dimensional array A:

      int A[][] = new int[200][200];

where A[0][0] is at location 500 in a paged memory system with pages of size 500 (a little unrealistic — not 512). A small process that manipulates the matrix resides in page 0 (locations 0 to 499). Thus, every instruction fetch will be from an instruction currently stored in page 0.

Assuming there are only five page frames, including page 0, how many page faults are generated by the following array-initialization loops, using LRU replacement and assuming that page frame 0 contains the process and the other four are initially empty?

A)for (int j = 0; j < 200; j++)
for (int i = 0; i < 200; i++)
A[i][j] = 0;

B)for (int i = 0; i < 200; i++)
for (int j = 0; j < 200; j++)
A[i][j] = 0;

Question:

Where do I begin to figure this out? I have went through my text but haven’t found much of it to be useful. I threw some numbers around and I found:

40,000 = total number of array items

80 (40k/500) = total number of pages

A) 20,000 (80*250) because every other loop causes a page fault?

B) 80 (One for each page, 40,000/500 = 80)?

Am I on the right track? Any advice? Hints?

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:35:02+00:00Added an answer on May 16, 2026 at 11:35 pm

    Think about the order that the initialization happens in loop A vs loop B, and how a multi-dimentional array is laid out in memory. One of them will access memory addresses in-order, the other will jump around. After 200 assignments, you’ll be looking at A[199][0] in one case, and A[0][199] in the other. How many pages have you touched?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Homework. Dice Game. I've got an array that represents five rolls of a die.
I have a homework that include a new operation (a [n] b), given: a
Not homework. Given two strings S and T of same length. Given a set
I'm working on my compiler homework and I have the following question: Consider the
For homework I need to use IPC. I write some code for shared memory
If we consider two registers ax and bx, how do we swap their contents
I have the following homework question: Consider the following declarations and answer the question.
My homework has a problem for example there is a category array $cat=array('1','4','5','7'); now
my homework assignment was to: write a function called findPattern() which accepts two strings
Consider that I have the two following nested classes: public class Foo { public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.