NOTE: These notes are by Allan Gottlieb, and are reproduced here, with superficial modifications, with his permission. "I" in this text generally refers to Prof. Gottlieb, except in regards to administrative matters.


================ Start Lecture #9 (Feb. 25) ================

Note: The material in Lecture 9 will NOT be on the mid-term exam.

Chapter 4: Memory Management

Also called storage management or space management.

Memory management must deal with the storage hierarchy present in modern machines.

We will see in the next few lectures that there are three independent decision:

  1. Segmentation (or no segmentation)
  2. Paging (or no paging)
  3. Fetch on demand (or no fetching on demand)

Memory management implements address translation.

When is address translation performed?

  1. At compile time
    • Compiler generates physical addresses.
    • Requires knowledge of where the compilation unit will be loaded.
    • No linker.
    • Loader is trivial.
    • Primitive.
    • Rarely used (MSDOS .COM files).

  2. At link-edit time (the ``linker lab'')
    • Compiler
      • Generates relocatable addresses for each compilation unit.
      • References external addresses.
    • Linkage editor
      • Converts the relocatable addr to absolute.
      • Resolves external references.
      • Misnamed ld by unix.
      • Also converts virtual to physical addresses by knowing where the linked program will be loaded. Linker lab ``does'' this, but it is trivial since we assume the linked program will be loaded at 0.
    • Loader is still trivial.
    • Hardware requirements are small.
    • A program can be loaded only where specified and cannot move once loaded.
    • Not used much any more.

  3. At load time
    • Similar to at link-edit time, but do not fix the starting address.
    • Program can be loaded anywhere.
    • Program can move but cannot be split.
    • Need modest hardware: base/limit registers.
    • Loader sets the base/limit registers.

  4. At execution time
    • Addresses translated dynamically during execution.
    • Hardware needed to perform the virtual to physical address translation quickly.
    • Currently dominates.
    • Much more information later.

Extensions

Note: I will place ** before each memory management scheme.

4.1: Basic Memory Management (Without Swapping or Paging)

Entire process remains in memory from start to finish and does not move.

The sum of the memory requirements of all jobs in the system cannot exceed the size of physical memory.

** 4.1.1: Monoprogramming without swapping or paging (Single User)

The ``good old days'' when everything was easy.

**4.1.2: Multiprogramming with fixed partitions

The goal of multiprogramming is to improve CPU utilization, by overlapping CPU and I/O.

4.1.3: Modeling Multiprogramming

4.1.4: Analysis of Multiprogramming System Performance

Skipped

Relocation and Protection

Relocation was discussed as part of linker lab and at the beginning of this chapter. When done dynamically, a simple means is to have a base register whose value is added to every address by the hardware.

Similarly a limit register is checked by the hardware to be sure that the address (before the base register is added) is not bigger than the size of the program.

The base and limit register are set by the OS when the job starts.

4.2: Swapping

Moving entire processes between disk and memory is called swapping.

Multiprogramming with Variable Partitions

Homework: 3