University*of*Washington*

Size: px
Start display at page:

Download "University*of*Washington*"

Transcription

1 Roadmap C: car c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp Java: Car c = new Car(); c.setmiles(100); c.setgals(17); float mpg = c.getmpg(); OS: &data Integers&floats Machinecode&C x86assembly Procedures&stacks Arrays&structs &caches Processes allocajon Javavs.C Again:Processes! DefiniJon:Aprocessisaninstanceofarunningprogram! Oneofthemostimportantideasincomputerscience! Notthesameas program or processor! ProcessprovideseachprogramwithtwokeyabstracJons:! Logicalcontrolflow! EachprocessseemstohaveexclusiveuseoftheCPU! Privatevirtualaddressspace! Eachprocessseemstohaveexclusiveuseofmainmemory! Howaretheseillusionsmaintained?! ProcessexecuAonsinterleaved(mulACtasking) done! Addressspacesmanagedbyvirtualmemorysystem now! 2 (VM) asweknowitsofar isvirtual!! OverviewandmoJvaJon! VMastoolforcaching! AddresstranslaJon! VMastoolformemorymanagement! VMastoolformemoryprotecJon! Programsrefertovirtualmemoryaddresses! movl (%ecx),%eax!! Conceptuallymemoryisjustaverylargearrayofbytes! Eachbytehasitsownaddress FF\\\\\\F! SystemprovidesaddressspaceprivatetoparAcular process! AllocaJon:CompilerandrunXJmesystem! Wheredifferentprogramobjectsshouldbestored! AllallocaAonwithinsinglevirtualaddressspace! But! Weprobablydon thaveexactly2 w bytesofphysicalmemory.! Wecertainlydon thave2 w bytesofphysicalmemory foreveryprocess.! WehavemulApleprocessesthatusuallyshouldnot 00\\\\\\ interferewitheachother,butsomeamesshouldsharecodeordata. 3 4

2 Problem1:HowDoesEverythingFit? 5 64Xbitaddressescanaddress severalexabytes (18,446,744,073,709,551,616bytes) Physicalmainmemoryoffers afewgigabytes (e.g.8,589,934,592bytes)? virtualaddressspaceperprocess, withmanyprocesses (Actually,it ssmallerthanthat dotcomparedtovirtualmemory.) Problem2:Management 6 Physicalmainmemory What goes where? stack heap.text.data Process Process2 Process3 Processn x Problem3:HowToProtect 7 Physicalmainmemory Processi Processj Problem4:HowToShare? Physicalmainmemory Processi Processj Howcanwesolvetheseproblems? 8

3 IndirecJon! Anyproblemincomputersciencecanbesolvedbyaddinganotherlevel ofindirecjon. - David-Wheeler,-inventor-of-the-subrou7ne-(a.k.a.-procedure)- IndirecJon! Indirec7on:theabilitytoreferencesomethingusinganame,reference,or containerinsteadthevalueitself.aflexiblemappingbetweenanameanda thingallowschangingthethingwithoutnoafyingholdersofthename.! WithoutIndirecJon Name Thing! WithoutIndirecJon Name Thing! WithIndirecJon Name Thing! WithIndirecJon Name Thing WhatifIwanttomoveThing? Thing! ExamplesofindirecJon:! DomainNameService(DNS):translaAonfromnametoIPaddress! phonesystem:cellphonenumberportability! snailmail:mailforwarding! 911:routedtolocaloffice! DynamicHostConfiguraAonProtocol(DHCP):localnetworkaddressassignment! callcenters:routecallstoavailableoperators,etc. Thing 9 1 IndirecJonin Process Processn mapping AddressSpaces! Virtualaddressspace:SetofN=2 n virtualaddresses {0,1,2,3,,NC1}! Physicaladdressspace:SetofM=2 m physicaladdresses(n>=m) {0,1,2,3,,MC1}! Everybyteinmainmemoryhas:! onephysicaladdress! zero,one,or+morevirtualaddresses! Eachprocessgetsitsownprivatevirtualaddressspace! Solvesthepreviousproblems 1 12

4 Mapping ASystemUsingPhysicalAddressing Avirtualaddresscanbe mappedtoeitherphysical memoryordisk. P1 svirtualaddressspace Physical Physicaladdress (PA) 4 Mainmemory 0: 1: 2: 3: 4: 5: 6: 7: 8: MX1: Disk Dataword P2 svirtualaddressspace! Usedin simple systemswith(usually)justoneprocess:! embeddedmicrocontrollersindeviceslikecars,elevators,anddigital pictureframes ASystemUsingVirtualAddressing! Physicaladdressesarecompletely-invisible-to-programs.! Usedinallmoderndesktops,laptops,servers,smartphones! Oneofthegreatideasincomputerscience CPU-Chip- Virtualaddress (VA) 4100 MMU ManagementUnit Dataword Physicaladdress (PA) 4 Mainmemory 0: 1: 2: 3: 4: 5: 6: 7: 8: MX1: 15 Why(VM)?! Efficientuseoflimitedmainmemory(RAM)! UseRAMasacacheforthepartsofavirtualaddressspace! somenonccachedpartsstoredondisk! some(unallocated)nonccachedpartsstorednowhere! KeeponlyacAveareasofvirtualaddressspaceinmemory! transferdatabackandforthasneeded! Simplifiesmemorymanagementforprogrammers! Eachprocessgetsthesamefull,privatelinearaddressspace! Isolatesaddressspaces! Oneprocesscan tinterferewithanother smemory! becausetheyoperateindifferentaddressspaces! UserprocesscannotaccessprivilegedinformaAon! differentsecaonsofaddressspaceshavedifferentpermissions 16

