I am learning about cache and memory hierarchy in computer. Somewhere I saw comparison about FIFO and LRU in caching. I'm curious about the real problems and not only in theory.
So, I would like to ask you, what is the best option for these examples:
The important thing to realize here is that caching policies really do vary case by case. The same policy that works for Netflix's movie streaming service may not be the same for YouTube's.
Having said that, I will try to answer and state my assumptions for each case.
Watching a movie: FIFO caching would be a good choice because the task at hand is a linear event. As you watch a film, you are more likely to rewind say 10s than you are to restart the film entirely. Therefore, using a FIFO caching technique would be useful here.
Monthly accrual of interest to savings accounts of all users of the bank: I would use a LRU policy here because some accounts may be accruing interest more consistently than others. Thus, a FIFO policy would be naive to the fact that while X account does have interest this month, Y account has been accruing interest for the past 10 months.
Running a video game with lots of graphic elements: A LRU caching policy would work best here because the elements may be used more frequently in certain parts of the video game than others.
Searching a specific value in a table: This one really is too broad to say... Really depends on the usage of the table.
Surfing on a website: I would suggest a LRU policy if you are someone who only visits a few sites regularly. However if you are someone who bounces around from site to site, a FIFO policy may be helpful.
Hope this helps!