Memory

Disponível somente no TrabalhosFeitos
  • Páginas : 11 (2563 palavras )
  • Download(s) : 0
  • Publicado : 3 de novembro de 2012
Ler documento completo
Amostra do texto
Chapter 9: Memory Management
I Background I Swapping I Contiguous Allocation I Paging I Segmentation I Segmentation with Paging

Operating System Concepts

9.1

Silberschatz, Galvin and Gagne 2002

Background
I Program must be brought into memory and placed within

a process for it to be run.
I Input queue – collection of processes on the disk that are

waiting to be brought intomemory to run the program.
I User programs go through several steps before being

run.

Operating System Concepts

9.2

Silberschatz, Galvin and Gagne 2002

Binding of Instructions and Data to Memory
Address binding of instructions and data to memory addresses can happen at three different stages.
I Compile time: If memory location known a priori,

absolute code can be generated;must recompile code if starting location changes. I Load time: Must generate relocatable code if memory location is not known at compile time. I Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers).

Operating System Concepts

9.3Silberschatz, Galvin and Gagne 2002

Multistep Processing of a User Program

Operating System Concepts

9.4

Silberschatz, Galvin and Gagne 2002

Logical vs. Physical Address Space
I The concept of a logical address space that is bound to a

separate physical address space is central to proper memory management.
✦ Logical address – generated by the CPU; also referred to as

virtualaddress.
✦ Physical address – address seen by the memory unit.

I Logical and physical addresses are the same in compile-

time and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme.

Operating System Concepts

9.5

Silberschatz, Galvin and Gagne 2002

Memory-Management Unit (MMU)
I Hardware device that maps virtualto physical address. I In MMU scheme, the value in the relocation register is

added to every address generated by a user process at the time it is sent to memory.
I The user program deals with logical addresses; it never

sees the real physical addresses.

Operating System Concepts

9.6

Silberschatz, Galvin and Gagne 2002

Dynamic relocation using a relocation registerOperating System Concepts

9.7

Silberschatz, Galvin and Gagne 2002

Dynamic Loading
I Routine is not loaded until it is called I Better memory-space utilization; unused routine is never

loaded. I Useful when large amounts of code are needed to handle infrequently occurring cases. I No special support from the operating system is required implemented through program design.

Operating SystemConcepts

9.8

Silberschatz, Galvin and Gagne 2002

Dynamic Linking
I Linking postponed until execution time. I Small piece of code, stub, used to locate the appropriate

memory-resident library routine. I Stub replaces itself with the address of the routine, and executes the routine. I Operating system needed to check if routine is in processes’ memory address. I Dynamic linking isparticularly useful for libraries.

Operating System Concepts

9.9

Silberschatz, Galvin and Gagne 2002

Overlays
I Keep in memory only those instructions and data that are

needed at any given time.
I Needed when process is larger than amount of memory

allocated to it.
I Implemented by user, no special support needed from

operating system, programming design of overlay structureis complex

Operating System Concepts

9.10

Silberschatz, Galvin and Gagne 2002

Overlays for a Two-Pass Assembler

Operating System Concepts

9.11

Silberschatz, Galvin and Gagne 2002

Swapping
I A process can be swapped temporarily out of memory to a

backing store, and then brought back into memory for continued execution.
I Backing store – fast disk large enough to...
tracking img