5 VMandtheHierarchy! Thinkof-virtualmemory-asarrayofN=2 n conjguousbytes.-! Pagesofvirtualmemoryareusuallystoredinphysical memory,butsomejmesspilltodisk.-! Pagesareanotherunitofalignedmemory(sizeisP=2 p bytes)! Eachvirtualpagecanbestoredinanyphysicalpage. or:asdramcachefordisk! Thenphysicalmainmemoryisusedasacacheforthe virtualmemoryarray! Thecacheblocksarecalledpages+(sizeisP=2 p bytes) Disk VP VP Unallocated Cached Uncached Unallocated Cached Uncached Cached VP2 nxp X Uncached 2 n X Virtualpages(VP's) storedondisk 2 m X Empty Empty Empty PP PP PP2 mxp X Physicalpages(PP's) cachedindram 17 VP VP Unallocated Cached Uncached Unallocated Cached Uncached Cached VP2 nxp X Uncached NX Virtualpages(VPs) storedondisk MX Empty Empty Empty PP PP PP2 mxp X Physicalpages(PPs) cachedindram 18 Hierarchy:Core2Duo Reg Throughput: Latency: SRAM StaAcRandomAccessMemory 16B/cycle 3cycles L IXcache 32KB L DXcache 8B/cycle 14cycles ~4MB L2 unified cache Not-drawn-to-scale- Miss-penalty-(latency):-33x- DRAM DynamicRandomAccessMemory 2B/cycle 10cycles ~4GB Main B/3cycles millions! Thinkof-virtualmemory-asanarrayofN=2 n conjguous bytesstoredon-a-disk.- ~50GB Disk DesignConsequences! Largepage-size:typically4X8KB,someJmesupto4MB! FullyassociaJve! Anyvirtualpagecanbeplacedinanyphysicalpage! Requiresa large mappingfuncaon differentfromcpucaches! HighlysophisJcated,expensivereplacementalgorithmsinOS! ToocomplicatedandopenCendedtobeimplementedinhardware! WriteXbackratherthanwriteXthrough Miss-penalty-(latency):-10,000x- 19 2

6 AddressTranslaJon 2 How-do-we-perform-the--virtual-L>-physical-address- transla7on?- 0: 1: MX1: Mainmemory MMU 2: 3: 4: 5: 6: 7: Physicaladdress (PA) Dataword 8: Virtualaddress (VA) CPU-Chip AddressTranslaJon:PageTables! Apage-table-isanarrayofpage-table-entries(PTEs)that mapsvirtualpagestophysicalpages. 22 null null resident pagetable (disk) Physical-page- number-or-- disk-address- PTE PTE7 PP VP PP3 VP VP6 How-many-page-tables-are-in-the-system? Oneperprocessstoredinphysicalmemory managedbyhw(mmu),os AddressTranslaJonWithaPageTable 23 Virtual page number (VPN) Virtual page offset (VPO) Physicalpagenumber(PPN) Physical page offset (PPO) Virtual-address-(VA)- Physical-address-(PA)- Valid Physicalpagenumber(PPN) Pagetable baseregister (PTBR) Page-table-- Pagetableaddress forprocess Validbit=0: pagenotinmemory (pagefault) Inmostcases,thehardware (themmu)canperformthis translajononitsown, withoutsoswareassistance Thisfeelsfamiliar PageHit! Page-hit:-referencetoVMbytethatisinphysicalmemory null null resident pagetable (disk) Physical-page- number-or-- disk-address- PTE PTE7 PP VP PP3 VP VP6 Virtual address 24

7 PageFault! Page-fault:-referencetoVMbytethatisNOTinphysical memory Virtual address Whathappenswhenapage faultoccurs? resident pagetable VP (disk) VP VP6 PP PP3 FaultExample:PageFault! UserwritestomemorylocaAon! ThatporAon(page)ofuser smemory iscurrentlyondisk! Pagehandlermustloadpageintophysicalmemory! ReturnstofaulAnginstrucAon:movisexecutedagain!! Successfulonsecondtry int a[1000]; main () { a[500] = 13; } 80483b7: c d d movl 0xd,0x8049d10 User-Process- movl OSexcep1on:+page+fault+ returns Physical-page- number-or-- disk-address- PTE null null PTE7 Create+page+and++ load+into+memory HandlingPageFault! Pagemisscausespagefault(anexcepAon) HandlingPageFault! Pagemisscausespagefault(anexcepAon)! Pagefaulthandlerselectsavic1mtobeevicted(hereVP4) Virtual address resident pagetable VP (disk) VP PP PP3 Virtual address Physical-page- number-or-- disk-address- PTE null null PTE7 Physical-page- number-or-- disk-address- PTE null null PTE7 resident pagetable VP (disk) VP PP PP3 VP6 VP

