Unformatted text preview:

CS61C Virtual Memory 2nd try Advice on Courses Lecture 19 April 7 1999 Dave Patterson http cs berkeley edu patterson www inst eecs berkeley edu cs61c schedule html cs 61C L19 VM 1 Patterson Spring 99 UCB Review 1 1 2 Approaches to Writes Write Through Write twice current level and next level down Write Back Write only to current level write dirty block to next level down only on miss Reduce Miss Penalty Add a L2 cache Manage memory disk transfers Explain as cache block page miss page fault write back fully associative LRU Included protection as bonus now critical cs 61C L19 VM 2 Patterson Spring 99 UCB Outlin e Sharing Protecting Memory by Swapping Sharing Protecting Memory by Base Bounds Weakness of Base Bounds Protection Administrivia Advice on courses Virtual Memory Paging Problems and solutions of Virtual Memory Conclusion cs 61C L19 VM 3 Patterson Spring 99 UCB Review C memory allocation Address 232 1 sp stack pointer global pointer gp 0 cs 61C L19 VM 4 Stack Space for saved procedure information Heap Explicitly created space e g malloc C pointers Static Variables declared once per program Code Program Patterson Spring 99 UCB Memory Allocation in Reality Address Prior schemes assumed 1 process is running reality is many processes Even a single person using User B Browser Compiler User A Mail For now ignore I O split of address space cs 61C L19 VM 5 User C 0 OS Patterson Spring 99 UCB Sharing Solution 1 earliest Copy other Users processes to Disk when not in use Address User A When time to run a new process swap new user and old user Protection only 1 user at a time so OK but OS not protected Problem slow to swap processes between memory and disk cs 61C L19 VM 6 0 OS Patterson Spring 99 UCB Sharing Solution 2 Base Bounds Address Add Hardware to protect User C users from each other so that must not always swap to disk to share machine bound User B Add special registers Bound Register address must fit inside this value base 0 User A Also called Protection Register Base Register added to each memory address cs 61C L19 VM 7 Also called Relocation Register OS 0 Patterson Spring 99 UCB Base Bounds mapping Function Address Real memory address if Program Address Bound ADDRESS ERROR base bound if Program Address Bound Base Program Address Note cs 61C L19 VM 8 User B base User A Allows safe sharing without always swapping to disk base bound are special registers like epc NOT like 0 31 User C 0 OS Patterson Spring 99 UCB 1 What if need to grow size of Process B If lucky space above process available Address base bound Address User C User B base base bound 0 OS User B base User A cs 61C L19 VM 9 User C User A 0 OS Patterson Spring 99 UCB 2 What if need to grow size of Process B If unlucky must copy to create space Address base bound base cs 61C L19 VM 10 0 Address User C User C User B User B User A User A OS OS base bound User C User B base User A 0 OS Patterson Spring 99 UCB 3 What if need to grow size of Process B If really unlucky must swap to disk Address base bound base cs 61C L19 VM 11 0 Address User C base bound User B User B User A User A OS OS User B base User A 0 OS Patterson Spring 99 UCB Danger of Base Bounds Sharing Scheme Lots of free memory but in small fragments too small to be useful base bound base User C User B User A cs 61C L19 VM 12 0 OS Enough space for User D but discontinuous so cannot use Called Memory Fragmentation Problem Happens when processes quit too Base bounds HW will not solve Patterson Spring 99 UCB Administrivia Project 5 Due 4 14 design and implement a cache in software and plug into instruction simulator Next Readings 5 1 skip logic clocking 5 2 4 5 pages 230 236 4 6 pages 250256 264 4 7 pages 265 273 How many lectures to cover 1 2 9th homework Due 4 14 or 4 16 7PM Exercises 7 35 4 24 Vote on leaving on Wed vs delaying to Friday only when there is a project due on Wed Wed TA office hours Fri spread 61C load cs 61C L19 VM 13 Patterson Spring 99 UCB Administrivia General Course Philosophy Take variety of undergrad courses now to get introduction to areas Can learn advanced material on own later once know vocabulary Who knows what you will work on over a 40 year career cs 61C L19 VM 14 Patterson Spring 99 UCB Administrivia Courses for Telebears General Philosophy Take courses from great teachers HKN ratings 6 very good 5 not good hkn eecs toplevel coursesurveys html Top Faculty Course may teach soon CS 150 logic design CS 152 computer Katz CS 164 compilers CS 169 SW engin Rowe 6 1 S98 Brewer 6 2 S98 CS 174 combinatorics Sinclair Wang CS 186 data bases 6 1 F97 cs 61C L19 VM 15 6 2 F92 Patterson 6 7 S95 6 2 S98 Patterson Spring 99 UCB If many good teachers My recommendations CS169 Software Engineering Everyone writes programs even HW designers Often programs are written in groups learn skill now in school before it counts EE122 Introduction to Communication Networks World is getting connected communications must play major role CS162 Operating Systems All special purpose HW will run a layer of SW that uses processes and concurrent programming CS162 is the closest thing cs 61C L19 VM 16 Patterson Spring 99 UCB If many good teachers Courses to consider E190 Technical Communication Talent in writing and speaking critical for success Now required for EECS majors CS 150 Lab Hardware Design Hands on HW design CS 152 Design a Computer CS 186 Understand databases Information more important now than computation cs 61C L19 VM 17 Patterson Spring 99 UCB Administrivia Courses for Telebears Remember Teacher quality more important to learning experience than official course content Take courses from great teachers cs 61C L19 VM 18 Patterson Spring 99 UCB Inspiration for Solution 3 Provide Hardware to allow discontinuous memory to look continuous to new process base bound base User C User B User A cs 61C L19 VM 19 0 OS Enough space for User D but discontinuous Solution 3 called Virtual Memory or Paging Will specify new HW mapping function Patterson Spring 99 UCB Mapping Virtual Memory to Physical Memory Virtual Memory Divide into equal sized chunks about 4KB Stack Any chunk of Virtual Memory assigned to any chuck of Physical Memory page 64 MB Physical Memory Heap Static 0 cs 61C L19 VM 20 0 Code Patterson Spring 99 UCB Virtual Memory Mapping Function Cannot have simple function to predict arbitrary mapping Use table lookup of mappings Page Number Offset Use table lookup Page Table for mappings Page number is index Virtual Memory Mapping Function Physical Offset Virtual


View Full Document

Berkeley COMPSCI 61C - Lecture 19

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Loading Unlocking...
Login

Join to view Lecture 19 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 19 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?