DOC PREVIEW
Berkeley COMPSCI 61C - Lecture 19

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS61C Virtual Memory, 2nd try + Advice on Courses Lecture 19Review 1/1OutlineReview: C memory allocationMemory Allocation in Reality“Sharing” Solution #1 (earliest)“Sharing” Solution #2: Base/BoundsBase/Bounds mapping Function1: What if need to grow size of Process B?2: What if need to grow size of Process B?3: What if need to grow size of Process B?Danger of Base/Bounds Sharing Scheme?AdministriviaAdministrivia: General Course PhilosophyAdministrivia: Courses for TelebearsIf many good teachers: My recommendationsIf many good teachers: Courses to considerSlide 18Inspiration for Solution #3Mapping Virtual Memory to Physical MemoryVirtual Memory Mapping FunctionNotes on Page TableVirtual Memory Problem #1Page Table Entry (PTE) FormatVirtual Memory Problem #2Typical TLB FormatWhat if not in TLB?Virtual Memory Problem #3Page Table Shrink #1:Page Table Shrink #2:2-level Page TableSpace Savings for Multi-Level Page TableNote: Actual MIPS Process Memory Allocation“And in Conclusion..” 1/1cs 61C L19 VM.1Patterson Spring 99 ©UCBCS61CVirtual Memory, 2nd try+ Advice on Courses Lecture 19April 7, 1999Dave Patterson (http.cs.berkeley.edu/~patterson)www-inst.eecs.berkeley.edu/~cs61c/schedule.htmlcs 61C L19 VM.2Patterson Spring 99 ©UCBReview 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 criticalcs 61C L19 VM.3Patterson Spring 99 ©UCBOutline°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°Conclusioncs 61C L19 VM.4Patterson Spring 99 ©UCBReview: C memory allocation0(232-1)AddressCodeProgramStaticVariables declaredonce per programHeapExplicitly created space, e.g., malloc(); C pointersStackSpace for saved procedure information$sp stackpointerglobalpointer$gpcs 61C L19 VM.5Patterson Spring 99 ©UCBMemory Allocation in Reality°Prior schemes assumed 1 process is running; reality is many processes°Even a single person using:•Browser•Compiler•Mail•...(For now, ignore I/O split of address space)0AddressOSUser AUser BUser Ccs 61C L19 VM.6Patterson Spring 99 ©UCB“Sharing” Solution #1 (earliest) °Copy other Users(processes) to Diskwhen not in use°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 disk0AddressOSUser Acs 61C L19 VM.7Patterson Spring 99 ©UCB“Sharing” Solution #2: Base/Bounds°Add Hardware to protectusers from each other so that must not always swap to disk to share machine°Add special registers:•Bound Register: address must fit inside this value-Also called “Protection Register”•Base Register: added to each memory address-Also called “Relocation Register”0AddressOSUser AUser BUser C$base $bound{0cs 61C L19 VM.8Patterson Spring 99 ©UCBBase/Bounds mapping Function°Real memory address:•if Program Address >= Bound ADDRESS ERROR•if Program Address < BoundBase + Program Address°Note:•Allows safe sharing without always swapping to disk•$base, $bound are special registers, like $epc, NOT like $0, ..., $310AddressOSUser AUser BUser C$base $base+$boundcs 61C L19 VM.9Patterson Spring 99 ©UCB1: What if need to grow size of Process B?°If lucky, space above process available0AddressOSUser AUser BUser C$base $base+$bound 0AddressOSUser AUser BUser C$base $base+$boundcs 61C L19 VM.10Patterson Spring 99 ©UCB2: What if need to grow size of Process B?°If unlucky, must copy to create space0AddressOSUser AUser BUser C$base $base+$bound OSUser AUser BUser C0AddressOSUser AUser BUser C$base+$bound $basecs 61C L19 VM.11Patterson Spring 99 ©UCB3: What if need to grow size of Process B?°If really unlucky, must swap to disk0AddressOSUser AUser BUser C$base $base+$bound OSUser AUser BOS0AddressUser AUser B$base $base+$boundcs 61C L19 VM.12Patterson Spring 99 ©UCBDanger of Base/Bounds Sharing Scheme?°Lots of free memory, but in small fragments  too small to be useful0OSUser AUser BUser C$base $base+$bound °Called “Memory Fragmentation” Problem•Happens when processes quit too°Base/bounds HW will not solveEnough space for User D,but discontinuous so cannot usecs 61C L19 VM.13Patterson Spring 99 ©UCBAdministrivia°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 250-256, 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 loadcs 61C L19 VM.14Patterson Spring 99 ©UCBAdministrivia: 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.15Patterson Spring 99 ©UCBAdministrivia: 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 Katz 6.2 F92•CS 152 computer Patterson 6.7 S95•CS 164 compilers Rowe 6.1 S98•CS 169 SW engin. Brewer 6.2 S98•CS 174 combinatorics Sinclair 6.1 F97•CS 186 data bases Wang 6.2 S98cs 61C L19 VM.16Patterson Spring 99 ©UCBIf 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 thingcs 61C L19 VM.17Patterson Spring 99 ©UCBIf many good


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
Download Lecture 19
Our administrator received your request to download this document. We will send you the file to your email shortly.
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 2 2 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?