DOC PREVIEW
Berkeley COMPSCI 61C - Lecture 19

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 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 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Page 1, 3/7/99 7:25 AMcs 61C L19 VM.1Patterson Spring 99 ©UCBCS61CVirtual Memory, 2nd try+ Advice on CoursesLecture 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 andnext level down•Write Back: Write only to current level, writedirty 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 = pagefault, 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 byBase/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 assumed1 process is running;reality is many processes°Even a single personusing:• Browser• Compiler• Mail• ...(For now, ignore I/O split ofaddress 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 newprocess, swap new userand old user°Protection: only 1 userat a time, so OK;(but OS not protected)°Problem: slow to swapprocesses betweenmemory and disk0∞AddressOSUser APage 2, 3/7/99 7:25 AMcs 61C L19 VM.7Patterson Spring 99 ©UCB“Sharing” Solution #2: Base/Bounds°Add Hardware to protectusers from each other sothat must not always swapto disk to share machine°Add special registers:• Bound Register: addressmust fit inside this value- Also called“Protection Register”• Base Register: added toeach 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 >= BoundADDRESS ERROR• if Program Address < BoundBase + Program Address°Note:• Allows safe sharing withoutalways swapping to disk• $base, $bound are specialregisters, like $epc,NOT like $0, ..., $310∞AddressOSUser AUser BUser C$base $base+$bound cs 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+$bound cs 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 $base cs 61C L19 VM.11Patterson Spring 99 ©UCB3: What if need to grow size of Process B?°If unluckier, must swap to disk0∞AddressOSUser AUser BUser C$base $base+$bound OSUser AUser BOS0∞AddressUser AUser B$base $base+$bound cs 61C L19 VM.12Patterson Spring 99 ©UCBDanger of Base/Bounds Sharing Scheme?°Lots of free memory, but in smallfragments ⇒ too small to be useful0∞OSUser AUser BUser C$base $base+$bound °Called “MemoryFragmentation”Problem• Happens whenprocesses quit too°Base/bounds HWwill not solveEnough space for User D,but discontinuous so cannot usePage 3, 3/7/99 7:25 AMcs 61C L19 VM.13Patterson Spring 99 ©UCBAdministrivia°Project 5: Due 4/14: design and implementa cache (in software) and plug intoinstruction simulator°Next Readings: 5.1 (skip clocking), 5.2, 4.5(pages 230-240), 4.6 (pages 250-256, 264),4.7 (pages 265-273)• How many lectures to cover: 2? 3?°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 coursesnow to get introduction to areas• Can learn advanced material on own lateronce know vocabulary°Who knows what you will work onover 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 CommunicationNetworks• World is getting connected;communications must play major role°CS162 Operating Systems• All special-purpose HW will run a layer of SWthat uses processes and concurrentprogramming; CS162 is the closest thingcs 61C L19 VM.17Patterson Spring 99 ©UCBIf many good teachers: Courses to consider°E190 Technical Communication• Talent in writing and speaking critical forsuccess• Now required for EECS majors°CS 150 Lab Hardware Design• Hands on HW design°CS 152 Design a Computer°CS 188 Understand databases• Information more important now thancomputation?cs 61C L19 VM.18Patterson Spring 99 ©UCBAdministrivia: Courses for Telebears°Remember:°Teacher qualitymore important to learning experiencethan official course content°Take courses from great teachers!Page 4, 3/7/99 7:25 AMcs 61C L19 VM.19Patterson Spring 99 ©UCBInspiration for Solution #3°Provide Hardware to allow discontinuousmemory to look continuous to new process0∞OSUser AUser BUser C$base $base+$bound °Solution #3 calledVirtual Memory,or Paging°Will specify newHW mappingfunctionEnough space for User D,but discontinuous cs 61C L19 VM.20Patterson Spring 99 ©UCBMapping Virtual Memory to Physical Memory 0Physical Memory∞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
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?