Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A program makes 1000 fetches of instructions and data. A fetch from the cache takes 2 nanoseconds and a fetch from RAM takes 60 nanoseconds (these times are made up for the question). With a small cache, 900 of the fetches are found in the cache. With a larger cache, 980 are found there.
Find the total fetch time with each cache. Then explain why the larger cache helps.
The clock speed is the number of clock cycles each second, in hertz: is 3 billion cycles each second. In the simple model of this course, time = cycles needed cycles each second. More cores share the work that can be split, but the rest still runs on one core. A larger cache means fewer slow fetches from RAM. An embedded system performs a dedicated function inside a larger device.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. Small cache. 900 fetches take 2 ns each: ns. The other 100 take 60 ns each: ns. The total is ns.
Step 2. Larger cache. 980 fetches take 2 ns each: ns. The other 20 take 60 ns each: ns. The total is ns.
Step 3. Why. The larger cache holds more of the instructions and data the program uses. The CPU finds them in the fast cache more often, so it waits for the slow RAM less often.
Answer: 7800 ns with the small cache and 3160 ns with the larger cache. Fewer slow fetches from RAM makes the larger cache faster.
Log in to join the discussion.
Loading…