DOC PREVIEW
U of I CS 241 - Introduction to Memory Management

This preview shows page 1-2-3-20-21-22-41-42-43 out of 43 pages.

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

Unformatted text preview:

Introduction to Memory ManagementCS241 AdministrativeContentsNames and BindingSymbolic NamesLogical NamesPhysical NamesBinding Time of NamesBinding at Compile & Link timeWhat does a process look like? (Unix)Who Binds What?CompilingLinkers (Linkage editors)Loading before RunningRun-timeBinding Time Trade-offs(1)Binding Time Trade-offs(2)Binding Time Trade-offs (3)Storage HierarchySingle ProgrammingResident MonitorMultiprogrammingMultiprogramming with Fixed PartitionsFixed PartitionsSlide 25Slide 26Slide 27Slide 28Slide 29Fixed Partition Allocation Implementation IssuesRelocationRelocation RegisterQuestion 1 - ProtectionBase Bounds RegistersQuestion 2SwappingSlide 37Slide 38Slide 39Slide 40Slide 41Slide 42SummaryCS 241 Spring 2007System Programming 1Introduction to Memory Management Lecture 28Lawrence Angrave/Klara Nahrstedt2CS241 AdministrativeRead Stallings Chapter 7 & 7A about Memory Management Regular Quiz 9 this week on Memory ManagementDiscussion Sessions this week (on Memory Management – needed for LMP2)LMP2 (Long Machine Problem) starts today LMP 2 is part of three major assignments (LMP1, LMP2, LMP3) LMP2 will be split into two parts, PART I and overall LMP2 delivery. You will need to deliver PART I by Monday, April 9 and the final overall LMP2 will be due by April 16. For each delivery you will receive points. LMP2 quiz will be on April 16. The graders will provide feedback on the Part I that should assist you in the overall LMP2 delivery.3ContentsAddressing Requirements for a ProcessNames and Binding, Loading, Compiling, Run-TimeStorage hierarchySimple Programming OverlaysResident monitorMulti-ProgrammingFixed PartitioningRelocation RegisterSwapping4Names and BindingNaming = very deep theme that comes up everywhereIndirectionSymbolic names Logical names Physical namesMost used by application programmersConverted by system programmers of compilers, OS5Symbolic NamesSymbolic names: known in a context or path File namesProgram namesPrinter/device namesUser names VariablesConvenient to use/reference6Logical NamesLogical names: label a specific entity… but independent of specific physical entityInode numberJob numberMajor, minor device numbersuid, pid, gid Absolute address in program7Physical NamesPhysical names: address of entityPhysical Inode address on disk or memory (track, cylinder, …)Entry point or variable addressMemory-mapped register addressesProcess control block address Difficult to use by programmersTherefore, system software (compilers, loaders, OS) are usually the ones that convert symbolic names/logic names to physical names8Binding Time of NamesBinding: map names to locations (values)Late binding … Early bindingDifferent timesSource program (.c file)Compile timeObject module (.o file)Link timeLoad module Load timeRun-time9Binding at Compile & Link timeCreate object codegcc -c part1.cgcc -c part2.cgcc -o wowee part1.o part2.ogcc uses linker program 'ld' to link object code together.10What does a process look like? (Unix)Process address space divided into “segments” text (code), data, heap (dynamic data), and stackheapstack codeinitialized dataaddress 2^n-1address >= 011Who Binds What?Heap: constructed and layout by allocator (malloc)compiler, linker not involved other than saying where it can start namespace constructed dynamically and managed by programmer (names stored in pointers, and organized using data structures)Stack: alloc dynamic (proc call), layout by compilernames are relative off of stack pointermanaged by compiler (alloc on proc entry, dealloc on exit)linker not involved because name space entirely local: compiler has enough information to build it.Global data & code: allocation static (compiler), layout (linker)compiler emits them and can form symbolic references between them (“jalr _printf”)linker lays them out, and translates references12Compiling•Compiler:–doesn’t know where data/code should be placed in the process’s address space–assumes everything starts at zero–emits symbol table that holds the name and offset of each created object –routine/variables exported by the file are recorded global definitionglobal definition•Simpler perspective:–code is in a big char array–data is in another big char array–compiler creates (object name, index) tuple for each interesting thing–linker then merges all of these arrays40foo: call printf ret bar: … ret0foo: 0bar: 4013Linkers (Linkage editors)Unix: ldusually hidden behind compilerThree functions:collect together all pieces of a programcoalesce like segmentsfix addresses of code and data so the program can runResult: runnable program stored in new object fileWhy can’t compiler do this? Limited world view: one file, rather than all filesNote *usually*:linkers only shuffle segments, but do not rearrange their internals. E.g., instructions not reordered; routines that are never called are not removed from a.out14Loading before Running On Unix systems, read by “loader” reads all code/data segs into buffer cache; maps code (read only) and initialized data (r/w) into addr spaceOptimization opportunities:Zero-initialized data does not need to be read in.Demand load: wait until code used before get from diskCopies of same program running? Share codeMultiple programs use same routines: share code (harder)ldloaderCacheCompile time runtime15Run-timeMaps virtual addresses to physical addresses VM, overlaying, recursion, relocation16Binding Time Trade-offs(1)Early binding Compiler+ Produces efficient code+ Allows checking to be done early+ Allows estimates of running time and space- inflexible- require fixed hardware- difficult to support multiprogramming17Binding Time Trade-offs(2)Delayed binding Linker, loader + Produces efficient code+ Allows separate compilation+ Provides libraries, system interfaces+ Portability and sharing of object code+ Checking of consistency - inflexible- medium difficult to support multiprogramming18Binding Time Trade-offs (3)Late binding VM, dynamic linking and loading, overlaying, interpreting- Code less efficient- Checks must be done at run time+ Flexible+ Provides abstraction of hardware+ Allows dynamic reconfiguration19Storage HierarchyCost$400 a chip$10-4 per byte$10-8 per byte$10-9 per byteSize213 bytes227 bytes230 bytes240 bytesCPU RegCacheMemorySecondary Storage 32-64 bits4-128 words512-16k words20Single ProgrammingOverlay ManagerOverlay AreaMain ProgramOverlay 1Overlay 2Overlay 3Secondary


View Full Document

U of I CS 241 - Introduction to Memory Management

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download Introduction to Memory Management
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 Introduction to Memory Management 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 Introduction to Memory Management 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?