8 HandlingPageFault! Pagemisscausespagefault(anexcepAon)! Pagefaulthandlerselectsavic1mtobeevicted(hereVP4) Virtual address resident pagetable VP (disk) VP VP6 PP PP3 HandlingPageFault! Pagemisscausespagefault(anexcepAon)! Pagefaulthandlerselectsavic1mtobeevicted(hereVP4)! OffendinginstrucAonisrestarted:pagehit! Virtual address Physical-page- number-or-- disk-address- PTE null null PTE7 Physical-page- number-or-- disk-address- PTE null null PTE7 resident pagetable VP (disk) VP VP6 PP PP Whydoesitwork? WhydoesVMworkonRAM/disk?Locality.! workswellforavoidingdiskaccessesbecause oflocality! SamereasonthatL1/L2/L3cacheswork! Thesetofvirtualpagesthataprogramis acjvely accessing atanypointinjmeiscalleditsworking-set-! Programswithbejertemporallocalitywillhavesmallerworkingsets! If(workingsetsizeofoneprocess<mainmemorysize):! Goodperformanceforoneprocessalercompulsorymisses! Butif SUM(workingsetsizesofallprocesses)>mainmemorysize:! Thrashing:+Performancemeltdown+wherepagesareswapped(copied) betweenmemoryanddiskconanuously.cpualwayswaiangorpaging.! Fullquote: EveryproblemincomputersciencecanbesolvedbyaddinganotherlevelofindirecAon, but+that+usually+will+create+another+problem. 3 32

9 SimplifyingLinkingandLoading! Linking! Eachprogramhassimilarvirtual addressspace! Code,stack,andsharedlibraries alwaysstartatthesameaddress! Loading! execve() allocatesvirtualpages for.textand.datasecaons =createsptesmarkedasinvalid! The.text and.data secaons arecopied,pagebypage,on demandbythevirtualmemory system 0xc x x Kernelvirtualmemory Userstack (createdatrunjme) MemoryXmappedregionfor sharedlibraries RunXJmeheap (createdbymalloc) Read/writesegment (.data,.bss) ReadXonlysegment (.init,.text,.rodata) Unused invisibleto usercode %esp (stack pointer) brk Loaded from the executable file 33 VMforManagingMulJpleProcesses! KeyabstracJon:eachprocesshasitsownvirtualaddressspace! Itcanviewmemoryasa+simple+linear+array+! Withvirtualmemory,thissimplelinearvirtualaddressspace neednotbeconjguousinphysicalmemory! ProcessneedstostoredatainanotherVP?JustmapittoanyPP! Virtual- Address- Space-for- Process-1:- Physical-- Address-- Space- (DRAM)- Virtual- Address- Space-for- Process-2:- NX NX VP 1 VP 2 VP 1 VP 2 Address-- transla7on MX PP 2 PP 6 PP 8 (e.g.,readxonly librarycode) 34 VMforProtecJonandSharing! ThemappingofVPstoPPsprovidesasimplemechanismto protectmemoryandtosharememorybetweenprocesses.! Sharing:justmapvirtualpagesinseparateaddressspacestothesame physicalpage(here:pp6)! ProtecJon:processsimplycan taccessphysicalpagestowhichnoneof itsvirtualpagesaremapped(here:process2can taccesspp2). Virtual- Address- Space-for- Process-1:- VP 1 VP 2 Address-- transla7on PP 2 Physical-- Address-- Space- (DRAM)- ProtecJonWithinaSingleProcess! Canweusevirtualmemorytocontrolread/write/execute permissions?how? Virtual- Address- Space-for- Process-2:- NX VP 1 VP 2 PP 6 PP 8 (e.g.,readxonly librarycode) NX MX 35 36

10 ProtecJonWithinaSingleProcess! Extendpagetableentrieswithpermissionbits Process-j:- VP0: VP1: VP2: Valid Yes Yes Yes READ No Yes No WRITE Yes No Yes EXEC PhysicalPageNum No No No PP9 PP6 PP1 PP 8 PP9 PP 11 Terminology! contextswitch! SwitchbetweenprocessesonthesameCPU! pagein! Movepagesofvirtualmemoryfromdisktophysicalmemory! pageout! Movepagesofvirtualmemoryfromphysicalmemorytodisk! thrash! Totalworkingsetsizeofprocessesislargerthanphysicalmemory! MostAmeisspentpaginginandoutinsteadofdoingusefulcomputaAon AddressTranslaJon:PageHit CPU-Chip- VA Data MMU 1)ProcessorsendsvirtualaddresstoMMU(memory+management+unit) 2C3)MMUfetchesPTEfrompagetableincache/memory 4)MMUsendsphysicaladdresstocache/memory 5)Cache/memorysendsdatawordtoprocessor 5 2 PTEA PTE 3 PA 4 Cache/ AddressTranslaJon:PageFault! MMUchecksthesepermissionbitsoneverymemoryaccess! Ifviolated,raisesexcepAonandOSsendsSIGSEGVsignaltoprocess (segmentaaonfault) Physical-- Process-i:- Valid READ WRITE EXEC PhysicalPageNum Address-Space- VP0: Yes Yes No No PP6 VP1: Yes No No Yes PP4 VP2: Yes Yes Yes No PP2 PP 2 PP4 PP 6 CPU-Chip- VA 7 MMU ExcepJon 1)ProcessorsendsvirtualaddresstoMMU Cache/ 2C3)MMUfetchesPTEfrompagetableincache/memory 4)Validbitiszero,soMMUtriggerspagefaultexcepAon 5)HandleridenAfiesvicAm(and,ifdirty,pagesitouttodisk) 6)HandlerpagesinnewpageandupdatesPTEinmemory 7)Handlerreturnstooriginalprocess,restarAngfaulAnginstrucAon 4 2 PTEA PTE 3 Pagefaulthandler VicJmpage 5 Newpage 6 Disk 39 4

