Grading summary, some answers.
Another possible memory management scheme, sort of a hybrid of contiguous allocation and paging, is called segmentation.
Memory is allocated for a process as a collection of segments. These segments correspond to logical units of memory in use by a process:
This can be thought of as a finer grained approach to contiguous allocation - smaller contiguous chunks, corresponding to these logical units - are scattered throughout memory.
With segmentation, a logical address consists of an ordered pair: (segment-number, offset)
A segment table contains two entries for each segment:
Two registers locate the segment table in memory:
With segmentation, segments may be relocated by moving the segment and updating the segment table. The segment number, and hence the logical addresses, remain the same.
Segment sharing is straightforward, as long as each process use the same segment number. This is required because the code in a segment uses addresses in the (segment-number, offset) format.
Allocation for the segments uses the same techniques as contiguous allocation (first-fit, best-fit), but since the chunks are smaller, there is less likelihood of some of the problems arising, though external fragmentation is there.
What's the Right Answer?
Both paging and segmentation are actually used. In fact, many systems combine them. See the text for how they are combined with MULTICS and on the Intel x86 series.
See the handout that goes with Homework 6 for more on how BSD does all this.
How might we compare strategies?
One of the primary functions of an OS is I/O management.
We will not spend much time in class going over the background - just highlights. Read Chapter 5 if you're not comfortable with some of the background.
Two common ways to connect an I/O device:
Note the presence of device controllers - hardware that connects directly to the main bus on behalf of actual devices.