A)
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)
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)
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;
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
- A computer uses a set-associative cache with 8-blocks per set. How many bits will be used for the counter to apply the (LRU algorithm)? Explain your answer. The following blocks are referenced by the CPU and to be fetched from the RAM to the cache sequentially: (i j k L L j m j n L m j m L k S j P i O k) Assume that the cache set is empty and all the above blocks can be inserted into the set. Use the LRU algorithm to fill in the following table that describes the status of the cache locations for each called block.arrow_forwardA computer uses a set - associative cache with 8 - blocks per set . 1. How many bits will be used for the counter to apply the ( LRU algorithm ) ? Explain your answer . 2. The following blocks are referenced by the CPU and to be fetched from the RAM to the cache sequentially : ( i j k LL jmjnim jm LkSj Pi o k ) Assume that the cache set is empty and all the above blocks can be inserted into the set . Use the LRU algorithm to fill in the following table that describes the status of the cache locations for each called block .arrow_forwardTake into account the following scenario: we have a byte-addressable computer with 2-way set associative mapping, 16-bit main memory addresses, and 32 blocks of cache memory. Since there are 8 bytes in a block, you can use that information to calculate how big the offset field has to be.arrow_forward
- A byte-addressable system with 16-bit addresses ships with a three-way set associative, write-backcache (i.e., each block needs a dirty bit). The cache implements a true LRU replacement policy usingthe minimum number of replacement policy bits necessary to implement it, which means it requires 3bits per set. The tag store requires a total of 264 bits of storage. What is the block size of the cache?(Hint: 264 = 2^8 + 2^3 and please also do not forget that aside from the tag itself, each block needs 1valid bit, 1 dirty bit).arrow_forward3. The table below represents five lines from a cache that uses fully associative mapping with a block size of 8. Identify the address of the shaded data, 0xE6, first in binary and then in hexadecimal. The tag numbers and word id bits are in binary, but the content of the cache (the data) is in hexadecimal. Word id bits Tag 000 001 010 011 100 101 110 111 ------------------------------------------ 1011010 10 65 BA 0F C4 19 6E C3 1100101 21 76 CB 80 D5 2A 7F B5 0011011 32 87 DC 91 E6 3B F0 A6 1100000 43 98 ED A2 F7 4C E1 97 1111100 54 9A FE B3 08 5D D2 88arrow_forwardIf we have to design a 4 - way set - associative cache of 8 MB size that could work for a main memory of size 4 GB , determine the following : 1. The total number of cache locations 2. The size of tag Consider the cache block size as 4 bytes . Note:- Here he want the number of cache locations And, the size of tag show all the steps.arrow_forward
- Let's pretend for a moment that we had a byte-addressable computer with 2-way set associative mapping, 16-bit main memory addresses, and 32 cache memory blocks at our disposal. Using the information that there are 8 bytes in each block, calculate the size of the offset field and show your results.arrow_forwardA 32-bit computer has a memory of 256 KB and a cache line size of 64 bytes. The memory cache access time is 5ns. This cache is 4-way associative and use LRU as a replacement algorithm. a) What is the number of lines and sets of this memory cache? b) What is the block size transferred between the cache memory and the main memory? c) If the time to transfer a line to cache memory is 200 ns, what is the hit ratio needed to obtain an average access time of 20 ns?arrow_forwardNow, we consider a 16-byte, four-way, fully-associative cache. Since the capacity of the cache is 16 bytes, the array "a" in our example (does/does not) fit inside the cache. We can deduce that the block size for this cache is ( ? ) bytes per block. So the block index size b=2 bits. For a memory trace record such as: L 1fff000116,2 the 2-bit block offset is (0b01/0b10/0b11/0b00). The tag bits are all the rest of the bits not part of the block offset.arrow_forward
- CA_6 We study the properties of cache memory, and for reasons of easier design and efficient circuits, we assume that the cache capacity is 2i Bytes, and cache line size is 2j Bytes, with i and j being natural numbers: (a) How many bits should the tag field have? And can the tag field contain 0 bit (i.e., be empty)? Elaborate (b) Repeat the above for the index field. (c) Repeat the above for the byte-offset field. (d) Finally, depict a figure showing a cache line, indicate what fields it possibly has, state the possible sizes of these fields, and explain the uses of these fields.arrow_forwardA cache memory has a line size of eight 64-bit words and a capacity of 4K words. The main memory size that is cacheable is 1024 Mbits. Assuming 4-way set associative mapping and that the addressing is done at the byte level. What is the format of the main memory addresses (i.e s-d, d, and w)? For the hexadecimal main memory location 2BFACEDH, find the corresponding 4-way set-associative memory formatarrow_forwardDetermine the cache performance of the following code:1 for (i = 0; i < 16; i++){2 for (j = 0; j < 16; j++) {3 total_x += grid[j][i].x;4 total_y += grid[j][i].y;5 }6 }A. What is the total number of reads?B. What is the total number of reads that miss in thecache?C. What is the miss rate?D. What would the miss rate be if the cache were twice asbig?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education