Memory HierarchyMemory HierarchyLevels ContinuedPurpose of the HierarchyLocalityTypes of LocalityCache ArchitectureCache Architecture ContinuedDirect-MapFully-Associate CacheSet-Associative CacheCache Hit/MissVirtual MemorySlide 14How does Virtual Memory Work?Slide 16ExampleAcknowledgmentsMemory HierarchyRamya KandasamyCS 147Section 3Memory HierarchyRegistersLevel One CacheLevel Two CacheMain MemoryNUMAVirtual MemoryFile StorageNetwork StorageNear-Line StorageOff-Line StorageHard CopyIncreasing Cost,IncreasingSpeed,Decrease SizeDecreasing Cost,Decreasing Speed,Increasing SizeLevels 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 getPurpose of the HierarchyThree questions which are asked when creating memory are:How fastHow muchHow expensive•The purpose of the hierarchy is to allow fast access to large amounts of memory at a reasonable costLocalityHierarchal memory makes use of locality to create an organized and efficient structureWhat 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 clustersTypes of LocalityTemporal localitySpatial localityEquidistant localityBranch localityCache ArchitectureCache memory is memory that is very fast and is built into the CPU or located next to it on a chipIt stores information based on the principles of locality and allows the computer to avoid the bottleneck caused by the system busHow does cache work to efficiently store data?Cache Architecture ContinuedCache 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 eachThe 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 $10000..$1000FDirect-MapOne way that the lines can correspond to addresses is called direct-mappingDirect mapping essentially means that a block of main memory is always loaded into the same cache line in the cache.Fully-Associate CacheFully-Associative caches makes it so that the cache lines are not dependent on memory addressesAlthough this allows for great deal of flexibility, it can be expensive and slow down the memory processSet-Associative CacheSet Associative Cache is much like a compromiseWe 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 setThus, each block can only map to one set but can be in any of the linesCache Hit/MissIf an item is found in cache, it is called a hitIf an item is not found, it is called a miss, and the information must be loaded from main memoryThere are three replacement algorithms we went over in class:-First in, First out -Least Recently Used-Least Frequently UsedVirtual MemoryVirtual memory is not really physical memoryIt is a technique which gives programs the idea that it has working memory even if physically it may overflow to disk storageIt makes programming large applications easier and efficiently uses real physical memoryHow does Virtual Memory Work?Executable program is divided into pages, some of which are loaded into main memory, some loaded into disk areaWhen program runs and requires an instruction not stored in memory, a page fault occursThe operating system then loads the next page from disk onto main memory (least used frames on main memory freed up)ExampleSo 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 playIt takes the overflow pages and saves it onto disk and then room is made on the RAMAcknowledgmentsSome of the sites I used for diagrams
View Full Document