SlideShare a Scribd company logo
International Journal of Trend in Scientific Research and Development (IJTSRD)
Volume 3 Issue 5, August 2019 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470
@ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1985
Analysis of Allocation Algorithms in Memory Management
Lae Wah Htun1, Moh Moh Myint Kay1, Aye Aye Cho2
1Assistant Lecturer, 2Associate Professor
1,2University of Computer Studies, Hinthada, Myanmar
How to cite this paper: Lae Wah Htun |
Moh Moh Myint Kay | Aye Aye Cho
"Analysis of Allocation Algorithms in
Memory Management" Published in
International
Journal of Trend in
Scientific Research
and Development
(ijtsrd), ISSN: 2456-
6470, Volume-3 |
Issue-5, August
2019, pp.1985-
1987,
https://doi.org/10.31142/ijtsrd26731
Copyright © 2019 by author(s) and
International Journal ofTrend inScientific
Research and Development Journal. This
is an Open Access article distributed
under the terms of
the Creative
Commons Attribution
License (CC BY 4.0)
(http://creativecommons.org/licenses/by
/4.0)
ABSTRACT
Memory management is the process of controllingand coordinatingcomputer
memory, assigning portions called blocks to various running programs to
optimize overall system performance and also known as memory allocation.
Placement algorithms are implemented to determine the slot that can be
allocated process amongst the available ones in the partitioned memory.
Memory slots allocated to processes might be too big when using the existing
placement algorithms hence losinga lotofspaceduetointernalfragmentation.
In dynamic partitioning, external fragmentation occurs when there is a
sufficient amount of space in the memory to satisfy the memory request of a
process but the process’s memory request cannot be satisfied as the memory
available is in a non-contiguous manner. This paper describes how to resolve
external fragmentationusing threeallocationalgorithms. Thesealgorithms are
First-fit, Best-fit and Worst-fit. We will present the implementation of three
algorithms and compare their performance on generated virtual trace.
KEYWORDS: Best-fit, First-fit, Worst-fit, Performance, Memory Management
1. Introduction
Memory Management is the function responsible for allocating and managing
computer’s main Memory. Different memory allocation algorithms have been
devised to organize memory efficiently. Allocationalgorithms areimplemented
to determine the slot that can be allocated a process amongsttheavailableones
in the partitioned memory block. Allocating a single contiguous section of
memory to each process is the most primitive methodof memorymanagement,
usually called partitioning.
In partitioning, the simplest partitioning method is dividing
memory into several fixed-sized partitions inadvance,called
fixed partitioning. Fixed partitioning is the oldest and
simplest technique used to put more than one processes in
the main memory. In fixed partitioning, there are two
methods: equal-sized partitioning and unequal-sized
partitioning. In equal-sized partitioning, any process whose
size is less than or equal to the partition size can be loaded
into any available partition. Fixed size partitions sufferfrom
two types of problems; they are overlays and internal
fragmentation.
If a process is larger than the size of the partition then it
suffers from overlaying problem in which only required
information will be kept in memory. Overlays are extremely
complex and time consuming task. When the memory
assigned to the process is slightly larger than the memory
requested by the process this creates free space in the
allocated causing internal fragmentation. It occurs when
fixed sized memory blocks are allocated to the processes.
In multiple queues, each process is assigned to the smallest
partition in which it fits and minimizes the internal
fragmentation problem. In single queue, the process is
assigned to the smallest available partition and the level of
multiprogramming is increased the size of each block in
fixed partition is varied where processes are assigned to the
blocks where it fits exactly: inotherwords,processesmaybe
queued to use the best available partition. In the unequal
size partition compared to equal size partition, memory
wastage is minimized, and may not give best throughput as
some partitions may be unused. The unequal size partitions
use two types of queues where processes are assigned to
memory blocks. They are multiple queue and single queue.
In multiple queues, each process is assigned to the smallest
partition in which it fits and minimizes the internal
fragmentation problem. In single queue, the process is
assigned to the smallest available partition and the level of
multiprogramming is increased. If process loaded is much
smaller than any partition either equal or unequal, then it
suffers from internal fragmentation in which memory is not
used efficiently. To overcome this problem, an approach
known as dynamic partitioning was developed. Partitioning
may be done dynamically, called dynamic partitioning. In
dynamic partitioning, external fragmentation occurs when
there is a sufficient amount of space in the memory tosatisfy
the memory request of a process but the process’s memory
request cannot be satisfied as the memory available is in a
non-contiguous manner. A method for overcoming external
fragmentation is compaction. The difficultywithcompaction
is that it is a time-consuming and requires relocation
capability. Therefore, different strategies may be taken as to
how space is allocated to processes: the common placement
algorithms are Firs-fit, Best-fit and Worst-fit.
2. Background of Theory
Modern operating systems provide efficient memory
management and still research is being conduct to improve
IJTSRD26731
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1986
the way the memory is allocated forapplications becausethe
main problem faces by memory allocation algorithms is to
efficiently allocating the demanded memory blocks to the
demanding applications with the minimum response time
along with minimum memory loss in the shapeoftraditional
memory loss problem called the fragmentation of memory.
We will use the placement algorithm to efficiently allocate
the processes in the main memory.
A. First-fit
In First-fit, scan the memory from the beginningandallocate
the first available block that is large enough. It is one of the
fastest algorithms as it would search only as little as
possible. But, the remaining unused memory areas left after
allocations become waste if it is toosmaller.Thus requestfor
large memory requirement cannot be accomplished.Wewill
prove that the following problem, which algorithm makes
the most efficient use of memory.
Implementation in First-fit:
1. Input memory blocks with size and processes with size.
2. Initialize all memory blocks as free.
3. Start by picking each process and check if it can be
assigned to current block.
4. If size-of-process <= size-of-block if yes then assign and
check for next process
5. If not then keep checking the further blocks.
For example: Given ten memory partitions of500KB,200KB,
800KB, 400KB, 100KB, 700KB, 300KB, 600KB, 1000KB,
900KB (in order), How would the First-fit, Best-fit, Worst- fit
algorithms place processes of212KB,150KB,375KB,950KB,
350KB, 632KB, 400KB, 717KB, 811KB (in order)? Which
algorithm makes the most efficient use of memory?
In First-fit:
212KB is put in 500KB partition
150KB is put in 288KB (new partition 288KB=500KB-
212KB)
375KB is put in 800KB partition
950KB is put in 1000KB partition
350KB is put in 425KB(new partition425KB=800KB-375KB
632KB is put in 700KB partition
400KB is put in 400KB partition
717KB is put in 900KB partition
811 must wait
Figure1. First-fit Output results
B. Best-fit
In Best-fit, the entire list of blocks must be searched the
closest in size to the request and allocate this block.Memory
utilization is much better than First-fit as it searches the
smallest free partition first available. But, it is slower and
may even tend to fill up memory with tiny useless holes.
Implementation in Best-fit:
1. Input memory blocks with size and processes with size.
2. Initialize all memory blocks as free.
3. Start by picking each process and find the minimum
block size that can be assigned to current process i.e.,
find min(blockSize[1]),blockSize[2],………,blockSize[n]>
processSize[current] it found then assign it to the
current process.
4. If not then leave that process and keep checking the
further processes.
Calculation with Best-fit, above the problem describes in
First-fit
In Best-fit:
212KB is put in 300KB partition
150KB is put in 200KB partition
375KB is put in 400KB partition
950KB is put in 1000KB partition
350KB is put in 500KB partition
632KB is put in 700KB partition
400KB is put in 600KB partition
717KB is put in 800KB partition
811KB is put in 900KB partition
Figure2. Best-fit Output results
C. Worst-fit
In Worst-fit, the entire list of blocks must be searched the
largest block and allocate this block. Reduce the rate of
production of small gaps. In contrast, this strategy produces
the largest leftover block, which may be big enough to hold
another process. But, 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.
Implementation in Worst-fit:
1. Input memory blocks with size and processes with size.
2. Initialize all memory blocks as free.
3. Start by picking each process and find the maximum
block size that can be assigned to current process i.e.,
find max (blockSize[1]), blockSize[2],…….,blockSize[n]>
processSize[current] it found then assign it to the
current process.
4. If not then leave that process and keep checking the
further processes.
Calculation with Worst-fit, above the problem describes in
First-fit
In Worst-fit:
212KB is put in 1000KB partition
150KB is put in 900KB partition
375KB is put in 800KB partition
950KB must wait
350KB is put in 788KB (new partition 788KB=1000KB-
212KB)
International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470
@ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1987
632KB is put in 750KB (new partition 750KB=900KB-
150KB)
400KB is put in 700KB partition
717KB must wait
811KB must wait
Figure3. Worst-fit Output results
3. Experimental Results
In this paper, we have been seen that Best-fit algorithm is
the best among three placement algorithms. We are
explained with a problem, how to calculate this algorithm.
These algorithms cannot eliminate external fragmentation.
To overcome this problem, we must use compaction.
Figure4. Comparison of Three Allocation Algorithms for
Performance
4. Conclusion
Main memory management is very important in operating
system. Simulations have shown that both First-fit and Best-
fit are better than Worst-fit in terms of decreasing both time
and storage utilization. Neither First-fit norBest-fitis clearly
better in terms of storage utilization but First-fit is generally
faster. Among three algorithms, Best-fitalgorithmmakes the
most efficient use of memory. In this paper, we also proved
that Best-fit algorithm is the best in memory utilization.
References
[1] Rachael Chikorrie, Okuthe P. Kogeda, Manoj Lall: “An
Optimized Main Memory Management Partitioning
Placement Algorithm”, Pan African conference on
Science, computing and Telecommunications (PACT)
Publisher, July 27-29, Kampala Uganda 2015.
[2] Abraham Silerschatz, Peter Beer Galvin, and Greg
Gange, “Operating System Concepts”, John Wiley &
Sons, INC., January 1, 2002.
[3] William Stallings, “Operating System Internals and
Design Principles”, March 20, 2017.
[4] Ledisi G. Kabari, TamunoomieS. Gogo, ”Efficiency of
Memory Allocation Algorithms Using Mathematical
Model”, International Journal of Emerging Engineering
Research and Technology Volume 3, Issue 9,
September, 2015, PP 55-67
[5] Muhammand Abfullh Awais, “Challenges and
Techniques for Algorithms in Relation with Today’s
Real Time Needs”, International journal of Multi-
Disciplinary Sciences and Engineering, vol.7, No.3,
March 2016.

More Related Content

PPTX
Human Memory
PPTX
PDF
CS9222 ADVANCED OPERATING SYSTEMS
PPT
An Introduction to Operating Systems
PPT
15. Transactions in DBMS
PDF
Distributed Operating System_1
PDF
Unit 4 Real Time Operating System
PPTX
Recovery system
Human Memory
CS9222 ADVANCED OPERATING SYSTEMS
An Introduction to Operating Systems
15. Transactions in DBMS
Distributed Operating System_1
Unit 4 Real Time Operating System
Recovery system

What's hot (20)

PPTX
push down automata
PPTX
Lock based protocols
PDF
Production System in AI
PPTX
Divide and conquer
PDF
What is CPU Register? Type of CPU Register.
PPTX
Pharmacy management system project
PPTX
Inventory system
PPTX
Railway booking & management system
PPTX
distributed Computing system model
PPTX
deadlock handling
PDF
CS9222 ADVANCED OPERATING SYSTEMS
PPTX
Character generation techniques
PPTX
Multiprocessor Architecture (Advanced computer architecture)
PPT
Lecture 6
PPTX
database recovery techniques
PPTX
Hospital Management System
PPT
File organization 1
PPTX
Distributed and clustered systems
PPTX
Distributed database management system
PDF
Software Requirements Specification for restaurant management system
push down automata
Lock based protocols
Production System in AI
Divide and conquer
What is CPU Register? Type of CPU Register.
Pharmacy management system project
Inventory system
Railway booking & management system
distributed Computing system model
deadlock handling
CS9222 ADVANCED OPERATING SYSTEMS
Character generation techniques
Multiprocessor Architecture (Advanced computer architecture)
Lecture 6
database recovery techniques
Hospital Management System
File organization 1
Distributed and clustered systems
Distributed database management system
Software Requirements Specification for restaurant management system
Ad

Similar to Analysis of Allocation Algorithms in Memory Management (20)

PPTX
memorymanagement-2112140500ygyftftt34.pptx
PPTX
FRAGMENTATION final impotant topic .pptx
PPTX
local_media3192961381667787861026781.pptx
PPTX
memory management IN OS ANURAG PATE.pptx
PDF
DB ppt OS unit - 3.pdf
PPTX
OPERATING SYSTEM-UNIT 3.pptxMemory management for UNIX, Solaris, Linux, Windo...
PPTX
Memory Management in OS
PPTX
contiguous memory allocation.pptx
PPTX
conviction in operating system
PDF
Design and Implementation of Repair-aware Test Flow for Multi-Memory
PPTX
Lecture 5 memory management in operating systems.pptx
PDF
Efficient usage of memory management in big data using “anti caching”
PDF
Dynamic loading
PDF
Dominant block guided optimal cache size estimation to maximize ipc of embedd...
PDF
Dominant block guided optimal cache size estimation to maximize ipc of embedd...
PDF
Architecture and implementation issues of multi core processors and caching –...
PDF
I-Sieve: An inline High Performance Deduplication System Used in cloud storage
PDF
Memory Management in Operating System
PDF
Fixed partitioning of memory
PPTX
Query optimization
memorymanagement-2112140500ygyftftt34.pptx
FRAGMENTATION final impotant topic .pptx
local_media3192961381667787861026781.pptx
memory management IN OS ANURAG PATE.pptx
DB ppt OS unit - 3.pdf
OPERATING SYSTEM-UNIT 3.pptxMemory management for UNIX, Solaris, Linux, Windo...
Memory Management in OS
contiguous memory allocation.pptx
conviction in operating system
Design and Implementation of Repair-aware Test Flow for Multi-Memory
Lecture 5 memory management in operating systems.pptx
Efficient usage of memory management in big data using “anti caching”
Dynamic loading
Dominant block guided optimal cache size estimation to maximize ipc of embedd...
Dominant block guided optimal cache size estimation to maximize ipc of embedd...
Architecture and implementation issues of multi core processors and caching –...
I-Sieve: An inline High Performance Deduplication System Used in cloud storage
Memory Management in Operating System
Fixed partitioning of memory
Query optimization
Ad

More from ijtsrd (20)

PDF
A Study of School Dropout in Rural Districts of Darjeeling and Its Causes
PDF
Pre extension Demonstration and Evaluation of Soybean Technologies in Fedis D...
PDF
Pre extension Demonstration and Evaluation of Potato Technologies in Selected...
PDF
Pre extension Demonstration and Evaluation of Animal Drawn Potato Digger in S...
PDF
Pre extension Demonstration and Evaluation of Drought Tolerant and Early Matu...
PDF
Pre extension Demonstration and Evaluation of Double Cropping Practice Legume...
PDF
Pre extension Demonstration and Evaluation of Common Bean Technology in Low L...
PDF
Enhancing Image Quality in Compression and Fading Channels A Wavelet Based Ap...
PDF
Manpower Training and Employee Performance in Mellienium Ltdawka, Anambra State
PDF
A Statistical Analysis on the Growth Rate of Selected Sectors of Nigerian Eco...
PDF
Automatic Accident Detection and Emergency Alert System using IoT
PDF
Corporate Social Responsibility Dimensions and Corporate Image of Selected Up...
PDF
The Role of Media in Tribal Health and Educational Progress of Odisha
PDF
Advancements and Future Trends in Advanced Quantum Algorithms A Prompt Scienc...
PDF
A Study on Seismic Analysis of High Rise Building with Mass Irregularities, T...
PDF
Descriptive Study to Assess the Knowledge of B.Sc. Interns Regarding Biomedic...
PDF
Performance of Grid Connected Solar PV Power Plant at Clear Sky Day
PDF
Vitiligo Treated Homoeopathically A Case Report
PDF
Vitiligo Treated Homoeopathically A Case Report
PDF
Uterine Fibroids Homoeopathic Perspectives
A Study of School Dropout in Rural Districts of Darjeeling and Its Causes
Pre extension Demonstration and Evaluation of Soybean Technologies in Fedis D...
Pre extension Demonstration and Evaluation of Potato Technologies in Selected...
Pre extension Demonstration and Evaluation of Animal Drawn Potato Digger in S...
Pre extension Demonstration and Evaluation of Drought Tolerant and Early Matu...
Pre extension Demonstration and Evaluation of Double Cropping Practice Legume...
Pre extension Demonstration and Evaluation of Common Bean Technology in Low L...
Enhancing Image Quality in Compression and Fading Channels A Wavelet Based Ap...
Manpower Training and Employee Performance in Mellienium Ltdawka, Anambra State
A Statistical Analysis on the Growth Rate of Selected Sectors of Nigerian Eco...
Automatic Accident Detection and Emergency Alert System using IoT
Corporate Social Responsibility Dimensions and Corporate Image of Selected Up...
The Role of Media in Tribal Health and Educational Progress of Odisha
Advancements and Future Trends in Advanced Quantum Algorithms A Prompt Scienc...
A Study on Seismic Analysis of High Rise Building with Mass Irregularities, T...
Descriptive Study to Assess the Knowledge of B.Sc. Interns Regarding Biomedic...
Performance of Grid Connected Solar PV Power Plant at Clear Sky Day
Vitiligo Treated Homoeopathically A Case Report
Vitiligo Treated Homoeopathically A Case Report
Uterine Fibroids Homoeopathic Perspectives

Recently uploaded (20)

PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Presentation on HIE in infants and its manifestations
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Cell Types and Its function , kingdom of life
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Lesson notes of climatology university.
PPTX
Pharma ospi slides which help in ospi learning
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Complications of Minimal Access Surgery at WLH
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Institutional Correction lecture only . . .
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Presentation on HIE in infants and its manifestations
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Cell Types and Its function , kingdom of life
102 student loan defaulters named and shamed – Is someone you know on the list?
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
2.FourierTransform-ShortQuestionswithAnswers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Lesson notes of climatology university.
Pharma ospi slides which help in ospi learning
O7-L3 Supply Chain Operations - ICLT Program
VCE English Exam - Section C Student Revision Booklet
Complications of Minimal Access Surgery at WLH
Anesthesia in Laparoscopic Surgery in India
Institutional Correction lecture only . . .
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

Analysis of Allocation Algorithms in Memory Management

  • 1. International Journal of Trend in Scientific Research and Development (IJTSRD) Volume 3 Issue 5, August 2019 Available Online: www.ijtsrd.com e-ISSN: 2456 – 6470 @ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1985 Analysis of Allocation Algorithms in Memory Management Lae Wah Htun1, Moh Moh Myint Kay1, Aye Aye Cho2 1Assistant Lecturer, 2Associate Professor 1,2University of Computer Studies, Hinthada, Myanmar How to cite this paper: Lae Wah Htun | Moh Moh Myint Kay | Aye Aye Cho "Analysis of Allocation Algorithms in Memory Management" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456- 6470, Volume-3 | Issue-5, August 2019, pp.1985- 1987, https://doi.org/10.31142/ijtsrd26731 Copyright © 2019 by author(s) and International Journal ofTrend inScientific Research and Development Journal. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0) (http://creativecommons.org/licenses/by /4.0) ABSTRACT Memory management is the process of controllingand coordinatingcomputer memory, assigning portions called blocks to various running programs to optimize overall system performance and also known as memory allocation. Placement algorithms are implemented to determine the slot that can be allocated process amongst the available ones in the partitioned memory. Memory slots allocated to processes might be too big when using the existing placement algorithms hence losinga lotofspaceduetointernalfragmentation. In dynamic partitioning, external fragmentation occurs when there is a sufficient amount of space in the memory to satisfy the memory request of a process but the process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. This paper describes how to resolve external fragmentationusing threeallocationalgorithms. Thesealgorithms are First-fit, Best-fit and Worst-fit. We will present the implementation of three algorithms and compare their performance on generated virtual trace. KEYWORDS: Best-fit, First-fit, Worst-fit, Performance, Memory Management 1. Introduction Memory Management is the function responsible for allocating and managing computer’s main Memory. Different memory allocation algorithms have been devised to organize memory efficiently. Allocationalgorithms areimplemented to determine the slot that can be allocated a process amongsttheavailableones in the partitioned memory block. Allocating a single contiguous section of memory to each process is the most primitive methodof memorymanagement, usually called partitioning. In partitioning, the simplest partitioning method is dividing memory into several fixed-sized partitions inadvance,called fixed partitioning. Fixed partitioning is the oldest and simplest technique used to put more than one processes in the main memory. In fixed partitioning, there are two methods: equal-sized partitioning and unequal-sized partitioning. In equal-sized partitioning, any process whose size is less than or equal to the partition size can be loaded into any available partition. Fixed size partitions sufferfrom two types of problems; they are overlays and internal fragmentation. If a process is larger than the size of the partition then it suffers from overlaying problem in which only required information will be kept in memory. Overlays are extremely complex and time consuming task. When the memory assigned to the process is slightly larger than the memory requested by the process this creates free space in the allocated causing internal fragmentation. It occurs when fixed sized memory blocks are allocated to the processes. In multiple queues, each process is assigned to the smallest partition in which it fits and minimizes the internal fragmentation problem. In single queue, the process is assigned to the smallest available partition and the level of multiprogramming is increased the size of each block in fixed partition is varied where processes are assigned to the blocks where it fits exactly: inotherwords,processesmaybe queued to use the best available partition. In the unequal size partition compared to equal size partition, memory wastage is minimized, and may not give best throughput as some partitions may be unused. The unequal size partitions use two types of queues where processes are assigned to memory blocks. They are multiple queue and single queue. In multiple queues, each process is assigned to the smallest partition in which it fits and minimizes the internal fragmentation problem. In single queue, the process is assigned to the smallest available partition and the level of multiprogramming is increased. If process loaded is much smaller than any partition either equal or unequal, then it suffers from internal fragmentation in which memory is not used efficiently. To overcome this problem, an approach known as dynamic partitioning was developed. Partitioning may be done dynamically, called dynamic partitioning. In dynamic partitioning, external fragmentation occurs when there is a sufficient amount of space in the memory tosatisfy the memory request of a process but the process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. A method for overcoming external fragmentation is compaction. The difficultywithcompaction is that it is a time-consuming and requires relocation capability. Therefore, different strategies may be taken as to how space is allocated to processes: the common placement algorithms are Firs-fit, Best-fit and Worst-fit. 2. Background of Theory Modern operating systems provide efficient memory management and still research is being conduct to improve IJTSRD26731
  • 2. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1986 the way the memory is allocated forapplications becausethe main problem faces by memory allocation algorithms is to efficiently allocating the demanded memory blocks to the demanding applications with the minimum response time along with minimum memory loss in the shapeoftraditional memory loss problem called the fragmentation of memory. We will use the placement algorithm to efficiently allocate the processes in the main memory. A. First-fit In First-fit, scan the memory from the beginningandallocate the first available block that is large enough. It is one of the fastest algorithms as it would search only as little as possible. But, the remaining unused memory areas left after allocations become waste if it is toosmaller.Thus requestfor large memory requirement cannot be accomplished.Wewill prove that the following problem, which algorithm makes the most efficient use of memory. Implementation in First-fit: 1. Input memory blocks with size and processes with size. 2. Initialize all memory blocks as free. 3. Start by picking each process and check if it can be assigned to current block. 4. If size-of-process <= size-of-block if yes then assign and check for next process 5. If not then keep checking the further blocks. For example: Given ten memory partitions of500KB,200KB, 800KB, 400KB, 100KB, 700KB, 300KB, 600KB, 1000KB, 900KB (in order), How would the First-fit, Best-fit, Worst- fit algorithms place processes of212KB,150KB,375KB,950KB, 350KB, 632KB, 400KB, 717KB, 811KB (in order)? Which algorithm makes the most efficient use of memory? In First-fit: 212KB is put in 500KB partition 150KB is put in 288KB (new partition 288KB=500KB- 212KB) 375KB is put in 800KB partition 950KB is put in 1000KB partition 350KB is put in 425KB(new partition425KB=800KB-375KB 632KB is put in 700KB partition 400KB is put in 400KB partition 717KB is put in 900KB partition 811 must wait Figure1. First-fit Output results B. Best-fit In Best-fit, the entire list of blocks must be searched the closest in size to the request and allocate this block.Memory utilization is much better than First-fit as it searches the smallest free partition first available. But, it is slower and may even tend to fill up memory with tiny useless holes. Implementation in Best-fit: 1. Input memory blocks with size and processes with size. 2. Initialize all memory blocks as free. 3. Start by picking each process and find the minimum block size that can be assigned to current process i.e., find min(blockSize[1]),blockSize[2],………,blockSize[n]> processSize[current] it found then assign it to the current process. 4. If not then leave that process and keep checking the further processes. Calculation with Best-fit, above the problem describes in First-fit In Best-fit: 212KB is put in 300KB partition 150KB is put in 200KB partition 375KB is put in 400KB partition 950KB is put in 1000KB partition 350KB is put in 500KB partition 632KB is put in 700KB partition 400KB is put in 600KB partition 717KB is put in 800KB partition 811KB is put in 900KB partition Figure2. Best-fit Output results C. Worst-fit In Worst-fit, the entire list of blocks must be searched the largest block and allocate this block. Reduce the rate of production of small gaps. In contrast, this strategy produces the largest leftover block, which may be big enough to hold another process. But, 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. Implementation in Worst-fit: 1. Input memory blocks with size and processes with size. 2. Initialize all memory blocks as free. 3. Start by picking each process and find the maximum block size that can be assigned to current process i.e., find max (blockSize[1]), blockSize[2],…….,blockSize[n]> processSize[current] it found then assign it to the current process. 4. If not then leave that process and keep checking the further processes. Calculation with Worst-fit, above the problem describes in First-fit In Worst-fit: 212KB is put in 1000KB partition 150KB is put in 900KB partition 375KB is put in 800KB partition 950KB must wait 350KB is put in 788KB (new partition 788KB=1000KB- 212KB)
  • 3. International Journal of Trend in Scientific Research and Development (IJTSRD) @ www.ijtsrd.com eISSN: 2456-6470 @ IJTSRD | Unique Paper ID – IJTSRD26731 | Volume – 3 | Issue – 5 | July - August 2019 Page 1987 632KB is put in 750KB (new partition 750KB=900KB- 150KB) 400KB is put in 700KB partition 717KB must wait 811KB must wait Figure3. Worst-fit Output results 3. Experimental Results In this paper, we have been seen that Best-fit algorithm is the best among three placement algorithms. We are explained with a problem, how to calculate this algorithm. These algorithms cannot eliminate external fragmentation. To overcome this problem, we must use compaction. Figure4. Comparison of Three Allocation Algorithms for Performance 4. Conclusion Main memory management is very important in operating system. Simulations have shown that both First-fit and Best- fit are better than Worst-fit in terms of decreasing both time and storage utilization. Neither First-fit norBest-fitis clearly better in terms of storage utilization but First-fit is generally faster. Among three algorithms, Best-fitalgorithmmakes the most efficient use of memory. In this paper, we also proved that Best-fit algorithm is the best in memory utilization. References [1] Rachael Chikorrie, Okuthe P. Kogeda, Manoj Lall: “An Optimized Main Memory Management Partitioning Placement Algorithm”, Pan African conference on Science, computing and Telecommunications (PACT) Publisher, July 27-29, Kampala Uganda 2015. [2] Abraham Silerschatz, Peter Beer Galvin, and Greg Gange, “Operating System Concepts”, John Wiley & Sons, INC., January 1, 2002. [3] William Stallings, “Operating System Internals and Design Principles”, March 20, 2017. [4] Ledisi G. Kabari, TamunoomieS. Gogo, ”Efficiency of Memory Allocation Algorithms Using Mathematical Model”, International Journal of Emerging Engineering Research and Technology Volume 3, Issue 9, September, 2015, PP 55-67 [5] Muhammand Abfullh Awais, “Challenges and Techniques for Algorithms in Relation with Today’s Real Time Needs”, International journal of Multi- Disciplinary Sciences and Engineering, vol.7, No.3, March 2016.