================ Start Lecture #9
================
3.1.3: Multiprogramming with fixed partitions
- This was used by IBM for system 360 OS/MFT (multiprogramming with a
fixed number of tasks)
- Can have a single input queue instead of one for each partition
- So that if there are no big jobs can use big partition for
little jobs
- But I don't think IBM did this
- Can think of the input queue(s) as the ready list(s)
- The partition boundaries are not movable (reboot to move)
- MFT can have large internal fragmentation,
i.e. wasted space inside a region
y
- Each job has a single ``segment'' (we will discuss segments later)
- No sharing between jobs
- No dynamic address translation
- At load time must ``establish addressability''
- i.e. must get
a base register set to the location at which job was loaded (the
bottom of the partition).
- The base register is part of the programmer visible register set.
- This is address translation during load time.
- Also called relocation.
- Storage keys are adequate for protection (IBM method).
- Alternative protection method is base/limit registers.
- An advantage of base/limit is that it is easier to move a job.
- But MVT didn't move jobs.
- Tanenbaum says jobs were ``run to completion''. This must be wrong.
- He probably meant that jobs not swapped out and each queue is FCFS
without preemption.
3.2: Swapping
Moving entire jobs between disk and memory is called
swapping.
3.2.1: Multiprogramming with variable partitions
- Both the number and size of the partitions change with time.
- IBM OS/MVT (multiprogramming with a varying number of tasks).
- Also early PDP-10 OS.
- Job still has only one segment (as with MFT) but now can be of any
size.
- Single ready list.
- Job can move (might be swapped back in a different place).
- This is dynamic address translation (during run time).
- Perform an addition on every memory reference (i.e. on every
address translation)
- Called a DAT (dynamic address translation) box by IBM
- Eliminates internal fragmentation
- Find a region the exact right size (leave a hole for the
remainder
- Not quite true, can't get a piece with 10A755 bytes. Would
get say 10A750. But internal fragmentation is much
reduced compared to MFT.
- Introduces external fragmentation, holes
outside any region.
- What do you do if no hole is big enough for request?
- Can compactify
- Transition from bar 3 to bar 4 in diagram below
- This is expensive
- Not suitable for real time (MIT ping pong)
- Can swap out one process to bring in another
- Bars 5-6 and 6-7 in diagram
Homework: 4
- There are more processes than holes. Why?
- Because next to a process there might be a process or a hole
but next to a hole there must be a process
- So can have ``runs'' of processes but not of holes
- Above actually shows that there are about twice as many
processes as holes.
- Base and limit registers are used
- Storage keys not good since compactifying would require
changing many keys
- Storage keys might need a fine granularity to permit the
boundaries move by small amounts. Hence many keys would need to be
changed
MVT Introduces the ``Placement Question'', which hole (partition)
to choose
- Best fit, worst fit, first fit, circular first fit, quick fit, Buddy
- Best fit doesn't waste big holes, but does leave slivers and
is expensive to run.
- Worst fit avoids slivers, but eliminates all big holes so a
big job will require compaction. Even more expensive than best
worst fit (best fit stops if it finds a perfect fit).
- Quick fit keeps lists of some common sizes (but has other
problems, see Tanenbaum).
- Buddy system
- Round request to next highest power of two (causes
internal fragmentation)
- Look in list of blocks this size (as with quick fit)
- If list empty, go higher and split into buddies
- When returning coalesce with buddy
- Do splitting and coalescing recursively, i.e. keep
coalescing until can't and keep splitting until successful
- See Tanenbaum for more details (or an algorithms book).
- A current favorite is circular first fit (also know as next fit)
- Use the first hole that is big enough (first fit) but start
looking where you left off last time.
- Doesn't waste time constantly trying to use small holes that
have failed before, but does tend to use many of the big holes,
which can be a problem.
- Buddy comes with its own implementation. How about the others?
- Bit map
- Only question is how much memory does one bit represent.
- Big: Serious internal fragmentation
- Small: Many bits to store and process
- Linked list
- Each item on list says whether Hole or Process, length,
starting location
- The items on the list are not taken from the memory to be
used by processes
- Keep in order of starting address
- Double linked
- Boundary tag
- Knuth
- Use the same memory for list items as for processes
- Don't need an entry in linked list for blocks in use, just
the avail blocks are linked
- For the in use blocks, just need a hole/process bit at
each end and the length. Keep this in the block itself.
- See knuth, the art of computer programming vol 1
Homework: 2, 5.
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
- Cannot replace a job that is pinned,
i.e. whose memory is tied down. For example, if Direct Memory
Access (DMA) I/O is scheduled for this process, the job is pinned
until the DMA is complete.
- Victim selection is a medium term scheduling decision
- Job that has been in a wait state for a long time is a good candidate.
- Often choose as a victim a job that has been in memory for a long
time.
- Another point is how long should it stay swapped out.
- For demand paging, where swaping out a page is not as drastic as
swapping out a job, victim is an important memory management decision
and we shall study several policies