Memory Management

What does a process need from the MM?

  1. text: executable code... (static-ish) Typically loaded in when the program starts. Possibly shared between several processes (if thay are several instances of the same program).
  2. stack... (grows and shrinks) In most processors, starts at the top of memory and grows downwards. Stores all the local and temporary variables, and return addresses from subroutines.
  3. data: aka heap... (very dynamic) This is where the process allocates memory from. In the simplest model, this can be one contigous chunk of memory, from which the process dynamically allocates the memory it needs.
The process should not care where it is put (relocation). Should be protected from other processes. Wants to be able to share memory with other processes occasionally. Wants to be able to refer to its own big (infinite) address space.

What does the OS need from the MM?

somewhere to put processes... somewhere to put its own data structures... protection between processes, and for the OS... control... virtual memory... (deals with a finite address space + disk)

attributes of RAM

Byte-addressable. Desire to make best use of finite resource.

Allocations: Both processes and the OS often need to allocate memory (though processes typically allocate more smaller chunks). Want lots of small allocations. (Allocation & deallocation should be fast.) Allocated memory must often be contiguous (avoid fragmentation).

versus disk: named files (files are relatively big and slow & shared between programs). Each file has its own address space.


So, summary:

memory management

problems of relocation, protection, limited physical memory, resizing processes and fragmentation

partitions---base-limit registers

paging---page table, TLB

segmentation---segmentation table

also looked at actual problems of keeping track of allocated memory on a heap

la, la, la


last updated 28 February 1998