lecture7 - CSCC69H Lecture 7 Dan Zingaro June 21, 2010...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCC69H Lecture 7 Dan Zingaro June 21, 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Review: Memory Management I Addresses that running programs use to identify objects can be different from addresses that the memory uses to identify storage locations I From the perspective of the processor and the executing program, addresses are a way of differentiating stored objects from one another; a naming mechanism I These are virtual addresses I From the memory’s perspective, addresses are not identifying names, but are spatial locations of storage cells I These are physical addresses
Background image of page 2
Review: Memory Management. .. I If we load one process at a time, it is conceivable that virtual addresses can equal physical addresses I But when multiple processes are loaded, they might use the same virtual addresses for their objects I It would require a lot of coordination to ensure that each process used different virtual addresses I So, virtual addresses are no longer equal to physical addresses I When a load or store operation is executed, the processor sends the virtual address to the memory management unit (MMU), which translates the virtual address to a physical address before sending it to memory
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Properties of Virtual Memory I Virtual addresses are grouped together into blocks called pages, I The function that maps (virtual) pages to (physical) page frames is represented by a table (page table) I The contents of the table are controlled by the OS I Not all virtual pages require an entry in the table; if an access is attempted on a missing page, the OS is signalled with a page fault I This prevents illegal memory accesses, but also allows demand-driven address translation I Table entries can be marked read-only (e.g. to allow sharing of memory between processes)
Background image of page 4
Example: Page Table From Hailperin, Fig. 6.10. Eight pages are mapped to four page frames. Page 0 has been allocated page frame 1, page 1 has been allocated page frame 0, and page 6 has been allocated page frame 3. 0 1 Pages 2 3 4 5 6 7 X X X X X 0 1 Page frames 2 3
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Uses for Virtual Memory I Private storage I Each process can use whatever virtual addresses it finds most convenient I Each process’ objects are protected from other processes by virtue of having its own virtual memory mappings I Assuming no two processes are allocated overlapping portions of physical memory at the same time , processes cannot interfere with one another I Of course, no user process is allowed to change the MMU
Background image of page 6
Uses for Virtual Memory. .. I Controlled Sharing I The OS can map a limited portion of physical memory into more than one process’s virtual address space I Can be used as a way for processes to communicate I e.g. map physical memory into two virtual address spaces with full read/write permissions (but user processes must be careful to use locks) I OS X has message passing: one process writes into a private block of memory and asks the OS to send the message to the other process I Receiver’s virtual memory map can be updated to point to same physical memory as sender’s message (with page marked
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/05/2011 for the course CS 69 taught by Professor Cathy during the Summer '10 term at University of Toronto- Toronto.

Page1 / 33

lecture7 - CSCC69H Lecture 7 Dan Zingaro June 21, 2010...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online