11 Hmm TranslaJonSoundsSlow!! TheMMUaccessesmemorytwice:oncetofirstgetthePTE fortranslajon,andthenagainfortheactualmemoryrequest fromthe! ThePTEsmaybecachedinL1likeanyothermemoryword! Buttheymaybeevictedbyotherdatareferences! AndahitintheL1cachesAllrequires1C3cycles! What+can+we+do+to+make+this+faster?+ SpeedingupTranslaJonwithaTLB! SoluJon:addanothercache!! Transla7on-Lookaside-Buffer(TLB):! SmallhardwarecacheinMMU! Mapsvirtualpagenumberstophysicalpagenumbers! Containscompletepage+table+entriesforsmallnumberofpages! ModernIntelprocessors:128or256entriesinTLB! Muchfasterthanapagetablelookupincache/memory 4 42 TLBHit TLBMiss TLB 2 PTE CPU-Chip- CPU-Chip- TLB 2 4 PTE VPN 3 VPN 3 VA MMU PA 4 Cache/ VA MMU PTEA PA Cache/ 5 Data Data 5 6 ATLBhiteliminatesamemoryaccess ATLBmissincursanaddiJonalmemoryaccess(thePTE) Fortunately,TLBmissesarerare.DoesaTLBmissrequirediskaccess? 43 44

12 SimpleSystemExample(small)! Addressing! 14Cbitvirtualaddresses! 12Cbitphysicaladdress! Pagesize=64bytes VPN VirtualPageNumber VPO VirtualPageOffset SimpleSystemPageTable! Onlyshowingfirst16entries(outof256=2 8 ) VPN- PPN- VPN- PPN A B 04 0C D 2D 06 0E F 0D PPN PhysicalPageNumber PPO PhysicalPageOffset! Whataboutarealaddressspace?Readmoreinthebook SimpleSystemTLB! 16entries! 4XwayassociaJve TLBignorespageoffset.Why? TLBtag TLBindex SimpleSystemCache! 16lines,4Xbyteblocksize! Physicallyaddressed! Directmapped cachetag cacheindex cacheoffset virtualpagenumber virtualpageoffset physicalpagenumber physicalpageoffset Tag- 24 2D 2D 0B Idx- 8 9 A B C D E F B0-3A B B2-5 DA 34 1B B3-89 3B 15 D3 PPN- 02 Tag- 07 0A PPN- 34 Tag A PPN- 0D 0D Tag PPN- 2D Tag Set- 2 3 B D 03 B F F DF B D 72 C2 B Tag B D 3 16 Idx

13 TLB Currentstateofcaches/tables VPN- PPN- VPN- PPN Set- Tag- PPN- Tag- PPN- Tag- PPN- Tag- PPN D A D A B C D 0A D 2D 06 0E F 0D Pagetable Cache Idx- Tag- B0- B1- B2- B3- Idx- Tag- B0- B1- B2- B A D 2 1B A 2D DA 3B 3 36 B 0B D 8F 09 C D F 1D D E B D C2 DF 03 F 14 AddressTranslaJonExample# VirtualAddress:0x03D4 VPN 0x0F TLBI 3 TLBT 0x03 TLBHit? Y PageFault? PPN: N 0x0D PhysicalAddress TLBT TLBI VPN CT CO CI 0x5 CT 0x0D Hit? Byte: Y 0x36 VPO PPN CI PPO CO 49 5 AddressTranslaJonExample#2 VirtualAddress:0x0B8F VPN 0x2E TLBI 2 TLBT 0x0B TLBHit? N PageFault? PPN: Y TBD PhysicalAddress TLBT TLBI VPN CT CO CI CT Hit? Byte: VPO PPN PPO 5 CI CO AddressTranslaJonExample#3 VirtualAddress:0x0020 VPN 0x0 TLBI TLBT 0x0 TLBHit? N PageFault? PPN: N 0x28 PhysicalAddress TLBT TLBI VPN CT VPO PPN PPO CO CI 0x8 CT 0x28 Hit? Byte: N Mem 52 CI CO

14 ServicingaPageFault! (1)Processorsignalsdiskcontroller! ReadblockoflengthP starangatdiskaddressx! StorestarAngatmemoryaddressY! (2)Readoccurs! DirectMemoryAccess(DMA)! UndercontrolofI/Ocontroller! (3)ControllersignalscompleJon! Interruptsprocessor! OSresumessuspendedprocess Processor Reg Cache (1)IniJateBlockRead (3)Read Done MemoryXI/Obus I/O controller Summary! Programmer sviewofvirtualmemory! Eachprocesshasitsownprivatelinearaddressspace! Cannotbecorruptedbyotherprocesses! Systemviewofvirtualmemory! Usesmemoryefficientlybycachingvirtualmemorypages! Efficientonlybecauseoflocality! Simplifiesmemorymanagementandsharing! SimplifiesprotecAonbyprovidingaconvenientinterposiAoningpointto checkpermissions (2)Direct Address Transfer Disk Disk SystemSummary! L1/L2Cache! PurelyaspeedCuptechnique! BehaviorinvisibletoapplicaAonprogrammerand(mostly)OS! Implementedtotallyinhardware!! SupportsmanyOSCrelatedfuncAons! ProcesscreaAon,taskswitching,protecAon! OperaAngSystem(solware)! Allocates/sharesphysicalmemoryamongprocesses! MaintainshighCleveltablestrackingmemorytype,source,sharing! HandlesexcepAons,fillsinhardwareCdefinedmappingtables! Hardware! Translatesvirtualaddressesviamappingtables,enforcingpermissions! AcceleratesmappingviatranslaAoncache(TLB) 55 SystemSummary! L1/L2Cache! Controlledbyhardware! Programmercannotcontrolit! Programmercanwritecodeinawaythattakesadvantageofit!! ControlledbyOSandhardware! Programmercannotcontrolmappingtophysicalmemory! ProgrammercancontrolsharingandsomeprotecAon! viaosfuncaons(notin351) 56

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = ; c->gals = 7; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp Java: Car c = new

