Concept explainers
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[j][i].c=0;
square[j][i].m=0;
square[j][i].y=1;
square[j][i].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[j][i].c=0;
square[j][i].m=0;
square[j][i].y=1;
square[j][i].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[j][i].c=0;
square[j][i].m=0;
square[j][i].y=1;
square[j][i].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 of 32 bits has a cache memory of 64 KB with a cache line size of 64 bytes. The cache access time is 20 ns, and the miss penalty is 120 ns. The cache is 2-way associative. a) What is the number of cache lines? b) What is the number of cache sets? c) What is the number of lines per set? d) Draw a scheme of this cache. e) Calculate the time to read a word in case of miss.arrow_forwardLet's pretend that something unexpected happens: the CPU makes a partially-completed request to the cache at the same time as a block is being returned from the write buffer to main memory. The following steps need to take place.arrow_forward5. A computer of 32 bits has a cache memory of 64 KB with a cache line size of 64 bytes. The cache access time is 20 ns, and the miss penalty is 120 ns. The cache is 2-way associative. a) What is the number of cache lines? b) What is the number of cache sets? c) What is the number of lines per set? d) Draw a scheme of this cache. e) Calculate the time to read a word in case of miss.arrow_forward
- Problem 0. The following table gives some of the parameters for a number of different hardware caches. Fill in the table with the values of the missing parameters. Recall that m is the number of physical address bits, C is the cache size in bytes, B is the block size in bytes, E is the associativity, i.e., lines per set, S is the number of sets, t is the number of tag bits, s is the number of set index bits, and b is the number of block offset bits. Cache m 48 32030 (b) 48 32 24 24 C B E 16384 32 16 32768 64 65536 128 512 32 1024 8 8 4 14 1 4 S b S tarrow_forwardThe memory access time is I nanosecond for read operation with a hit in cache. * nanoseconds for a read operation with a miss in cache, 2 nanoseconds for a write operation with a hit in cache and 10 anoseconds for a write operation with a miss in cache. Execution of a sequence of instructions involves 100 instruction fetch operations, 60 memory operand read operations and 40 memory operand write operations. The cache hit-ratio is 0.9. The average memory access time (in nanoseconds) in executing the sequence of instructions isarrow_forwardExercise 2: A byte addressable memory has a size of 1024 MBytes. This memory is attached to a direct mapping cache of 32KBytes that contains 1024 lines. a. What is the memory address length? b. What is the block size? c. What is the number of blocks in main memory? d. What is the length in bit of: tag (T), line number (L) and byte number (W)? e. Determine in Hexadecimal the tag (T), line number (L) and byte number (W) of the following Hexadecimal memory address: 000008AE f. What is the block that contains the address 000000DE? g. Which line of the cache can hold the block containing 000000DE?arrow_forward
- A 2-way set associative cache consists of four sets. Main memory contains 2K blocks of eight words each. Show the main memory address format that allows us to map addresses from main memory to cache. Be sure to include the fields as well as their sizes. Compute the hit ratio for a program that loops 6 times from locations 8 to 51 in main memory. You may leave the hit ratio in terms of a fraction. Please show details how you obtain the result.arrow_forwardQ1:.arrow_forwardThis function will be able to look at which fields in a log entry that it needs to. When you use 64-byte cache blocks and don't prefetch, the following code calculates the average number of cache misses for each entry in the cache.arrow_forward
- 17. A file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is 1 ms and to read a block from the disk is 10 ms. Assume that the cost of checking whether a block exists in thearrow_forwardP2arrow_forwardThis chapter explains how to implement the four cache replacement policies.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