Pergunta de entrevista da empresa Arm

Types of caches and which is better. How does the cache fetch a data from the main memory?

Respostas da entrevista

Sigiloso

3 de jun. de 2020

Response to the first part: The fundamental types of caches are direct-mapped cache, set-associative cache and fully associative cache. The question of "the best" type of cache is dependent on the objective and there are trade-offs: a small direct-mapped cache is the fastest scheme but it also exhibits the highest miss rate and is prone to conflict misses. A set-associative cache alleviates conflict misses, and the miss rate scales down with an increase in the number of sets; however, the higher the number of sets, the larger the latency for retrieving words i.e. high hit time. A fully associative cache has the lowest miss rate but the highest hit time.

Sigiloso

3 de jun. de 2020

How the cache fetches data from main memory: In the event of a read miss or write miss, the cache fetches cache lines from either the next cache level or from main memory using the address of the word. The cache line could be a single word or multiple words depending on the type of cache. A multiword cache line would leverage spatial locality to decrease the miss rate.