SlideShare a Scribd company logo
2
Most read
13
Most read
20
Most read
(BSc. Computer Science)
RIVERS STATE UNIVERSITY
Port Harcourt
MEMORY FRAGMENTATION
Memory fragmentation is when most of your
memory is allocated in a large number of non-
contiguous blocks, or chunks - leaving a good
percentage of your total memory unallocated, but
unusable.
3 FORMS OF FRAGMENTATION
1. Internal Fragmentation
2. External Fragmentation
3. Data Fragmentation
INTERNAL FRAGMENTATION
Due to the rules governing memory allocation, more
computer memory is sometimes allocated than is
needed.
EXTERNAL FRAGMENTATION
External fragmentation arises when free memory is
separated into small blocks and is interspersed by
allocated memory.
DATA FRAGMENTATION
Data fragmentation occurs when a collection of
data in memory is broken up into many pieces that
are not close together.
TWO MEMORY PARTITION TO ILLUSTRATE
MEMORY FRAGMENTATION
• FIXED PARTITION
• DYNAMIC PARTITION
FIXED PARTITION
In fixed partition, any program no matter how small occupies an
entire partition. A program whose length is 4MB; yet occupies an
8MB partition when ever it is swapped in.
The use of unequal size partition to reduce
(not eliminate) the amount of wasted
space.
HOW TO SOLVE THIS KIND OF FRAGMENTATION
O.S
8MB
8MB
8MB
8MB
8MB
8MB
8MB
O.S
8MB
6MB
8MB
4MB
16MB
8MB
14MB
Fig. 1.1 An illustration of two types of Fixed Memory Partition
(a) Equal size Partition (b) Unequal size Partition
DYNAMIC FRAGMENTATION
In dynamic partition, the partition are of various length and
numbers. Processes are allocated exactly as much memory as it
require or more. External fragmentation is caused by dynamic
partition.
The figure below will further explain the dynamic
partition. How allocation of memory dynamically
fragments the memory living smaller piece of memory
that can’t be used or unusable.
Memory compaction is used to reduce (not eliminate) the
amount of wasted space.
HOW TO SOLVE THIS KIND OF FRAGMENTATION
Operating
System
8MB
Operating
System
8MB
Process 1 20MB
Operating
System
8MB
Process 1 20MB
Process 2 14MB
22MB
Operating
System 8MB
Process 1 20MB
Proces
s 2
8MB
Process 3 18MB
Operating
System 8MB
Process 1
Process 3
Operating
System 8MB
Process 1
Process 2
Process 3
20MB
18MB
20MB
14MB
18MB
Hole 1Hole 1Hole 1
Swapped 14MB
56MB
36MB
(a) (b) (c)
(f)(e)(d)
Process 4
6MBHole 1
4MB4MB 4MB
DYNAMIC FRAGMENTATION ILLUSTRATION
(f)(e)
Operating
System
8MB
20MB
8MB
Process 3 18MB
Process 4
6MBHole 2
Hole 1
Swapped
Operating
System
8MB
14MB
8MB
Process 3 18MB
Process 4
6MBHole 2
Hole 1
Fig. 1.2: Effect of dynamic partitioning
6MB
4MB 4MB
Process 2
Hole 3
DYNAMIC FRAGMENTATION ILLUSTRATION (CONT.)
 Process 2 in the ready suspended state is available.
 No sufficient memory for process 2 the OS swaps process 1 out (g).
 Process 2 is swap back in (h). Leaving another hole.
 The first three processes (b, c, d) are loaded in from the end of the OS leaving a
hole at the end.
 At some point no process is ready.
 OS swaps out process 2 (e) leaving sufficient room for process 4 (f)
 Process 4 is smaller than process 2 therefore a hole is created.
 None of the process is in main memory is ready.
THE FIG. 1.2 ABOVE IS AN ILLUSTRATION SHOWING THE EFFECTS OF
DYNAMIC PARTITION USING A 64MB OF MAIN MEMORY. INITIALLY, MAIN
MEMORY IS EMPTY EXCEPT FOR THE OPERATING SYSTEM THAT IS LOADED
IN (A).
AN ILLUSTRATION OF FRAGMENTATION
USING PLACEMENT ALGORITHM
 FIRST – FIT
 BEST – FIT
 NEXT - FIT
FIRST – FIT
This algorithm begins to scan memory from the beginning and choose the first available block that
is large enough to fit in a process or program.
 BEST – FIT
This algorithm scans through the memory from the beginning to the end and choose the block that
is closest in size to the request.
 NEXT – FIT
