Understanding Operating Systems Sixth Edition
Understanding Operating Systems Sixth Edition
Learning Objectives
After completing this chapter, you should be able to describe: The basic functionality of the three memory allocation schemes presented in this chapter: fixed partitions, dynamic partitions, relocatable dynamic partitions Best-fit memory allocation as well as first-fit memory allocation schemes How a memory list keeps track of available memory
Introduction
Management of main memory is critical Entire system performance dependent on two items
How much memory is available Optimization of memory during job processing
Fixed Partitions
Commercially available in 1950s and 1960s Main memory is partitioned
At system startup One contiguous partition per job
Requires:
Protection of the jobs memory space Matching job size with partition size
Understanding Operating Systems, Sixth Edition 7
To work well:
All jobs must be same size and memory size known ahead of time
Dynamic Partitions
Main memory is partitioned
Jobs given memory requested when loaded One contiguous partition per job
Disadvantages
Full memory utilization only during loading of first jobs Subsequent allocation: memory waste
External fragmentation: fragments between blocks
Understanding Operating Systems, Sixth Edition 11
12
14
15
16
Loop compares the size of each job to the size of each memory block
Until a block is found that is large enough to fit the job
Job stored into that block of memory Memory Manager moves out of the loop
Fetches next job from the entry queue
Understanding Operating Systems, Sixth Edition 17
Process repeats
18
19
20
21
22
Deallocation
Deallocation: freeing allocated memory space For fixed-partition system:
Straightforward process Memory Manager resets the status of jobs memory block to free upon job completion Any code may be used Example code: binary values with zero indicating free and one indicating busy
23
Deallocation (cont'd.)
For dynamic-partition system:
Algorithm tries to combine free areas of memory More complex
Memory block size changes to show its new size for the new free space
Combined total of the two free partitions Example: (200 + 5)
25
26
27
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Busy list
Must show the new locations for all of the jobs already in process that were relocated
43
Relocation register
Contains the value that must be added to each address referenced in the program Must be able to access the correct memory addresses after relocation If the program is not relocated, zero value stored in the programs relocation register
44
Compaction entails more overhead Goal: optimize processing time and memory use while keeping overhead as low as possible
Understanding Operating Systems, Sixth Edition 45
Summary
Four memory management techniques
Single-user systems, fixed partitions, dynamic partitions, and relocatable dynamic partitions
Each places severe restrictions on job size Sufficient for first three generations of computers
Understanding Operating Systems, Sixth Edition 46
Summary (cont'd.)
New modern memory management trends in late 1960s and early 1970s
Discussed in next chapter Common characteristics of memory schemes
Programs are not stored in contiguous memory Not all segments reside in memory during job execution
47