0% found this document useful (0 votes)
47 views25 pages

Operating System: Memory Management Strategies

The document discusses different memory management strategies used in operating systems. It describes two main approaches: contiguous and non-contiguous allocation. Contiguous allocation allocates each process a single contiguous block of memory, while non-contiguous allocation allows parts of a process to be allocated in non-adjacent blocks. Specific strategies under these approaches include single partition, multiple partitions, paging, and segmentation. The strategies aim to improve CPU utilization by keeping multiple processes in memory simultaneously, while managing memory allocation and protection between processes.

Uploaded by

amaday shwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views25 pages

Operating System: Memory Management Strategies

The document discusses different memory management strategies used in operating systems. It describes two main approaches: contiguous and non-contiguous allocation. Contiguous allocation allocates each process a single contiguous block of memory, while non-contiguous allocation allows parts of a process to be allocated in non-adjacent blocks. Specific strategies under these approaches include single partition, multiple partitions, paging, and segmentation. The strategies aim to improve CPU utilization by keeping multiple processes in memory simultaneously, while managing memory allocation and protection between processes.

Uploaded by

amaday shwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

OPERATING SYSTEM

MEMORY MANAGEMENT STRATEGIES

J Paul Rajasingh,
Assistant Professor / CSE,
SRM Institute of Science and
Technology,
Tiruchirappalli Campus.
• Multiprogramming allows multiple processes to reside in main
memory to increase CPU utilization
• Job manager, a part of OS, manages memory between
processes efficiently
• It keeps track of which part of memory is occupied and which
part is free, allocates and deallocates memory to the processes
when needed
• It also provides mechanisms to protect memory allocated to
each process from being accessed by other processes
• To manage memory, the manager selects a number of memory
management strategies
Memory management strategies
• To improve the CPU utilization and the speed of the
computer’s response to its users, the system keeps
several processes in memory
• Due to sharing of memory, there is a need of memory
management
Strategies to manage memory are
1.Contiguous memory allocation
2.Non Contiguous memory allocation
1.Contiguous memory allocation
• Each process is allocated a single contiguous part of
memory
The memory management schemes based on this
approach are
A. Single Partition
B. Multiple partitions
2.Non Contiguous memory allocation
• Here, Parts of a single process can occupy non
contiguous physical addresses
The memory management schemes based on this
approach are
A. Paging
B. Segmentation
1.Contiguous memory allocation
A. Single Partition
• Main memory is partitioned into 2 parts.
• One of them is permanently allocated to the operating
system and the other part is allocated to the user
process
 Only 1 process can execute at a time
 When a process is to be executed, the OS loads it into
main memory for execution
• After termination of that process, the OS waits for
another process
• When that process arrives, the OS loads it into main
memory and thus overwriting the first one
Max
User
Process

Operating
System

0
Memory having single partition
Advantages:
Simplicity
It doesn’t require great expertise to understand or
use such a system
Disadvantages:
The memory is not utilized fully and a lot of
memory will be wasted in this scheme
B. Multiple partition
• A single partition scheme restricts the system to have
only 1 process in memory at a time
• This reduces the utilization of the CPU
• Monoprogramming systems are rarely used
• Today, many systems support multiprogramming
which allows multiple processes to reside in memory
at the same time
• The simplest way to achieve multiprogramming is to
divide main memory into number of partitions which
may be of fixed size or variable size
i. Fixed equal multiple partition
• In this technique, the operating system occupies the low
memory and the rest of main memory is available for user
space
• The user space is divided into fixed partitions
• The partition size are depending on operating systems
Eg: Total memory size = 6 MB, 1 MB is occupied by the OS and
the remaining 5MB is partitioned into 5 equal fixed partitions.
Jobs J1,J2,J3,J4 and J5 are to be loaded in main memory
Jobs Sizes
J1 450KB
J2 1000 KB
J3 1024 KB
J4 1500 KB
J5 500 KB
0 OS
1024
1474 J1(450) Partition 1

