We have a 1024 byte cache that is direct mapped. Each line of the cache stores a 64-byte block. We have the following structure definition:
We have a 1024 byte cache that is direct mapped. Each line of the cache stores a 64-byte block. We have the following structure definition: struct object { int a; /* uses 4 bytes of memory */ int b; /* uses 4 bytes of memory */ double c; /* uses 8 bytes of memory */ }; (a) For this code block struct object data[192]; /* starts at memory address 0 */ int sumA = 0, sumB = 0, i; /* these are stored in registers */ double sumC = 0; /* this is stored in a register */ for(i = 0; i < 192; i++) sumA += data[i].a; for(i = 0; i < 192; i++) sumB += data[i].b; for(i = 0; i < 192; i++) sumC += data[i].c; i. Determine the number of times that the cache is read. ii. What is the cache miss rate?
(b) For this code block struct object data[192]; /* starts at memory address 0 */ int sumA = 0, sumB = 0, i; /* these are stored in registers */ double sumC = 0; /* this is stored in a register */ for(i = 0; i < 192; i++) { sumA += data[i].a; sumB += data[i].b; sumC += data[i].c; } i. Determine the number of times that the cache is read. ii. What is the cache miss rate?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started