CS 321 Spring 2013  >  Lecture Notes for Monday, February 25, 2013

CS 321 Spring 2013
Lecture Notes for Monday, February 25, 2013

Memory Abstraction

Concepts

An address in a machine-language program is a logical address. A location on a memory chip is a physical address. Conversion between the two is address translation. There may also be swapping of portions of memory out to storage.

No Memory Abstraction

Logical addresses are physical addresses. Simple, but processes are very limited by the amount of memory they can obtain. Also, code needs to be relocatable: able to be loaded and executed at any location in memory.

Simple Address Space

Associated with each process are two values, which are stored in registers while the process is executing. The base register holds the physical location of the start of the process’s address space. The limit register holds the size of the process’s address space.

A logical address is checked to see if it is greater than or equal to the limit value. If it is, then it is an illegal address. If it is not, then it is a legal address; we convert the logical address to a physical address by adding the base value to it. All this is generally done transparently in hardware.

Thus, each process’s address space begins at logical address zero. This creates the appearance that each process has access to the entire memory space of a machine. A process’s address space can be swapped out to storage. Thus, the total amount of memory allotted for all processes can be greater than the size of physical memory. Also, a process’s address space can be relocated. Memory can be compacted, if necessary, to allow for the creation of a large contiguous region for new address spaces.

However, with this abstraction, memory cannot be swapped at any level more fine-grained than the process address space. So a single address space cannot exceed the size of physical memory. Also, it can be difficult to expand a process’s address space; other processes may need to be reallocated. Thus, when using this method, we prefer that a process requests all the memory it will need when it first starts.

Preview: Modern Virtual Memory

Later we will study a third memory abstraction: modern virtual memory. Here, memory is allotted to processes at a more fine-grained level: the page. (A page might be 4K, for example.) Memory can be swapped to storage and relocated at the page level.


CS 321 Spring 2013: Lecture Notes for Monday, February 25, 2013 / Updated: 6 May 2013 / Glenn G. Chappell / ggchappell@alaska.edu