Compulsory misses occurs when a block of main memory is trying to occupy fresh empty line of cache.
Conflict misses are those misses which occur due to memory locations being mapped to same cache line.
For example:
Suppose you have a 16 KB cache and you have an array of size 32 KB, which you have to access twice. Now, there is no way, that an array can fit into cache. So there are going to be misses in both accesses. Few accesses will result compulsory misses, which are unavoidable, and would occur even if cache has infinite capacity.
Suppose you have a 16 KB cache and you have an two arrays of size 8KB each which you have to access twice. So, theoretically, both can fit into cache simultaneously. So theoretically, there would not be any misses on second access. But if the cache arrangement is such that both 8KB chucks are mapped to same area of cache, then there would be misses in second access too.
From the question:
- We are given there are 100 compulsory misses happening. So, if we assume cache to be very large, then there are 100 unique elements whose access would result in 100 compulsory misses.
- Fully associative cache means any block of main memory can be placed on any cache line. When we use this cache, we are given that 500 misses occur. Out of these, above 100 are compulsory misses. So, in all 400 conflict misses occur. These must be occurring because, something from the cache is to be removed to accommodate something else from memory.
- 8-way set associate cache means, there are sets of 8 lines in each set. When we use such a cache, we are given that 1000 misses occur. Out of these, above 100 are compulsory misses. So in all, 900 conflict misses occur.