Sunday, January 30, 2011

Tutorial 1: Cache "cash" Memory


1. What is cache memory?

Cache memory  (also called buffer memory) is a memory that bridges the random-access memory (RAM) and central processing unit (CPU).  Cache memory is quicker than main memory (RAM) and, allows instructions executed and data to be read and written at higher speed.  Basically, cache memory is a small amount of high- speed memory.

Cache Types: 

a. Reading using  cache:
               
    I.  Look Through: Central processing unit (CPU) requests memory from the cache. Only if the data is not present is the main memory queried.

   II.  Look Aside: Central processing unit (CPU) requests memory from cache and main memory simultaneously. If the data is in the cache then it is returned, otherwise the CPU waits for the data from the main memory.

b. Writing using cache:
                 
    I.  Write Through: When data is stored back to memory it is written to the and main memory at the same time.
              
   II. Write Back: Data in the cache is compared to the data in the main memory. Data is written only if there is a difference.

See diagram below:


2. Where is cache memory placed?

Cache is placed between the central processing unit (CPU) and random access memory (RAM).

3. What is the difference between cache memory and main memory (RAM)?

Main memory (RAM) is used to store graphics, pictures, data, programs, etc. Basically, main memory is a general purpose memory.  Cache memory, however, is a specialized memory. Cache memory is used by the CPU to store data temporarily and speed up access to the main memory (RAM).

Why is important cache memory?
Cache memory plays a very important role in computers' performance. A CPU without cache memory would operate at very slow speed receiving instructions directly from them RAM. In other words, CPU productivity would be reduced by (18/ 0.3= 60) times. 

Cache Levels:
  •  Level 1 (L1):  Usually built onto the microprocessor itself . It has two parts: instruction cache and data cache. Instruction cache contains instructions from the RAM that have been decoded, while data cache contains data from the RAM that has been recently used during CPU operations. 
  • Level 2 (L2): Used to be located on the motherboard, but now it resides on a separate chip next to the CPU. L2 is slower  and bigger than L1.
  • Level 3 (L3):  It is slower and bigger than L2.
All these levels of cache mentioned above serve to reduce the latency time when transferring or processing information.  

Note:
Cache that is built into the CPU is faster than separate cache, running at the speed of the microprocessor itself. However, separate cache is still roughly twice as fast as Random Access Memory (RAM).

For more information, please watch video below:



 

http://www.sqa.org.uk/e-learning/CompArch02CD/images/pic009.jpg
factoidz.com/cache-memory/
http://www.build-gaming-computer-guide.com/importance-of-a-cache.html 
http://www.sqa.org.uk/e-learning/CompArch02CD/images/pic009.jpg
http://en.kioskea.net/contents/pc/processeur.php3





No comments:

Post a Comment