Lecture 7: Memory Management

[Pages:27]Lecture7:MemoryManagement

CSE120:PrinciplesofOpera>ngSystems

UCSanDiego:SummerSessionI,2009 FrankUyeda

Announcements

? PeerWiseques>onsduetomorrow. ? Project2isdueonFriday.

? MilestoneonTuesdaynight.

? Homework3isduenextMonday.

2

GoalsforToday

? Mo>va>onforMemoryManagement ? UnderstandPaging

? Howtotranslatefromvirtualtophysicaladdress ? Determinesize,structureofpagetables

3

MemoryManagement

? Goalsofmemorymanagement

? Provideaconvenientabstrac>onforprogramming ? Allocatescarcememoryresourcesamongcompe>ng

processes ? Maximizeperformancewithminimaloverhead

? Mechanisms

? Physicalandvirtualaddressing ? Techniques:Par>>oning,paging,segmenta>on ? Pagetablemanagement,TLBs,VMtricks

? Policies

? Pagereplacementalgorithms

4

Inthebeginning.....

? Batchprogrammedsystems

? Programsusephysical

SP

addressesdirectly ? OSloadsjob,runsit,unloadsit ? Similartowhatnachosdoes

rightnow

(you'llchangethisinProject2)

PC

PhysicalMemory

Stack

Heap DataSegment TextSegment

Opera>ngSystem

5

LettherebeMul>programming

? Mul>programmingchangesallofthis

? Wantmul>pleprocessesinmemoryatonce

? OverlapI/OandCPUofmul>plejobs

? Candoitanumberofways

? Fixedandvariablepar>>oning,paging,segmenta>on

? Requirements

? Needprotec>on?restrictwhichaddressesjobscanuse ? Fasttransla>on?lookupsneedtobefast ? Fastchanges?upda>ngmemoryhardwareoncontext

switch

6

VirtualMemory

? Thebasicabstrac>onprovidedbytheOSmemory managementisvirtualmemory

? Aprocess'saddressspaceinmemoryisnotnecessarily thesameasthephysicalmemory(RAM)addressinwhich itresides

? Whenaprocessrequestsamemoryaddress,theOSwill translatetheaddressfromavirtualaddresstoaphysical address.

7

VirtualAddresses

? Processesaccessmemoryusingavirtualaddress

? ThevirtualaddressisnotthesameasthephysicalRAMaddressinwhichitresides ? TheOS(hardwareMMU)translatesthevirtualaddressintothephysicalRAMaddress ? Whodeterminesthemappingforthetransla>on?

0xFFF.....(EndingAddress) SP

Stack

AddressSpace

Heap

DataSegment

PC 0x00.......(Star>ngAddress)

TextSegment

8

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download