Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can caches be defeated?

I have this question on my assignment this week, and I don't understand how the caches can be defeated, or how I can show it with an assembly program.. Can someone point me in the right direction?

Show, with assembly program examples, how the two different caches (Associative and Direct Mapping) can be defeated. Explain why this occurs and how it can be fixed. Are the same programs used to defeat the caches the same?

Note: This is homework. Don't just answer the question for me, it won't help me to understand the material.

like image 401
John Avatar asked Jul 10 '11 15:07

John


People also ask

What are caching strategies?

A proper caching strategy includes effective use of both write-through and lazy loading of your data and setting an appropriate expiration for the data to keep it relevant and lean.

How long does a website stay cached?

If a user stops using the browser it is indefinitely. If he/she uses the browser rarely, it will be until the expiration - either by internal policy or by HTTP headers. If he/she uses the browser heavily, it can be 12 minutes or even less.


2 Answers

A cache is there to increase performance. So defeating a cache means finding a pattern of memory accesses that decreases performance (in the presence of the cache) rather than increases it.

Bear in mind that the cache is limited in size (smaller than main memory, for instance) so typically defeating the cache involves filling it up so that it throws away the data you're just about to access, just before you access it.

like image 51
Paul Butcher Avatar answered Oct 17 '22 18:10

Paul Butcher


If you're looking for a hint, think about splitting a data word across 2 cache lines.

(In case you're also looking for the answer, a similar problem was encountered by the x264 developers -- more information available here and here. The links are highly informative, and I really suggest you read them even after you've found your answer.)

like image 36
susmits Avatar answered Oct 17 '22 17:10

susmits