You are on page 1of 17

MEMORY

MANAGEMENT
MODULE 3
EARLY SYSTEMS
Fixed Partition (Static) Scheme
Supports multi-programming within the available memory space.
The main memory is divided into blocks of memory known as
partitions. Each job is allocated a partition (one partition for each job).
Each partition is of fixed size and if any job exceed the partition sizes,
then the program cannot be executed.
Performs more steps as compared to Single-user scheme because the
size of the job needs to be less than or equal to the size of the available
partitions to ensure that the job completely fits into partition.
Fixed Partition (Static) Scheme
Advantages:
More flexible because it supports multi-programming allowing several programs
to be in the memory at the same time.
The jobs in other partitions are prevented from overriding the boundaries of the
other jobs.
Each partition is protected by partition intrusion. Once a partition was assigned to
a job, no other job could be allowed to enter its boundaries.
Disadvantages:
Once the system was in operation, the partition sizes remained static. The
system needs to be shutdown to re-configure the sizes of partitions.
If the job size is greater than the size of memory partition, then job cannot be
loaded, thus the execution is not possible.
If the partition sizes are too big, memory is wasted.
As in single-user scheme, the remaining space in each partition is unused. Hence,
internal fragmentation occurs in this scheme.
Requires the entire program be stored contiguously.
Fixed Partition (Static) Scheme
Allocation Placement Algorithms:
 First-fit
 Best Fit
 Worst Fit
 Next Fit
Fixed Partition (Static) Scheme
Allocation Placement Algorithms:

First-fit: Allocate the first free partition that is big enough to


accommodate the process.
Advantages:
▪ Organized by memory location (low-order to high-order).
▪ Faster in making the allocation.
Disadvantages:
▪ The remaining unused memory areas left after allocation is
wasted especially if the job size is too small.
▪ Thus, request for larger memory requirement cannot be
accomplished.
Fixed Partition (Static) Scheme
Allocation Placement Algorithms:

Best-fit: Allocate the smallest free partition that is big


enough.
Advantages:
▪ Memory utilization is much better as it is ordered by size
(smallest to largest).
▪ Produces the smallest leftover partition.
▪ Makes best use of memory.
Disadvantages:
▪ It is slower and may even tend to fill up memory with tiny
useless holes.
Fixed Partition (Static) Scheme
Allocation Placement Algorithms:

Worst-fit: Allocate the largest free partition that is big


enough.
Advantages:
▪ Reduces the rate of production of small gaps.
Disadvantages:
▪ If a process requiring larger memory arrives at a later stage
then it cannot be accommodated as the largest hole is
already split and occupied.
Fixed Partition (Static) Scheme
Allocation Placement Algorithms:

Next-fit: A modified version of first fit. It begins as first fit


to find a free partition. When called next time, it starts
searching from where it left off, not from the beginning.
Advantages:
▪ Faster in making the allocation.
▪ No searching of free partition from the beginning.
Disadvantages:
▪ No consideration for the big sized fragment that will occurs.
Example1: Fixed Partition (Static) Scheme

Job List:
Job1 40k
Job2 50k
Job3 30k waiting
Job4 20k
Memory Partition Size Job Allocation
FIRST FIT
OS Partition 10k OS

Job1 (40k)
Partition 1 100k 1

Job4 (20k)
Partition 2 25k 3

Partition 3 25k

Partition 4 50k Job2 (50k) 2


Fixed Partition (Static) Scheme:
In order to allocate memory spaces to jobs, the memory
manager must keep a table which shows:

• Each partition size,


• Its memory address,
• Its access restrictions (jobs)
• Its current status (free or busy).
As each job terminates, the status of its memory partition is
changed from busy to free so an incoming job can be
assigned to that partition.
Example2: Fixed Partition (Static) Scheme - FIRST FIT
The first set of jobs is efficiently allocated an individual allocations, but the next set
of allocation creates an empty partition.