This algorithm begins to scan the memory from the location of last placement and choose the next
available block that is large enough.
In satisfying a 16MB allocation request in fig. 1.3
 First – fit scans the memory and fit in a 22MB space leaving a 6MB hole.
 Best – fit results in a 2MB fragment or hole in main memory.
 Next – fit result in a 20MB fragment in main memory.
Fig. 1.3 (a) shows a number of placement and swapping out that has been done with
fragments of different sizes. While fig. 1.3 (b) show first -, best -, and next – fit placements.
8MB
12MB
22MB
18MB
8MB
6MB
14MB
36MB
8MB
12MB
6MB
2MB
8MB
6MB
14MB
20MB
Fig. 1.3: An example of memory configuration before and after allocation of 16MB block.
(a) After a number of placement
and swapping out.
(b) After a number of
placement and
swapping out.
First - fit
Best - fit
Next - fit
Allocated Block
Possible New Allocation
Free Block
16MB Block
MEMORY FRAGMENTATION PROBLEM
1. Allocation failure
The most severe problem caused by fragmentation is causing a process or system
to fail, due to premature resource exhaustion: if a contiguous allocation is needed and
cannot be satisfied, failure occurs.
2. Performance degradation
Fragmentation causes performance degradation for a number of reasons. Most basically,
fragmentation increases the work required to allocate and access a resource.
3. Prematurely exhaustion of a cache, causing thrashing, due to cache holding block, not
individual data.
4. Memory fragmentation may lead to complete loss of (application usable) free memory.
5. Memory fragmentation can lead to system crashes or other instability.
REFERENCES
https://en.wiki/fragmentation_(computing)
William Stalling, Operating System: Internal and Design Principle, Sixth Edition
Published by Dorling Kinglersly, India 2009.

More Related Content

PPT
Ch02 early system memory management
Jacob Cadeliña
 
PPT
Memory management early_systems
Mybej Che
 
PPTX
First fit , Best fit, Worst fit
Shahzeb Amjad
 
PDF
Disk allocation methods
ajeela mushtaq
 
PPTX
Unit 4-Memory Management - operating systems.pptx
amaira7348
 
PPTX
Fragmentaton
sanjana mun
 
PPTX
Virtual Memory
sanjana mun
 
PPT
Contiguous Memory Allocation.ppt
infomerlin
 
Ch02 early system memory management
Jacob Cadeliña
 
Memory management early_systems
Mybej Che
 
First fit , Best fit, Worst fit
Shahzeb Amjad
 
Disk allocation methods
ajeela mushtaq
 
Unit 4-Memory Management - operating systems.pptx
amaira7348
 
Fragmentaton
sanjana mun
 
Virtual Memory
sanjana mun
 
Contiguous Memory Allocation.ppt
infomerlin
 

What's hot (20)

PPTX
Database recovery
Vritti Malhotra
 
PDF
Resource management
Dr Sandeep Kumar Poonia
 
PPTX
INSTRUCTION LEVEL PARALLALISM
Kamran Ashraf
 
PDF
Memory management
Rajni Sirohi
 
PDF
Code optimization in compiler design
Kuppusamy P
 
PPTX
Demand paging
Trinity Dwarka
 
PPTX
Computer architecture page replacement algorithms
Mazin Alwaaly
 
PPT
File access methods.54
myrajendra
 
PPTX
Code generation
Aparna Nayak
 
PPTX
Demand paging
SwaroopSorte
 
PDF
Address Binding Scheme
Rajesh Piryani
 
PPTX
File system structure
sangrampatil81
 
PDF
DBMS Unit - 3 - Relational query languages
Gyanmanjari Institute Of Technology
 
PPTX
System Programming Unit II
Manoj Patil
 
PPTX
MACRO PROCESSOR
Bhavik Vashi
 
PPTX
Instruction pipeline: Computer Architecture
InteX Research Lab
 
PPTX
Context switching
DarakhshanNayyab
 
PPTX
Micro Programmed Control Unit
Kamal Acharya
 
PDF
Processor Organization and Architecture
Vinit Raut
 
PDF
Token, Pattern and Lexeme
A. S. M. Shafi
 
Database recovery
Vritti Malhotra
 
Resource management
Dr Sandeep Kumar Poonia
 
INSTRUCTION LEVEL PARALLALISM
Kamran Ashraf
 
Memory management
Rajni Sirohi
 
Code optimization in compiler design
Kuppusamy P
 
Demand paging
Trinity Dwarka
 
Computer architecture page replacement algorithms
Mazin Alwaaly
 
File access methods.54
myrajendra
 
Code generation
Aparna Nayak
 
Demand paging
SwaroopSorte
 
Address Binding Scheme
Rajesh Piryani
 
File system structure
sangrampatil81
 
DBMS Unit - 3 - Relational query languages
Gyanmanjari Institute Of Technology
 
