Unit-III Updated
Unit-III Updated
21BTIS501-Operating System
Unit - III
Memory Management
AY 2024-2025 SEM-II
1
MIT School of Computing
Department of Computer Science & Engineering
Unit-IV Syllabus
2
MIT School of Computing
Department of Computer Science & Engineering
PLD
7
MIT School of Computing
Department of Computer Science & Engineering
Advantages of Swapping
8
MIT School of Computing
Department of Computer Science & Engineering
Disadvantages of Swapping
• Performance Overhead
• Storage Overhead
• Data Integrity Issues
• Increased Disk Activity
9
MIT School of Computing
Department of Computer Science & Engineering
12
MIT School of Computing
Department of Computer Science & Engineering
13
MIT School of Computing
Department of Computer Science & Engineering
15
MIT School of Computing
Department of Computer Science & Engineering
17
MIT School of Computing
Department of Computer Science & Engineering
18
MIT School of Computing
Department of Computer Science & Engineering
Memory Allocation
• Memory allocation is a process by which
computer programs are assigned memory or
space.
• Here, main memory is divided into two types
of partitions
1. Low Memory – Operating system resides in
this type of memory.
2. High Memory– User processes are held in
high memory.
19
MIT School of Computing
Department of Computer Science & Engineering
Partition Allocation
• Memory is divided into different blocks or
partitions.
• Each process is allocated according to the
requirement.
• Partition allocation is an ideal method to
avoid internal fragmentation.
20
MIT School of Computing
Department of Computer Science & Engineering
Partition Allocation
• Below are the various partition allocation
schemes :
1. First Fit: In this type fit, the partition is
allocated, which is the first sufficient block
from the beginning of the main memory.
2. Best Fit: It allocates the process to the
partition that is the first smallest partition
among the free partitions.
21
MIT School of Computing
Department of Computer Science & Engineering
Partition Allocation
22
MIT School of Computing
Department of Computer Science & Engineering
23
MIT School of Computing
Department of Computer Science & Engineering
24
MIT School of Computing
Department of Computer Science & Engineering
25
MIT School of Computing
Department of Computer Science & Engineering
26
MIT School of Computing
Department of Computer Science & Engineering
28
MIT School of Computing
Department of Computer Science & Engineering
30
MIT School of Computing
Department of Computer Science & Engineering
31
MIT School of Computing
Department of Computer Science & Engineering
35
MIT School of Computing
Department of Computer Science & Engineering
36
MIT School of Computing
Department of Computer Science & Engineering
37
MIT School of Computing
Department of Computer Science & Engineering
38
MIT School of Computing
Department of Computer Science & Engineering
39
MIT School of Computing
Department of Computer Science & Engineering
40
MIT School of Computing
Department of Computer Science & Engineering
41
MIT School of Computing
Department of Computer Science & Engineering
43
MIT School of Computing
Department of Computer Science & Engineering
46
MIT School of Computing
Department of Computer Science & Engineering
47
MIT School of Computing
Department of Computer Science & Engineering
Allocation of frames in OS
• The main memory of the system is divided into frames.
• The OS has to allocate a sufficient number of frames for
each process and to do so, the OS uses various algorithms.
• The five major ways to allocate frames are as follows:
1. Proportional frame allocation
2. Priority frame allocation
3. Global replacement allocation
4. Local replacement allocation
5. Equal frame allocation
48
MIT School of Computing
Department of Computer Science & Engineering
Allocation of frames in OS
49
MIT School of Computing
Department of Computer Science & Engineering
50
MIT School of Computing
Department of Computer Science & Engineering
51
MIT School of Computing
Department of Computer Science & Engineering
52
MIT School of Computing
Department of Computer Science & Engineering
53
MIT School of Computing
Department of Computer Science & Engineering
54
MIT School of Computing
Department of Computer Science & Engineering
What is Fragmentation?
• Processes are stored and removed from memory, which
creates free memory space, which are too small to use by
other processes.
• After sometimes, that processes not able to allocate to
memory blocks because its small size and memory blocks
always remain unused is called fragmentation.
• This type of problem happens during a dynamic memory
allocation system when free blocks are quite small, so it is
not able to fulfill any request.
55
MIT School of Computing
Department of Computer Science & Engineering
What is Fragmentation?
• Two types of Fragmentation methods are:
1. External fragmentation
External fragmentation can be reduced by rearranging
memory contents to place all free memory together in a
single block.
2. Internal fragmentation
The internal fragmentation can be reduced by assigning
the smallest partition, which is still good enough to
carry the entire process.
56
MIT School of Computing
Department of Computer Science & Engineering
58
MIT School of Computing
Department of Computer Science & Engineering
59
MIT School of Computing
Department of Computer Science & Engineering