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 #7 (Feb. 19) ================


The midterm exam will be the week before spring break: Either Monday March 10 or Wednesday March 12, to be determined by class vote.

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
  2. At link-edit time (the ``linker lab'')
  3. At load time
  4. At execution time

Memory allocation techniques

Variable-length partitions

We have discussed.

Fixed partitions

Partitioning of memory is fixed.

Disadvantage (big): Massive internal fragmentation. (Wasted space within each partition).

Memory allocation is simple (put process into smallest partition that fits it.) Free list = list of empty partitions.

Variable length partitions Introduce the ``Placement Question'', which hole (partition) to choose

4.2.1: Memory Management with Bitmaps

Divide memory into blocks and associate a bit with each block, used to indicate if the corresponding block is free or allocated. To find a chunk of size N blocks need to find N consecutive bits indicating a free block.

The only design question is how much memory does one bit represent.

4.2.2: Memory Management with Linked Lists

Memory Management using Boundary Tags

MVT also introduces the ``Replacement Question'', which victim to swap out.

We will study this question more when we discuss demand paging.

Considerations in choosing a victim

  1. So far the schemes presented so far have had two properties:
    1. Each job is stored contiguously in memory. That is, the job is contiguous in physical addresses.
    2. Each job cannot use more memory than exists in the system. That is, the virtual addresses space cannot exceed the physical address space.

  2. Tanenbaum now attacks the second item. I wish to do both and start with the first.

  3. Tanenbaum (and most of the world) uses the term ``paging'' to mean what I (Gottlieb) call demand paging. This is unfortunate as it mixes together two concepts.
    1. Paging (dicing the address space) to solve the placement problem and essentially eliminate external fragmentation.
    2. Demand fetching, to permit the total memory requirements of all loaded jobs to exceed the size of physical memory.

  4. Tanenbaum (and most of the world) uses the term virtual memory as a synonym for demand paging. Again I consider this unfortunate.
    1. Demand paging is a fine term and is quite descriptive.
    2. Virtual memory ``should'' be used in contrast with physical memory to describe any virtual to physical address translation.