Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cache Memory By Sean Hunter.

Similar presentations


Presentation on theme: "Cache Memory By Sean Hunter."— Presentation transcript:

1 Cache Memory By Sean Hunter

2 What is Cache? “A computer memory with very short access time used for storage of frequently used instructions or data” – webster.com

3 Types of Cache L1/L2/L3 Cache RAM Cache Disk Cache
Software Level Cache

4

5 L1/L2/L3 Cache (Cache Memory)
Cache closer to the CPU that stores recently accessed data from RAM Holds instructions to be executed next and variables for the CPU

6 L2 Cache COAST: Cache on a Stick

7 Cache Memory Continued
Level 1 Cache is stored on the CPU L2/L3 Cache stored near, but not on the CPU L1/L2/L3 Cache is more expensive than RAM

8

9 Cache Memory Replacement Policies
CPU requests data from cached memory Cache memory has data, sends to CPU (Hit) RAM has data, sends to CPU (Miss) Cache performance measured by hits/misses where the ideal algorithm has a ratio close to 1.

10 Replacement Policies On a miss the data from RAM is loaded in to Cache
Due to the nature of most programs (Variables are accessed multiple times in the same program) this cached data will have a high chance of being accessed often. One possible replacement algorithm is a FIFO based one where the oldest cached data is replaced first.

11 CPU Cache - Write Policies
CPU writes data in cache (hit) Write-through – Cache and RAM updated Write-back – Cache updated, RAM updated when new data is going to replace that data in cache Dirty bit keeps track of if a part of cache has changed

12 CPU Cache - Write Policies
CPU writes but data not in cache (Miss) Write-no-allocate – RAM updated Write-allocate – RAM updated, data loaded into cache

13 CPU Cache – SMP Problems
Multiprocessor systems have trouble with write-through and write-back IE. One processor updates data cached by both processors Possible Solutions: Cache only unshared memory Update all cache simultaneously

14 RAM Cache Same as Cache Memory or CPU Cache, except instead of the L1/L2 cache caching RAM, RAM caches data from the hard disk. For example, Windows loads multiple required libraries for running in memory, but code isn’t executed from them constantly.

15 Disk Cache Like cache memory, disk cache holds data recently read or written to from a hard disk. This is to speed up subsequent reads from recently accessed data. Most newer hard drives have around 8mb of cache memory.

16

17 Software Cache Software also needs to cache data into RAM that it uses often – however, more often than not, this data isn’t directly from the hard disk. The data software caches is often processed data from a file translated by the program into another data structure. The process of translating may take a long time, so the cache in RAM is used to speed up the rest of the programs run time.

18 Software Cache - Example
Games such as Half-Life and Unreal Tournament 2004 have a loading time before each game where the map, models, sounds, and other important data are all loaded into RAM. Example: Website loading lots of data from an SQL server each page load may take a few seconds, but if the first load caches all the data, the load may only take a few milliseconds.

19 Software Cache - Example
Internet Explorer History – Keeps a cache of recently viewed websites for easy access Cache – Keeps images and other files on disk so websites load faster the second time you visit them. These files are updated when there is a newer version of them on the server, or the cache is cleared.

20

21 Interesting Facts The first Celeron CPU had no caching, however it performed almost as fast as the PII with cache. Because some chipsets couldn’t cache more than the first 64mb of RAM a rumor was spread that Windows 98 could only use up to 64mb of RAM, however in reality it supports up to 2GB of RAM. In these chipsets, adding more than 64MB of RAM decreased performance.

22 More interesting facts
Some motherboards ship with fake cache memory (Pictures are of fake cache memory) to both deceive the user and to sell cheaper non-cache motherboards without having to manufacture completely different motherboard designs.

23 References


Download ppt "Cache Memory By Sean Hunter."

Similar presentations


Ads by Google