2048
J2(1000KB)
3048
Partition 2
3072
J3(1024)
Partition 3
4096
J5(500KB)
4596
Partition 4
5120

Partition 5
6144
Internal Fragmentation & External Fragmentation
Job is loaded in Partitionn1. The max size of partition1
is 1024KB and the size of J1is 450 KB.
So 1024 – 450 = 574 KB is wasted. This wasted
memory is called Internal Fragmentation.
There is no enough spave to load job4, as the size of
job4 is greater than all partitions.So the entire partition
(i.e partition5 ) is wasted. This wasted memory is called
‘External Fragmentation’.
Total Internal Fragmentation:
= (1024-450) +(1024-1000)+(1024-500)= 1122KB
External Fragmentation for this scheme= 1024 KB
Internal Fragmentation & External Fragmentation
A partition of main memory is wasted within a partition
is said to be Internal Fragmentation.
The wastage of an entire partition is said to be external
Fragmentation
Advantages:
1.Supports multiprogramming
2.Efficient utilization of the processor and I/O devices
3.Requires no special costly hardware
4.Simple and easy to implement
Disadvantages:
1.This scheme suffers from internal as well as external
fragmentation
2.It doesn’t require more memory than a single partition
method
3. A job partition size is limited to the size of physical
memory
Advantages:
1.Supports multiprogramming
2.Efficient utilization of the processor and I/O devices
3.Requires no special costly hardware
4.Simple and easy to implement
Disadvantages:
1.This scheme suffers from internal as well as external
fragmentation
2.It doesn’t require more memory than a single partition
method
3. A job partition size is limited to the size of physical
memory
ii. Fixed Variable partition
 In this scheme , the user space of main memory is
divided into number of partitions, but the partition
sizes are of different length
 The OS maintains a table indicating which partition of
memory are available and which are occupied
 In this scheme , the user space of main memory is
divided into number of partitions, but the partition
sizes are of different length
 The OS maintains a table indicating which partition of
memory are available and which are occupied
Job Queue
Job Size Arriv Partitions
al
Partit Size
Time
ion
J1 825 kb 10 ms
P1 700 KB
J2 600 kb 5 ms
P2 400 KB
J3 1200KB 20ms
P3 525 KB
J4 450 kb 30
P4 900 KB
J5 650 kb 15
P5 350 KB
P6 625 KB

J4 J3 J5 J1 J2
0 OS
500
J2(600KB)
1100 Partition 1

1200
1600 Partition2
J4(450KB) Partitions
2050
2125 Parti Size
J1(825KB) tion
2950 Partition 4
P1 700 KB
3025 P2 400 KB
P3 525 KB
3375 Partition5
P4 900 KB
4000 Partition6 P5 350 KB
P6 625 KB
J4 J3 J5 J1 J2
External Fragmentation
P2, P5 and P6 are totally Free in these partitions
The wasted memory is said to be External
Fragmentation
Total External Fragmentation = 400+350+625 = 1375

Total Internal Fragmentation :


=(700-600) + (525-450) + (90-825)
= 250
Doubt??
The size of J2 is 600 Kb and loaded in P1 , where IF
=100 KB.
If loaded in P6, IF = 25 KB
3 algorithms are available to answer the above questions
1.First Fit
2.Best Fit
3.Worst Fit
1.First Fit
• Allocate the partition that is big enough
• Searching can either from low memory or high
memory
• Searching is stopped as soon as a free partition which
is large enough is found
2.Best Fit
• Allocate the smallest partition that is big enough or
select a partition, which has the least internal
fragmentation
3.Worst Fit
• Select the partition which is the largest of all or select
a partition which has the maximum internal
fragmentation
Advantages:
1.This scheme supports multiprogramming
2.Efficient processor utilization and memory utilization
are possible
Disadvantages:
1.Suffers from internal and external fragmentation
2.Possible for large fragmentation

****Continues in the next ppt

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy