Base and Limit Registers 16384 032764 Limit register CMP 16408 16400 16396 16392 16388 16384 JMP2816384 Base register A MOV 24 20 16 12 8 JMP 240 Figure 3-3. Base and limit registers can be used to give each process a separate address space Tanenbaum, Modern Operating Systems 3 e, (c)2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639 Figure 3-3. Base and limit registers can be used to give each process a separate address space. Base and Limit Registers
Base and Limit registers a Disadvantage a Need to perform an addition and a comparison on every memory reference
Base and Limit Registers ◼ Disadvantage: ❑ Need to perform an addition and a comparison on every memory reference
Swapping Many background server processes run in the system Physical memory not large enough to hold all programs a Swapping Bring in and swap out programs a virtual memory Run programs even when they are partially in memory
Swapping ◼ Many background server processes run in the system ◼ Physical memory not large enough to hold all programs ❑ Swapping ◼ Bring in and swap out programs ❑ Virtual memory ◼ Run programs even when they are partially in memory
Swapping (1) Time MmMa MMMM MMMMMMm Vm Bma C C B B B D D D Operating Operating Operating Operating Operating Operati system system system system system system system (b) (f) (g) Figure 3-4. Memory allocation changes as processes come into memory and leave it. The shaded regions are unused memory Tanenbaum, Modern Operating Systems 3 e, (c)2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Figure 3-4. Memory allocation changes as processes come into memory and leave it. The shaded regions are unused memory. Swapping (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Swapping Problems a Addresses different as swaps in and out Static relocation/dynamic relocation a Memory holes Memory compaction 口 Require cPu time a Move 4 byes in 20ns, then 5 sec to compact 1 GB a How much memory allocate for a program Programs tend to grow Both data segment(heap)and stack
Swapping ◼ Problems ❑ Addresses different as swaps in and out ◼ Static relocation/dynamic relocation ❑ Memory holes ◼ Memory compaction ❑ Require CPU time ❑ Move 4 byes in 20ns, then 5 sec to compact 1 GB ❑ How much memory allocate for a program ◼ Programs tend to grow ◼ Both data segment (heap) and stack