System Programming Unit II
Manoj Patil
 
MACRO PROCESSOR
Bhavik Vashi
 
Instruction pipeline: Computer Architecture
InteX Research Lab
 
Context switching
DarakhshanNayyab
 
Micro Programmed Control Unit
Kamal Acharya
 
Processor Organization and Architecture
Vinit Raut
 
Token, Pattern and Lexeme
A. S. M. Shafi
 
Ad

Similar to Memory fragmentation by ofor williams daniel (20)

PPT
memory mgmt.ppt
Albin562191
 
PDF
DB ppt OS unit - 3.pdf
DBharathi8
 
PPTX
FRAGMENTATION final impotant topic .pptx
vithalChoudhary
 
PPTX
Memory management in system software.pptx
HarmanjitSingh62
 
PDF
Memory Management
DEDE IRYAWAN
 
PPT
Pratima fragmentation
Pratima Sharma
 
PDF
chapter2-OS.pdf
MuhammedAyman10
 
PDF
Lect13
Vin Voro
 
PDF
Lect13
Vin Voro
 
PPTX
Memory Management in OS
Kumar Pritam
 
PDF
07-MemoryManagement.ppt
hello509579
 
PPTX
Operating Systems: Memory Management
Damian T. Gordon
 
PDF
Analysis of Allocation Algorithms in Memory Management
ijtsrd
 
PPTX
Memory Management
SanthiNivas
 
PPTX
Memory management1
rizwanaabassi
 
PPTX
memory management IN OS ANURAG PATE.pptx
SHARMA ONLINE
 
PPTX
memorymanagement-2112140500ygyftftt34.pptx
bishalnandi2
 
PDF
Fragmentation
A. S. M. Shafi
 
PPTX
memory-management-early-systems in BS INFORMATION TECHNOLOGY
SyvilMaeTapinit
 
PDF
Operating system 3
Prof. Dr. K. Adisesha
 
memory mgmt.ppt
Albin562191
 
DB ppt OS unit - 3.pdf
DBharathi8
 
FRAGMENTATION final impotant topic .pptx
vithalChoudhary
 
Memory management in system software.pptx
HarmanjitSingh62
 
Memory Management
DEDE IRYAWAN
 
Pratima fragmentation
Pratima Sharma
 
chapter2-OS.pdf
MuhammedAyman10
 
Lect13
Vin Voro
 
Lect13
Vin Voro
 
Memory Management in OS
Kumar Pritam
 
07-MemoryManagement.ppt
hello509579
 
Operating Systems: Memory Management
Damian T. Gordon
 
Analysis of Allocation Algorithms in Memory Management
ijtsrd
 
Memory Management
SanthiNivas
 
Memory management1
rizwanaabassi
 
memory management IN OS ANURAG PATE.pptx
SHARMA ONLINE
 
memorymanagement-2112140500ygyftftt34.pptx
bishalnandi2
 
Fragmentation
A. S. M. Shafi
 
memory-management-early-systems in BS INFORMATION TECHNOLOGY
SyvilMaeTapinit
 
Operating system 3
Prof. Dr. K. Adisesha
 
Ad

Recently uploaded (20)

PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 