Job List:
Job1 50k
Memory Partition Size Jobs Allocation
Job2 40k
Job3 20k OS Partition 10k OS OS OS
Job4 20k
Job5 20k Partition 1 60k Job1 (50k) Job5 (20k)

Partition 2 100k Job2 (40k) Job2 (40k) Job2 (40k)

Partition 3 120k Job3 (20k) Job3 (20k) Job3 (20k)

Partition 4 140k Job4 (20k) Job4 (20k) Job4 (20k)


Allocation of
after Job1 After Job5 is
memory for first
finished loaded
set of jobs
Example3:
FIRST – FIT Exercise:
Job List in k-unit Show the allocation and deallocation of partitions for
each set of jobs. For each deallocation, consider freeing
Job 1 40 Job 6 60
the two partitions for the 2 smallest jobs.
Job 2 50 Job 7 10
Job 3 35 Job 8 15
Job 4 20 Job 9 45
Job 5 25 Job 10 30

Partition
Memory Jobs Allocation
Size
OS Partition 20k OS OS OS OS OS OS OS OS OS OS

Partition 1 25k

Partition 2 75k

Partition 3 50k

Partition 4 30k

Set 1 Deallocation Set 2 Deallocation Set 3 Deallocation Set 4 Deallocation Set 5 Deallocation
FIRST – FIT Exercise – SOLUTION:
Job List in k-unit Show the allocation and deallocation of partitions for
each set of jobs. For each deallocation, consider freeing
Job 1 40 Job 6 60
the two partitions for the 2 smallest jobs.
Job 2 50 Job 7 10
Job 3 35 Job 8 15
Job 4 20 Job 9 45
Job 5 25 Job 10 30

Memory Partition Size Jobs Allocation

OS Partition 20k OS OS OS OS OS OS OS OS OS OS

Partition 1 25k Job 4 (20k) Job 7 (10k)

Partition 2 75k Job 1 (40k) Job 1 (40k) Job 1 (40k) Job 1 (40k) Job 1 (40k) Job 3 (35k) Job 6 (60k)

Partition 3 50k Job 2 (50k) Job 2 (50k) Job 2 (50k) Job 2 (50k) Job 2 (50k) Job 2 (50k) Job 2 (50k) Job 9 (45k)

Partition 4 30k Job 5 (25k) Job 8 (15k) Job 10 (30k)

Set 1 Deallocation Set 2 Deallocation Set 3 Deallocation Set 4 Deallocation Set 5 Deallocation
M3: ACT1 FIRST – FIT
Job List in k-unit Show the allocation and deallocation of partitions for
each set of jobs. For each deallocation, consider freeing
Job 1 45 Job 6 50
the two partitions for the 2 smallest jobs. Provide your
Job 2 50 Job 7 15 conclusion.
Job 3 35 Job 8 20
Job 4 20 Job 9 40
Job 5 25 Job 10 30

Partition
Memory Jobs Allocation
Size
OS Partition 20k OS OS OS OS OS OS OS OS OS OS

Partition 1 40k

Partition 2 40k

Partition 3 40k

Partition 4 40k

Set 1 Deallocation Set 2 Deallocation Set 3 Deallocation Set 4 Deallocation Set 5 Deallocation
PL-ACT6: Fixed Partition Scheme (FIRST – FIT)
1. Display the activity title and your name.
2. Input the following: (in M unit)
◦ Memory size
◦ OS size
◦ No. of Partitions
◦ Individual Memory Partition sizes
◦ No. of Jobs
◦ Individual Job sizes
3. Display the job list for n input jobs.
4. Display the memory structure after loading OS, the OS and the partitions with the
corresponding sizes.
5. Allocate and deallocate the memory for jobs in sequence using FIRST – FIT
placement algorithm. Display the memory structure for each set of allocation and
deallocation at a time. Consider an appropriate message/alert, if necessary.
6. Provide your conclusions.

You might also like