Outline Review Pipelining Review Cache VM TLB Review slides CS61C Review of Cache VM TLB Administrivia What s this Stuff Good for 4 Questions on Memory Hierarchy Lecture 26 Detailed Example 3Cs of Caches if time permits April 30 1999 Dave Patterson http cs berkeley edu patterson www inst eecs berkeley edu cs61c schedule html cs 61C L26 cachereview 1 Patterson Spring 99 UCB Review 1 3 Pipelining Introduction Pipelining is a fundamental concept Multiple steps using distinct resources Exploiting parallelism in instructions What makes it easy MIPS vs 80x86 All instructions are the same length simple instruction fetch Just a few instruction formats read registers before decode instruction Memory operands only in loads and stores fewer pipeline stages Data aligned 1 memory access load store cs 61C L26 cachereview 3 Patterson Spring 99 UCB Cache Impact on Algorithms if time permits Conclusion cs 61C L26 cachereview 2 Patterson Spring 99 UCB Review 2 3 Pipelining Introduction What makes it hard Structural hazards suppose we had only one cache Need more HW resources Control hazards need to worry about branch instructions Branch prediction delayed branch Data hazards an instruction depends on a previous instruction need forwarding compiler scheduling cs 61C L26 cachereview 4 Patterson Spring 99 UCB Review 3 3 Advanced Concepts Superscalar Issue Execution Retire Memory Hierarchy Pyramid Start several instructions each clock cycle 1999 3 4 instructions Execute on multiple units in parallel Retire in parallel HW guarantees appearance of simple single instruction execution Out of order Execution Lower Instructions issue in order but execute out oforder when hazards occur load use cache miss multiplier busy Instructions retire in order HW guarantees appearance of simple in order execution cs 61C L26 cachereview 5 Patterson Spring 99 UCB Why Caches Moore s Law Processor Memory Performance Gap grows 50 year DRAM 1 Proc 60 yr DRAM 7 yr 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 Performance CPU 10 1989 first Intel CPU with cache on chip Today 37 area of Alpha 21164 61 StrongArm SA110 64 Pentium Pro cs 61C L26 cachereview 7 Level 3 Level n Size of memory at each level Principle of Locality in time in space Hierarchy of Memories of different speed cost exploit to improve cost performance cs 61C L26 cachereview 6 Patterson Spring 99 UCB Why virtual memory 1 2 1000 100 Central Processor Unit CPU Increasing Upper Distance from CPU Level 1 Levels in Decreasing memory Level 2 cost MB hierarchy Patterson Spring 99 UCB Protection regions of the address space can be read only execute only Flexibility portions of a program can be placed anywhere without relocation Expandability can leave room in virtual address space for objects to grow Storage management allocation deallocation of variable sized blocks is costly and leads to external fragmentation cs 61C L26 cachereview 8 Patterson Spring 99 UCB Why Translation Lookaside Buffer TLB Why virtual memory 2 2 Generality ability to run programs larger than size of physical memory Storage efficiency retain only most important portions of the program in memory Concurrent I O execute other processes while loading dumping page cs 61C L26 cachereview 9 Patterson Spring 99 UCB Paging Virtual Memory Review User A Virtual Memory Stack Physical Memory 64 MB Heap Static 0 Code cs 61C L26 cachereview 11 User B TLB Virtual Memory Stack Heap A Page 0 Table Paging is most popular implementation of virtual memory vs base bounds Every paged virtual memory access must be checked against Entry of Page Table in memory Cache of Page Table Entries makes address translation possible without memory access in common case cs 61C L26 cachereview 10 Patterson Spring 99 UCB Three Advantages of Virtual Memory 1 Translation Program can be given consistent view of memory even though physical memory is scrambled Makes multiple processes reasonable Only the most important part of program Working Set must be in physical memory Contiguous structures like stacks use only as much physical memory as necessary yet still grow later Static B Page Code Table 0 Patterson Spring 99 UCB cs 61C L26 cachereview 12 Patterson Spring 99 UCB Three Advantages of Virtual Memory 2 Protection Different processes protected from each other Different pages can be given special behavior Read Only Invisible to user programs etc Kernel data protected from User programs Very important for protection from malicious programs Far more viruses under Microsoft Windows 3 Sharing Can map same physical page to multiple users Shared memory cs 61C L26 cachereview 13 Patterson Spring 99 UCB Virtual Memory Summary Virtual Memory allows protected sharing of memory between processes with less swapping to disk less fragmentation than always swap or base bound 3 Problems 1 Not enough memory Spatial Locality means small Working Set of pages OK 2 TLB to reduce performance cost of VM 3 Need more compact representation to reduce memory size cost of simple 1 level page table especially for 64 bit address See CS 162 cs 61C L26 cachereview 14 What s This Stuff Potentially Good For Administrivia 11th homework last Due Today Next Readings A 7 M 5 3 Deadline to correct your grade record up to 11th lab 10th homework 5th project W 5 5 Review Interrupts Polling A 7 F 5 7 61C Summary Your Cal heritage HKN Course Evaluation Due Final 61C Survey in lab Sun 5 9 Final Review starting 2PM 1 Pimintel Allow civilians to find mines mass graves plan disaster relief W5 12 Final 5 8PM 1 Pimintel Need Early Final Contact mds cory cs 61C L26 cachereview 15 Patterson Spring 99 UCB Patterson Spring 99 UCB cs 61C L26 cachereview 16 Private Spy in Space to Rival Military s Ikonos 1 spacecraft is just 0 8 tons 15 feet long with its solar panels extended it runs on just 1 200 watts of power a bit more than a toaster It sees objects as small as one meter and covers Earth every 3 days The company plans to sell the imagery for 25 to 300 per square mile via www spaceimaging com We believe it will fundamentally change the approach to many forms of information that we use in business and our private lives N Y Times 4 27 99 Patterson Spring 99 UCB 4 Questions for Memory Hierarchy Q1 Where can a block be placed in the upper level Block placement Q2 How is a block found if it is in the upper level Block identification Q3 Which block should be replaced on a miss Block replacement Q1 Where block placed in upper level
View Full Document
Unlocking...