Memory fragmentation by ofor williams daniel

  • 1. (BSc. Computer Science) RIVERS STATE UNIVERSITY Port Harcourt
  • 2. MEMORY FRAGMENTATION Memory fragmentation is when most of your memory is allocated in a large number of non- contiguous blocks, or chunks - leaving a good percentage of your total memory unallocated, but unusable.
  • 3. 3 FORMS OF FRAGMENTATION 1. Internal Fragmentation 2. External Fragmentation 3. Data Fragmentation
  • 4. INTERNAL FRAGMENTATION Due to the rules governing memory allocation, more computer memory is sometimes allocated than is needed.
  • 5. EXTERNAL FRAGMENTATION External fragmentation arises when free memory is separated into small blocks and is interspersed by allocated memory.
  • 6. DATA FRAGMENTATION Data fragmentation occurs when a collection of data in memory is broken up into many pieces that are not close together.
  • 7. TWO MEMORY PARTITION TO ILLUSTRATE MEMORY FRAGMENTATION • FIXED PARTITION • DYNAMIC PARTITION
  • 8. FIXED PARTITION In fixed partition, any program no matter how small occupies an entire partition. A program whose length is 4MB; yet occupies an 8MB partition when ever it is swapped in.
  • 9. The use of unequal size partition to reduce (not eliminate) the amount of wasted space. HOW TO SOLVE THIS KIND OF FRAGMENTATION
  • 10. O.S 8MB 8MB 8MB 8MB 8MB 8MB 8MB O.S 8MB 6MB 8MB 4MB 16MB 8MB 14MB Fig. 1.1 An illustration of two types of Fixed Memory Partition (a) Equal size Partition (b) Unequal size Partition
  • 11. DYNAMIC FRAGMENTATION In dynamic partition, the partition are of various length and numbers. Processes are allocated exactly as much memory as it require or more. External fragmentation is caused by dynamic partition. The figure below will further explain the dynamic partition. How allocation of memory dynamically fragments the memory living smaller piece of memory that can’t be used or unusable.
  • 12. Memory compaction is used to reduce (not eliminate) the amount of wasted space. HOW TO SOLVE THIS KIND OF FRAGMENTATION
  • 13. Operating System 8MB Operating System 8MB Process 1 20MB Operating System 8MB Process 1 20MB Process 2 14MB 22MB Operating System 8MB Process 1 20MB Proces s 2 8MB Process 3 18MB Operating System 8MB Process 1 Process 3 Operating System 8MB Process 1 Process 2 Process 3 20MB 18MB 20MB 14MB 18MB Hole 1Hole 1Hole 1 Swapped 14MB 56MB 36MB (a) (b) (c) (f)(e)(d) Process 4 6MBHole 1 4MB4MB 4MB DYNAMIC FRAGMENTATION ILLUSTRATION
  • 14. (f)(e) Operating System 8MB 20MB 8MB Process 3 18MB Process 4 6MBHole 2 Hole 1 Swapped Operating System 8MB 14MB 8MB Process 3 18MB Process 4 6MBHole 2 Hole 1 Fig. 1.2: Effect of dynamic partitioning 6MB 4MB 4MB Process 2 Hole 3 DYNAMIC FRAGMENTATION ILLUSTRATION (CONT.)
  • 15.  Process 2 in the ready suspended state is available.  No sufficient memory for process 2 the OS swaps process 1 out (g).  Process 2 is swap back in (h). Leaving another hole.  The first three processes (b, c, d) are loaded in from the end of the OS leaving a hole at the end.  At some point no process is ready.  OS swaps out process 2 (e) leaving sufficient room for process 4 (f)  Process 4 is smaller than process 2 therefore a hole is created.  None of the process is in main memory is ready. THE FIG. 1.2 ABOVE IS AN ILLUSTRATION SHOWING THE EFFECTS OF DYNAMIC PARTITION USING A 64MB OF MAIN MEMORY. INITIALLY, MAIN MEMORY IS EMPTY EXCEPT FOR THE OPERATING SYSTEM THAT IS LOADED IN (A).
  • 16. AN ILLUSTRATION OF FRAGMENTATION USING PLACEMENT ALGORITHM  FIRST – FIT  BEST – FIT  NEXT - FIT
  • 17. FIRST – FIT This algorithm begins to scan memory from the beginning and choose the first available block that is large enough to fit in a process or program.  BEST – FIT This algorithm scans through the memory from the beginning to the end and choose the block that is closest in size to the request.  NEXT – FIT This algorithm begins to scan the memory from the location of last placement and choose the next available block that is large enough. In satisfying a 16MB allocation request in fig. 1.3  First – fit scans the memory and fit in a 22MB space leaving a 6MB hole.  Best – fit results in a 2MB fragment or hole in main memory.  Next – fit result in a 20MB fragment in main memory. Fig. 1.3 (a) shows a number of placement and swapping out that has been done with fragments of different sizes. While fig. 1.3 (b) show first -, best -, and next – fit placements.
  • 18. 8MB 12MB 22MB 18MB 8MB 6MB 14MB 36MB 8MB 12MB 6MB 2MB 8MB 6MB 14MB 20MB Fig. 1.3: An example of memory configuration before and after allocation of 16MB block. (a) After a number of placement and swapping out. (b) After a number of placement and swapping out. First - fit Best - fit Next - fit Allocated Block Possible New Allocation Free Block 16MB Block
  • 19. MEMORY FRAGMENTATION PROBLEM 1. Allocation failure The most severe problem caused by fragmentation is causing a process or system to fail, due to premature resource exhaustion: if a contiguous allocation is needed and cannot be satisfied, failure occurs. 2. Performance degradation Fragmentation causes performance degradation for a number of reasons. Most basically, fragmentation increases the work required to allocate and access a resource. 3. Prematurely exhaustion of a cache, causing thrashing, due to cache holding block, not individual data. 4. Memory fragmentation may lead to complete loss of (application usable) free memory. 5. Memory fragmentation can lead to system crashes or other instability.
  • 20. REFERENCES https://en.wiki/fragmentation_(computing) William Stalling, Operating System: Internal and Design Principle, Sixth Edition Published by Dorling Kinglersly, India 2009.