This answer is based on my understanding of what memory is:
Accessing anything from memory/cache has three stages
- Specifying memory location by the processor to memory/cache
- Data transfer from memory/cache to processor.
- Memory/cache sends a signal to the processor that the data transfer is complete.
Time taken for steps 1 and 3 is negligible and we can assume that the memory access time by memory/cache is the same as data transfer time by memory/cache.
Answering Doubt a)
If data is in the cache, these are the following sequence of steps that happen during the data transfer:
- The processor requests the data for a memory address.
- Cache sees that the memory address is stored in it.
- It transfers the data
- And sends a signal that the transfer is complete.
So here, the time taken in steps 1,2, and 4 is negligible and the time taken by step 3 is (Tcache).
If data is not in the cache:
- The processor requests the data for a memory address.
- Cache sees that the data for the specified memory address location is not already stored.
- Now cache sends a request to memory to access the data of the memory address.
- Data transfer happens between memory and cache.
- Memory sends a signal that the transfer is complete
- Now data transfer happens between cache and processor
- Cache sends a signal that the data transfer is complete.
Here time taken in steps 1, 2, 3, 5, and 7 is negligible. and time taken for steps 4 and 6 is (Tmem + Tcache).
Answering Doubt b)
If the cache size is huge then it’s intuitive to think that the required data for a memory address is already stored in it. Therefore the probability of finding data of a memory location is higher when the cache size is doubled. Cache access time has nothing to do with cache size. Cache access time completely depends on the way cache is organized by hardware.
It’s given that Tmem = 20*Tcache.
p = 0.96
p’ = 0.04
Answer a)
(Tmem / (p*Tcache + p’(Tmem+Tcache)))
=(20*Tcache/(0.96*Tcache+0.04*(21*Tcache)))
=(20/(0.96+(0.04*21)))
= 1.111111…. is the speedup factor.
b)
here everything is same as part a) except
p = 0.98
p’ = 0.02
Therefore speedup factor is 14.2857….