Thursday 12 December 2013

Memory Organization : Cache Memory

What do we want in a memory ?
  • We’d like to have a memory system that performs like 2-10 GB of fast SRAM typical SRAM sizes are in MB, not GB .
  • Costs like 1-4 GB of DRAM (slower) typical DRAMs are order of magnitude slower than SRAM 
Hint : Use a hierarchy of memory technologies



Cache Analogy :)

Consider the following analogy of caching. You are planning to write a very long paper on the history of mythology of many different cultures. You start with ancient Babylonian myths, and work your way to Greek, Roman, Norse, Native American, Asian, etc. myths. You've divided your paper so that each chapter covers one culture's mythology. Thus, at any one time, you are studying one mythology.

You have a computer on your desk, and get your books online. You can download only so many books because your computer is limited in memory. The advantage of downloading the books onto your own computer is so that you can access the material quickly. Downloading the books is quite slow, so you hope not to do it very often.

If it weren't for the fact that you collect related books and write on those books for each chapter (say, 10 books on Greek mythology, then 10 books on Norse mythology), you might be forever downloading books. Even though the majority of books remain at the central library site, the books you need are on your computer, which is quick to access.

What happens if you have already downloaded 10 books (assuming they all take the same amount of space), and you want an 11th book? You will need to delete one of your books off your computer, to make room for the next book.

Which one should you pick? You could pick the one that you haven't read in the longest time. That policy is called "least recently used". Or you could see which book you've had on your computer the longest time. That policy is called "first in first out". Or perhaps the one you've looked at least. That's called "least frequently used".

In any case, you use some policy to decide which book to get rid of to make space for the new books.



Directed Mapped Cache :) 

Location determined by address . Direct mapped is only one choice.

     1. How do we know which particular block is stored in a cache             location? 
  •  Store block address as well as the data 
  • Actually, only need the high-order bits ◦ Called the tag 
    2. What if there is no data in a location?
  •   Valid bit: 1 = present, 0 = not present . Initially 0

Example of Cache :)

8-blocks, 1 word/block, direct mapped
(Initial state)




Measuring Cache Performance :)



-Emran Bin Rahmad-
B031310405



No comments:

Post a Comment