Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ramya Kandasamy CS 147 Section 3

Similar presentations


Presentation on theme: "Ramya Kandasamy CS 147 Section 3"— Presentation transcript:

1 Ramya Kandasamy CS 147 Section 3
Memory Hierarchy Ramya Kandasamy CS 147 Section 3

2 Memory Hierarchy Decreasing Cost, Decreasing Speed, Increasing Size
Registers Level One Cache Level Two Cache Main Memory NUMA Virtual Memory File Storage Network Storage Near-Line Storage Off-Line Storage Hard Copy Increasing Cost, Speed, Decrease Size Decreasing Cost, Decreasing Speed, Increasing Size

3 Levels Continued -The top level CPU registers provide the fastest memory but also is the smallest memory object (with only 8 registers) -As the diagram shows, the more we move down the hierarchy, the slower and larger the memory objects get

4 Purpose of the Hierarchy
Three questions which are asked when creating memory are: How fast How much How expensive The purpose of the hierarchy is to allow fast access to large amounts of memory at a reasonable cost

5 Locality Hierarchal memory makes use of locality to create an organized and efficient structure What is locality? Locality is the phenomenon, that the collection of the data locations referenced in a short period of time in a running computer, often consists of relatively well predictable clusters

6 Types of Locality Temporal locality Spatial locality
Equidistant locality Branch locality

7 Cache Architecture Cache memory is memory that is very fast and is built into the CPU or located next to it on a chip It stores information based on the principles of locality and allows the computer to avoid the bottleneck caused by the system bus How does cache work to efficiently store data?

8 Cache Architecture Continued
Cache can often be organized as a set of cache lines. For example, a cache of 8kb can be organized as 512 lines with 16 bytes each The idea behind cache is to have each line be attached to certain memory region. So for the above example, cache line #0 could correspond to addresses $ $1000F

9 Direct-Map One way that the lines can correspond to addresses is called direct-mapping Direct mapping essentially means that a block of main memory is always loaded into the same cache line in the cache.

10 Fully-Associate Cache
Fully-Associative caches makes it so that the cache lines are not dependent on memory addresses Although this allows for great deal of flexibility, it can be expensive and slow down the memory process

11 Set-Associative Cache
Set Associative Cache is much like a compromise We group together a few cache lines to create a set and a block in memory can map to any one of the lines of a specific set Thus, each block can only map to one set but can be in any of the lines

12 Cache Hit/Miss If an item is found in cache, it is called a hit
If an item is not found, it is called a miss, and the information must be loaded from main memory There are three replacement algorithms we went over in class: -First in, First out -Least Recently Used -Least Frequently Used

13 Virtual Memory Virtual memory is not really physical memory
It is a technique which gives programs the idea that it has working memory even if physically it may overflow to disk storage It makes programming large applications easier and efficiently uses real physical memory

14

15 How does Virtual Memory Work?
Executable program is divided into pages, some of which are loaded into main memory, some loaded into disk area When program runs and requires an instruction not stored in memory, a page fault occurs The operating system then loads the next page from disk onto main memory (least used frames on main memory freed up)

16

17 Example So say you have loaded an operating system, web browser, word processor, and several other applications into RAM (or Random Access Memory) If RAM does not have enough space to hold all these applications (RAM usually has 32 megabytes or 64), virtual memory is put into play It takes the overflow pages and saves it onto disk and then room is made on the RAM

18 Acknowledgments Some of the sites I used for diagrams are:


Download ppt "Ramya Kandasamy CS 147 Section 3"

Similar presentations


Ads by Google