Mod-1.2
Mod-1.2
Seventh Edition
Chapter 2
Memory Management:
Simple Systems
Learning Objectives
Understanding Operating
Understanding Operating Systems,
Systems, 7e 7e 4
Introduction (cont’d.)
• This chapter introduces:
– Role of main memory (RAM)
– Four types: memory allocation schemes
• Single-user systems
• Fixed partitions
• Dynamic partitions
• Relocatable dynamic partitions
Understanding Operating
Understanding Operating Systems,
Systems, 7e 7e 5
Single-User Contiguous Scheme
• Entire program: loaded into memory
• Contiguous memory space: allocated as needed
• Jobs: processed sequentially
• Memory Manager: performs minimal work
1. Evaluates incoming process size: loads if small
enough to fit; otherwise, rejects and evaluates next
incoming process
2. Monitors occupied memory space; when process
ends, makes entire memory space available and
returns to Step 1
(table 2.1)
A simplified fixed-partition memory table with the free partition shaded.
© Cengage Learning 2014
Partition 1 = 10K
Partition 2 = 15K
Partition 3 = 20K
Partition 4 = 50K
(table 2.8)
Case 3. Original
free list before
deallocation. The
soon-to-be-free
memory block (at
location 8805) is
not adjacent to
any blocks that
are already free.
© Cengage Learning
2014
(table 2.9)
Case 3. Busy memory list before deallocation. The job to be deallocated is
of size 445 and begins at location 8805. The asterisk indicates the soon-to-
be-free memory block.
© Cengage Learning 2014
(table 2.10)
Case 3. This is the busy list after the job has released its memory. The
asterisk indicates the new null entry in the busy list.
© Cengage Learning 2014
Partition 4 50K
400k
20 Feb. 2007 OPS110S 50
Job list: Fixed partition example
J1 30K Original state After Job Entry
J2 50K 200k
J3 30K
J4 25K Job 1 (30K)
300k
Partition 2 25K Job 4 (25K) Partition 2
325k
Partition 3 25K Partition 3
350k
105K 105K
After Job 5 and Job 6 After Job 3
have entered has finished
Operating System Operating System
10K 10K
Job 5 (5K) Job 5 (5K)
15K 15K
5K free 5K free
20K 20K
Job 2 (15K) Job 2 (15K)
Job 3 ends Job 7 (10K)
35K 35K arrives
Job 3 (20K) 20K free Job 8 (30K)
arrives
55K 55K
Job 6 (30K) Job 6 (30K)
85K 85K
20K free 20K free
105K 105K
After Job 7
has entered
Operating System
Job 5 (5K) 10K
15K Job 8 has to wait,
5K free
20K even though there
Job 2 (15K) is 35K free memory.
Job 7 (10K) arrives
35K The problem is that
Job 8 (30K) arrives Job 7 (10K) Job 8 must be loaded
45K contiguously, but the
10K free
55K free memory is
Job 6 (30K) fragmented
85K
20K free
105K
Fixed Partition - First-fit Free List
Job 2 claimed the first partition large enough to
accommodate it, but by doing so it took the last
block large enough to accommodate Job 3, so Job
3 must wait, even though there is 75K of unused
memory space
Memory Partition Job Job size Status Fragment.
Job List: location Size Number
J1: 10K 10K 30K J1 10K busy 20K
J2: 20K
J3: 30K 40K 15K J4 10K busy 5K
J4: 10K
55K 50K J2 20K busy 30K