1 / 12

The Abstraction: Address Spaces

The Abstraction: Address Spaces. Deoksang Kim(dskim@dcslab.snu.ac.kr) School of Computer Science and Engineering Seoul National University. Outline. Early Systems Multiprogramming Time Sharing Address Space Virtual Memory Virtualizing memory goals Summary. Early Systems. 0KB.

msheridan
Download Presentation

The Abstraction: Address Spaces

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Abstraction: Address Spaces Deoksang Kim(dskim@dcslab.snu.ac.kr) School of Computer Science and Engineering Seoul National University

  2. Outline Early Systems Multiprogramming Time Sharing Address Space Virtual Memory Virtualizing memory goals Summary

  3. Early Systems 0KB Operating System (code, data, etc.) 64KB Current Program (code, data, etc.) max Physical Memory • Building computer systems was easy • Users did not expect much • Early machines did not provide much of an abstraction to users • Physical memory • Operating System • A set of routines • One running program

  4. Multiprogramming 0KB Operating System 64KB Process A Process B I/O operation max Physical Memory Disk Machines were expensive so people began to share machines more effectively Increase the effectiveutilizationof the CPU

  5. Time Sharing • Limitations of batch computing • It is difficult to debug batch systems • If some job takes too much time (i.e. if error occurs in job then other jobs will wait for unknown time) • The notion of interactivitybecame important • Many users might be concurrently using a machine, each waiting for a timely response from their currently-executing tasks • Implementation strategy • Run one process for a short while, giving it full access to all memory

  6. Time Sharing Example 1 0KB Operating System 64KB Process B Process A Time’s up Too Slow max Physical Memory Disk

  7. Time Sharing Example 2 0KB Operating System (code, data, etc.) 64KB (free) 128KB Process C (code, data, etc.) 192KB Process B (code, data, etc.) 256KB (free) 320KB Process A (code, data, etc.) 384KB (free) 448KB (free) 512KB Physical Memory • Leave processes in memory while switching between processes • It allows the OS to implement time sharing efficiently • New demands were placed on the operating system • protection

  8. Address Space • Users require the OS to create an easy-to-use abstraction of physical memory • We call this abstraction the address space, and it is the running program’s view of memory in the system • The address space of a process contains all of the memory state of the running program • Code • It has to live in memory somewhere, and thus it is in the address space • Stack • To keep track of where program is in the function call chain as well as allocate local variables and pass parameters and return values to and from routines • Heap • It is used for dynamically-allocated and user-managed memory (e.g. malloc() in C, new in C++, JAVA) • Data, BSS, and etc.

  9. Address Space 0KB Program Code 1KB Heap 2KB (free) 15KB • When multiple threads co-exist in an address space, no nice way to divide the address space like this works anymore Stack 16KB Address Space • Code • It is static, so we can place it at the top of the address space and know that it won’t need any more space as the program runs • Heap & Stack • We place them like this because each wishes to be able to grow, and by putting them at opposite ends of the address space, we can allow such growth: they just have to grow in opposite directions

  10. Virtual memory 0KB 0KB Operating System (code, data, etc.) Program Code 64KB (free) Heap 128KB Process C (code, data, etc.) Key to virtualization of memory The OS will have to make sure physical address (free) 192KB Process B (code, data, etc.) 256KB (free) 320KB Process A (code, data, etc.) 384KB (free) Stack 448KB (free) 512KB Address Space of Process A Physical Memory • The address space is abstractionthat the OS is providing to the running program • When the OS does this, we say the OS is virtualizing memory • The running program thinks it is loaded into memory at a particular address and has a potentially very large address space

  11. Virtualizing memory goals • Transparency • The OS should implement virtual memory in a way that is invisible to the running program • The program should not be aware of the fact that memory is virtualized • The program behaves as if it has its own private physical memory • The OS and hardware do all the work to multiplex memory • Efficiency • The OS should strive to make the virtualization as efficient as possible, in terms of both time and space • In implementing time-efficient virtualization, the OS will have to rely on hardware support, including hardware features such as TLBs • Protection • The OS should make sure to protect processes from one another as well as the OS itself from processes • Protection enables us to deliver the property of isolation among processes

  12. Summary • We have seen the introduction of a virtual memory • VM system is responsible for providing the illusion of a large, sparse, private address space to programs • The OS will take each of these virtual memory references and turn them into physical address • The OS will do this for many processes at once, making sure to protect programs from one another, as well as protect the OS

More Related