More information

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program Virtual Memory (VM) Overview and motivation VM as tool for caching VM as tool for memory management VM as tool for memory protection Address translation 4 May 22 Virtual Memory Processes Definition: A

More information

This lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a

This lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a Virtual Memory Instructor: Sanjeev Se(a This lecture (VM) Overview and mo(va(on VM as tool for caching VM as tool for memory management VM as tool for memory protec(on Address transla(on 2 Virtual Memory

More information

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson Virtual Memory I CSE 35 Spring 27 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Midterms Graded If you did

More information

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Systems Programming and Computer Architecture ( ) Timothy Roscoe Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-6-) Timothy Roscoe Herbstsemester 26 AS 26 Virtual Memory 8: Virtual Memory Computer Architecture

More information

University of Washington Virtual memory (VM)

University of Washington Virtual memory (VM) Virtual memory (VM) Overview and mo-va-on VM as tool for caching VM as tool for memory management VM as tool for memory protec-on Address transla-on Processes Defini=on: A process is an instance of a running

More information

Virtual Memory. Alan L. Cox Some slides adapted from CMU slides

Virtual Memory. Alan L. Cox Some slides adapted from CMU slides Alan L. Cox alc@rice.edu Some slides adapted from CMU 5.23 slides Objectives Be able to explain the rationale for VM Be able to explain how VM is implemented Be able to translate virtual addresses to physical

More information

Computer Systems. Virtual Memory. Han, Hwansoo

Computer Systems. Virtual Memory. Han, Hwansoo Computer Systems Virtual Memory Han, Hwansoo A System Using Physical Addressing CPU Physical address (PA) 4 Main memory : : 2: 3: 4: 5: 6: 7: 8:... M-: Data word Used in simple systems like embedded microcontrollers

More information

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse http://rebrn.com/re/bad-chrome-6282/ Virtual Memory I CSE 35 Winter 28 Instructor: Mark Wyse Teaching Assistants: Kevin Bi Parker DeWilde Emily Furst Sarah House Waylon Huang Vinny Palaniappan Administrative

More information

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition Carnegie Mellon Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, October 24, 27 Instructor: Randy Bryant 2 Hmmm, How Does This Work?! Process Process 2 Process n Solution:

More information

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14 98:23 Intro to Computer Organization Lecture 4 Virtual Memory 98:23 Introduction to Computer Organization Lecture 4 Instructor: Nicole Hynes nicole.hynes@rutgers.edu Credits: Several slides courtesy of

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 53 Design of Operating Systems Winter 28 Lecture 6: Paging/Virtual Memory () Some slides modified from originals by Dave O hallaron Today Address spaces VM as a tool for caching VM as a tool for memory

More information

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia Virtual Memory II CSE 35 Autumn 26 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun https://xkcd.com/495/

More information

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia Virtual Memory II CSE 35 Autumn 27 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan https://xkcd.com/495/

More information

Processes and Virtual Memory Concepts

Processes and Virtual Memory Concepts Processes and Virtual Memory Concepts Brad Karp UCL Computer Science CS 37 8 th February 28 (lecture notes derived from material from Phil Gibbons, Dave O Hallaron, and Randy Bryant) Today Processes Virtual

More information

Virtual Memory. Physical Addressing. Problem 2: Capacity. Problem 1: Memory Management 11/20/15

Virtual Memory. Physical Addressing. Problem 2: Capacity. Problem 1: Memory Management 11/20/15 Memory Addressing Motivation: why not direct physical memory access? Address translation with pages Optimizing translation: translation lookaside buffer Extra benefits: sharing and protection Memory as

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts Instructor: Dr. Hyunyoung Lee Based on slides provided by Randy Bryant and Dave O Hallaron Today Address spaces VM as a tool for caching VM as a tool for memory management VM as

More information

Carnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe

Carnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe Virtual Memory: Concepts 5 23 / 8 23: Introduction to Computer Systems 6 th Lecture, Mar. 2, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Address spaces VM as a tool lfor caching VM as a tool for

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts 5-23 / 8-23: Introduc=on to Computer Systems 6 th Lecture, Mar. 8, 24 Instructors: Anthony Rowe, Seth Goldstein, and Gregory Kesden Today VM Movaon and Address spaces ) VM as a

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, March 2, 27 Instructors: Franz Franchetti & Seth Copen Goldstein Hmmm, How Does This Work?! Process Process 2 Process n Solution:

More information

Virtual Memory Nov 9, 2009"

Virtual Memory Nov 9, 2009 Virtual Memory Nov 9, 2009" Administrivia" 2! 3! Motivations for Virtual Memory" Motivation #1: DRAM a Cache for Disk" SRAM" DRAM" Disk" 4! Levels in Memory Hierarchy" cache! virtual memory! CPU" regs"

More information

Virtual Memory II CSE 351 Spring

Virtual Memory II CSE 351 Spring Virtual Memory II CSE 351 Spring 2018 https://xkcd.com/1495/ Virtual Memory (VM) Overview and motivation VM as a tool for caching Address translation VM as a tool for memory management VM as a tool for

More information

Lecture 19: Virtual Memory: Concepts

Lecture 19: Virtual Memory: Concepts CSCI-UA.2-3 Computer Systems Organization Lecture 9: Virtual Memory: Concepts Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett

More information

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011 Virtual Memory CS6, Lecture 5 Prof. Stephen Chong October 2, 2 Announcements Midterm review session: Monday Oct 24 5:3pm to 7pm, 6 Oxford St. room 33 Large and small group interaction 2 Wall of Flame Rob

More information

Foundations of Computer Systems

Foundations of Computer Systems 8-6 Foundations of Computer Systems Lecture 5: Virtual Memory Concepts and Systems October 8, 27 8-6 SE PL OS CA Required Reading Assignment: Chapter 9 of CS:APP (3 rd edition) by Randy Bryant & Dave O

More information

Virtual Memory Oct. 29, 2002

Virtual Memory Oct. 29, 2002 5-23 The course that gives CMU its Zip! Virtual Memory Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs class9.ppt Motivations for Virtual Memory Use Physical

More information

Virtual Memory I. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory I. CSE 351 Autumn Instructor: Justin Hsia Virtual Memory I CSE 351 Autumn 2018 Instructor: Justin Hsia Teaching Assistants: Akshat Aggarwal An Wang Andrew Hu Brian Dai Britt Henderson James Shin Kevin Bi Kory Watson Riley Germundson Sophie Tian

More information

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs Virtual Memory Today Motivations for VM Address translation Accelerating translation with TLBs Fabián Chris E. Bustamante, Riesbeck, Fall Spring 2007 2007 A system with physical memory only Addresses generated

More information

CISC 360. Virtual Memory Dec. 4, 2008

CISC 360. Virtual Memory Dec. 4, 2008 CISC 36 Virtual Dec. 4, 28 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache for the Disk Address space of a process

More information

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk class8.ppt 5-23 The course that gives CMU its Zip! Virtual Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache

More information

Virtual Memory. Samira Khan Apr 27, 2017

Virtual Memory. Samira Khan Apr 27, 2017 Virtual Memory Samira Khan Apr 27, 27 Virtual Memory Idea: Give the programmer the illusion of a large address space while having a small physical memory So that the programmer does not worry about managing

More information

A Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space

A Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space Process Abstraction, Part : Private Motivation: why not direct physical memory access? Address translation with pages Optimizing translation: translation lookaside buffer Extra benefits: sharing and protection

More information

CSE 351. Virtual Memory

CSE 351. Virtual Memory CSE 351 Virtual Memory Virtual Memory Very powerful layer of indirection on top of physical memory addressing We never actually use physical addresses when writing programs Every address, pointer, etc

More information

Virtual Memory: Systems

Virtual Memory: Systems Virtual Memory: Systems 5-23: Introduction to Computer Systems 8 th Lecture, March 28, 27 Instructor: Franz Franchetti & Seth Copen Goldstein Recap: Hmmm, How Does This Work?! Process Process 2 Process

More information

Understanding the Design of Virtual Memory. Zhiqiang Lin

Understanding the Design of Virtual Memory. Zhiqiang Lin CS 6V8-05: System Security and Malicious Code Analysis Understanding the Design of Virtual Memory Zhiqiang Lin Department of Computer Science University of Texas at Dallas February 27 th, 202 Outline Basic

More information

University*of*Washington*

University*of*Washington* Roadmap* C:* car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly* language:* Machine* code:* Computer* system:* get_mpg: pushq movq... popq ret %rbp %rsp,

More information

Virtual Memory: Systems

Virtual Memory: Systems Virtual Memory: Systems 5-23 / 8-23: Introduc2on to Computer Systems 7 th Lecture, Mar. 22, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Virtual memory ques7ons and answers Simple memory system example

More information

VM as a cache for disk

VM as a cache for disk Virtualization Virtual Memory Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3 Instructor: Joanna Klukowska Virtualization of a resource: presenting a user with a different view of that

More information

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics Systemprogrammering 27 Föreläsning 4 Topics The memory hierarchy Motivations for VM Address translation Accelerating translation with TLBs Random-Access (RAM) Key features RAM is packaged as a chip. Basic

More information

Processes, Virtual Memory I

Processes, Virtual Memory I Processes, Virtual Memory I CSE 351 Summer 2018 Instructor: Justin Hsia Teaching Assistants: Josie Lee Natalie Andreeva Teagan Horkan http://rebrn.com/re/bad-chrome-1162082/ Administrivia Homework 4 due

More information

Random-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy

Random-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy Systemprogrammering 29 Föreläsning 4 Topics! The memory hierarchy! Motivations for VM! Address translation! Accelerating translation with TLBs Random-Access (RAM) Key features! RAM is packaged as a chip.!

More information

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk 5-23 March 23, 2 Topics Motivations for VM Address translation Accelerating address translation with TLBs Pentium II/III system Motivation #: DRAM a Cache for The full address space is quite large: 32-bit

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 6: Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals by Dave

More information

P6/Linux Memory System Nov 11, 2009"

P6/Linux Memory System Nov 11, 2009 P6/Linux Memory System Nov 11, 2009" REMEMBER" 2! 3! Intel P6" P6 Memory System" DRAM" external system bus (e.g. PCI)" L2" cache" cache bus! bus interface unit" inst" TLB" instruction" fetch unit" L1"

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 17: Advanced Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

virtual memory Page 1 CSE 361S Disk Disk

virtual memory Page 1 CSE 361S Disk Disk CSE 36S Motivations for Use DRAM a for the Address space of a process can exceed physical memory size Sum of address spaces of multiple processes can exceed physical memory Simplify Management 2 Multiple

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp 0111010000011000

More information

Virtual Memory. Spring Instructors: Aykut and Erkut Erdem

Virtual Memory. Spring Instructors: Aykut and Erkut Erdem Virtual Memory Spring 22 Instructors: Aykut and Erkut Erdem Acknowledgement: The course slides are adapted from the slides prepared by R.E. Bryant, D.R. O Hallaron, G. Kesden and Markus Püschel of Carnegie-

More information

Computer Systems CSE 410 Autumn Memory Organiza:on and Caches

Computer Systems CSE 410 Autumn Memory Organiza:on and Caches Computer Systems CSE 410 Autumn 2013 10 Memory Organiza:on and Caches 06 April 2012 Memory Organiza?on 1 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c);

More information

Memory, Data, & Addressing I

Memory, Data, & Addressing I Memory, Data, & Addressing I CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/953/

More information

Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses.

Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses. Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses. The memory is byte addressable. Memory accesses are to 1-byte

More information

CSE351: Memory, Data, & Addressing I

CSE351: Memory, Data, & Addressing I CSE351: Memory, Data, & Addressing I CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis http://xkcd.com/138/

More information

Virtual Memory. Computer Systems Principles

Virtual Memory. Computer Systems Principles Virtual Memory Computer Systems Principles Objectives Virtual Memory What is it? How does it work? Virtual Memory Address Translation /7/25 CMPSCI 23 - Computer Systems Principles 2 Problem Lots of executing

More information

Question F5: Caching [10 pts]

Question F5: Caching [10 pts] Question F5: Caching [ pts] SID: We have 6 KiB of RAM and two options for our cache. Both are two-way set associative with 256 B blocks, LRU replacement, and write-back policies. Cache A is size KiB and

More information

Announcements* Hardware:*Logical*View* Hardware:*SemiVLogical*View* Hardware:*Physical*View*

Announcements* Hardware:*Logical*View* Hardware:*SemiVLogical*View* Hardware:*Physical*View* Announcements* Hardware:*Logical*View* On*the*website:*cs.uw.edu/351* Speedometer!** Anonymous*feedback*form* Make*sure*you*are*subscribed*to*the*mailing*list* Lecture*slides*on*the*web*schedule*(these*will*be*linked*1>2*days*prior)*

More information

Memory System Case Studies Oct. 13, 2008

Memory System Case Studies Oct. 13, 2008 Topics 15-213 Memory System Case Studies Oct. 13, 2008 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping Class15+.ppt Intel P6 (Bob Colwell s Chip,

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation Virtual Memory Topics (Chapter 9) Motivations for VM Address translation 1 Motivations for Virtual Memory Use Physical DRAM as a Cache for the Disk Address space of a process can exceed physical memory

More information

Pentium/Linux Memory System March 17, 2005

Pentium/Linux Memory System March 17, 2005 15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt

More information

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1 Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L20-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:

More information

Hardware: Logical View

Hardware: Logical View Hardware: Logical View CPU Memory Bus Disks Net USB Etc. 1 Hardware: Physical View USB I/O controller Storage connections CPU Memory 2 Hardware: 351 View (version 0) instructions? Memory CPU data CPU executes

More information

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1 Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L16-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:

More information

Data III & Integers I

Data III & Integers I Data III & Integers I CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Everyone has VM

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 24 LAST TIME Extended virtual memory concept to be a cache of memory stored on disk DRAM becomes L4 cache of data stored on L5 disk Extend page

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 205 Lecture 23 LAST TIME: VIRTUAL MEMORY! Began to focus on how to virtualize memory! Instead of directly addressing physical memory, introduce a level of

More information

Structs and Alignment CSE 351 Spring

Structs and Alignment CSE 351 Spring Structs and Alignment CSE 351 Spring 2018 http://xkcd.com/1168/ Administrivia Homework 3 due Wednesday Lab 3 released, due next week Lab 2 and midterm will be graded this week [in that order] 2 Roadmap

More information

VIRTUAL MEMORY: CONCEPTS

VIRTUAL MEMORY: CONCEPTS VIRTUAL MEMORY: CONCEPTS CS 45 Computer Organization and Architecture Prof. Donald J. Patterson Adapted from Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition VIRTUAL MEMORY:

More information

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines Sample Problem 1 Assume the following memory setup: Virtual addresses are 20 bits wide Physical addresses are 15 bits wide The page size if 1KB (2 10 bytes) The TLB is 2-way set associative, with 8 total

More information

x86 Programming I CSE 351 Winter

x86 Programming I CSE 351 Winter x86 Programming I CSE 351 Winter 2017 http://xkcd.com/409/ Administrivia Lab 2 released! Da bomb! Go to section! No Luis OH Later this week 2 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 208 Lecture 23 LAST TIME: VIRTUAL MEMORY Began to focus on how to virtualize memory Instead of directly addressing physical memory, introduce a level of indirection

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp 0111010000011000

More information

University*of*Washington*

University*of*Washington* Roadmap* C:* car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly* language:* Machine* code:* Computer* system:* get_mpg: pushq movq... popq %rbp %rsp,

More information

Caches Spring 2016 May 4: Caches 1

Caches Spring 2016 May 4: Caches 1 May 4: Caches 1 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret

More information

Data III & Integers I

Data III & Integers I Data III & Integers I CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun

More information

Virtual Memory. CS 3410 Computer System Organization & Programming

Virtual Memory. CS 3410 Computer System Organization & Programming Virtual Memory CS 3410 Computer System Organization & Programming These slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. Where are we now and

More information

Virtual Memory III /18-243: Introduc3on to Computer Systems 17 th Lecture, 23 March Instructors: Bill Nace and Gregory Kesden

Virtual Memory III /18-243: Introduc3on to Computer Systems 17 th Lecture, 23 March Instructors: Bill Nace and Gregory Kesden Virtual Memory III 15-213/18-243: Introduc3on to Computer Systems 17 th Lecture, 23 March 2010 Instructors: Bill Nace and Gregory Kesden (c) 1998-2010. All Rights Reserved. All work contained herein is

More information

Cache Example, System Control Flow

Cache Example, System Control Flow Cache Example, System Control Flow CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 9: Locality and Cache Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

University of Washington

University of Washington Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq %rbp movq %rsp, %rbp... popq %rbp

More information

Virtual Memory: From Address Translation to Demand Paging

Virtual Memory: From Address Translation to Demand Paging Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 12, 2014

More information

Data III & Integers I

Data III & Integers I Data III & Integers I CSE 351 Autumn 2018 Instructor: Justin Hsia Teaching Assistants: Akshat Aggarwal An Wang Andrew Hu Brian Dai Britt Henderson James Shin Kevin Bi Kory Watson Riley Germundson Sophie

More information

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Chapter 8 Virtual Memory Digital Design and Computer Architecture: ARM Edi*on Sarah L. Harris and David Money Harris Digital Design and Computer Architecture: ARM Edi>on 215 Chapter 8 Chapter 8 ::

More information

Cache Wrap Up, System Control Flow

Cache Wrap Up, System Control Flow Cache Wrap Up, System Control Flow CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan

More information

Virtual Memory. CS 351: Systems Programming Michael Saelee

Virtual Memory. CS 351: Systems Programming Michael Saelee Virtual Memory CS 351: Systems Programming Michael Saelee registers cache (SRAM) main memory (DRAM) local hard disk drive (HDD/SSD) remote storage (networked drive / cloud) previously: SRAM

More information

Java and C CSE 351 Spring

Java and C CSE 351 Spring Java and C CSE 351 Spring 2018 https://xkcd.com/801/ Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq

More information

Virtual Memory 3. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. P & H Chapter 5.4

Virtual Memory 3. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. P & H Chapter 5.4 Virtual Memory 3 Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University P & H Chapter 5.4 Project3 available now Administrivia Design Doc due next week, Monday, April 16 th Schedule

More information

Memory: Page Table Structure. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

Memory: Page Table Structure. CSSE 332 Operating Systems Rose-Hulman Institute of Technology Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology General address transla+on CPU virtual address data cache MMU Physical address Global memory Memory management

More information

Virtual Memory. CS 3410 Computer System Organization & Programming. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Virtual Memory. CS 3410 Computer System Organization & Programming. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Virtual Memory CS 3410 Computer System Organization & Programming [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Click any letter let me know you re here today. Instead of a DJ Clicker Question today,

More information

We made it! Java: Assembly language: OS: Machine code: Computer system:

We made it! Java: Assembly language: OS: Machine code: Computer system: We made it! C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp 0111010000011000

More information

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Use main memory as a cache for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs

More information

Virtual Memory, Address Translation

Virtual Memory, Address Translation Memory Hierarchy Virtual Memory, Address Translation Slides contents from: Hennessy & Patterson, 5ed Appendix B and Chapter 2 David Wentzlaff, ELE 475 Computer Architecture MJT, High Performance Computing,

More information

Virtual to physical address translation

Virtual to physical address translation Virtual to physical address translation Virtual memory with paging Page table per process Page table entry includes present bit frame number modify bit flags for protection and sharing. Page tables can

More information

Virtual Memory 2: demand paging

Virtual Memory 2: demand paging Virtual Memory : demand paging also: anatomy of a process Guillaume Salagnac Insa-Lyon IST Semester Fall 8 Reminder: OS duties CPU CPU cache (SRAM) main memory (DRAM) fast storage (SSD) large storage (disk)

More information

Virtual Memory, Address Translation

Virtual Memory, Address Translation Memory Hierarchy Virtual Memory, Address Translation Slides contents from: Hennessy & Patterson, 5ed Appendix B and Chapter 2 David Wentzlaff, ELE 475 Computer Architecture MJT, High Performance Computing,

More information

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan SE-292 High Performance Computing Memory Hierarchy R. Govindarajan govind@serc Reality Check Question 1: Are real caches built to work on virtual addresses or physical addresses? Question 2: What about

More information

L14: Structs and Alignment. Structs and Alignment. CSE 351 Spring Instructor: Ruth Anderson

L14: Structs and Alignment. Structs and Alignment. CSE 351 Spring Instructor: Ruth Anderson Structs and Alignment CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Lab 2 due TONIGHT

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont Lecture 16 Virtual Memory Fall 2018 Jon Beaumont http://www.eecs.umich.edu/courses/eecs470 Slides developed in part by Profs. Austin, Brehob, Falsafi, Hill, Hoe, Lipasti, Shen, Smith, Sohi, Tyson, and

More information

CSE 560 Computer Systems Architecture

CSE 560 Computer Systems Architecture This Unit: CSE 560 Computer Systems Architecture App App App System software Mem I/O The operating system () A super-application Hardware support for an Page tables and address translation s and hierarchy

More information

x86 Programming I CSE 351 Autumn 2016 Instructor: Justin Hsia

x86 Programming I CSE 351 Autumn 2016 Instructor: Justin Hsia x86 Programming I CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/409/

More information