Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Question
Book Icon
Chapter 6, Problem 6.38HW

A)

Program Plan Intro

Given Information:

The given code is:

// define structure

square point_color

{

// variable declaration

int c;

int m;

int y;

int k;

};

// declare structure array

struct point_color square[16][16];

int i,j;

// traverse through the array

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

{

//traverse through elements

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

{

//square all elements of the 2-D array

square[i][j].c=0;

square[i][j].m=0;

square[i][j].y=1;

square[i][j].k=0;

}

}

Write hit:

If the information in the cache is reserved or in dirty state then the cache line is updated in its place without updating memory set from its state to dirty.

  • If the state of information is in valid state then it executes a write-through operation.
  • It then updates the memory and block and changes its blocked state to reserved state.

Write miss:

A partial cache line write is handed as a read miss followed by a write hit. All the other caches are left in the invalid state and the reserved state is occupied by the current state.

B)

Program Plan Intro

Given Information:

The given code is:

// define structure

square point_color

{

// variable declaration

int c;

int m;

int y;

int k;

};

// declare structure array

struct point_color square[16][16];

int i,j;

// traverse through the array

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

{

//traverse through elements

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

{

//square all elements of the 2-D array

square[i][j].c=0;

square[i][j].m=0;

square[i][j].y=1;

square[i][j].k=0;

}

}

Write hit:

If the information in the cache is reserved or in dirty state then the cache line is updated in its place without updating memory set from its state to dirty.

  • If the state of information is in valid state then it executes a write-through operation.
  • It then updates the memory and block and changes its blocked state to reserved state.

Write miss:

A partial cache line write is handed as a read miss followed by a write hit. All the other caches are left in the invalid state and the reserved state is occupied by the current state.

C)

Program Plan Intro

Given Information:

The given code is:

//define structure

square point_color

{

// variable declaration

int c;

int m;

int y;

int k;

};

// declare structure array

struct point_color square[16][16];

int i,j;

// traverse through the array

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

{

//traverse through elements

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

{

//square all elements of the 2-D array

square[i][j].c=0;

square[i][j].m=0;

square[i][j].y=1;

square[i][j].k=0;

}

}

Blurred answer
Students have asked these similar questions
3M decides to make Post-its by printing yellow squares on whitepieces of paper. As part of the printing process, they need to set theCMYK (cyan, magenta, yellow, black) value for every point in thesquare. 3M hires you to determine the efficiency of the followingalgorithms on a machine with a 2,048-byte direct-mapped data cachewith 32-byte blocks. You are given the following definitions:1 struct point_color {2 int c;3 int m;4 int y;5 int k;6 };78 struct point_color square[16][16];9 int i, j;Assume the following:sizeof(int) = 4.square begins at memory address 0.The cache is initially empty.The only memory accesses are to the entries of the array square.Variables i and j are stored in registers.Determine the cache performance of the following code:1 for (i = 0; i < 16; i++){2 for (j = 0; j < 16; j++) {3 square[i][j].c = 0;4 square[i][j].m = 0;5 square[i][j].y = 1;6 square[i][j].k = 0;7 }8 }A. What is the total number of writes?B. What is the total number of writes that miss in the…
3M decides to make Post-its by printing yellow squares on whitepieces of paper. As part of the printing process, they need to set theCMYK (cyan, magenta, yellow, black) value for every point in thesquare. 3M hires you to determine the efficiency of the followingalgorithms on a machine with a 2,048-byte direct-mapped data cachewith 32-byte blocks. You are given the following definitions:1 struct point_color {2 int c;3 int m;4 int y;5 int k;6 };78 struct point_color square[16][16];9 int i, j;Assume the following:sizeof(int) = 4.square begins at memory address 0.The cache is initially empty.The only memory accesses are to the entries of the array square.Variables i and j are stored in registers.Determine the cache performance of the following code:1 for (i = 0; i < 16; i++){2 for (j = 0; j < 16; j++) {3 square[i][j].c = 0;4 square[i][j].m = 0;5 square[i][j].y = 1;6 square[i][j].k = 0;7 }8 }A. What is the total number of writes?B. What is the total number of writes that miss in the…
We have a fully associative cache memory with 216entries). Each entry is hosting 32 data. How manybits are necessary for the TAG for a 28 bits address?5 A12 B23 C    None of previous answers D , also is there a difference if it was fully associative mapping cache memory or no?  solve this question in great detail explaining every single bit of info as i'm a complete beginner and i need to understand how to solve questions of this type. also provide small examples of how the solution would differ if the question was slightly altered.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education