0% found this document useful (0 votes)
59 views9 pages

Yaw Lartey Memory Management

Uploaded by

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

Yaw Lartey Memory Management

Uploaded by

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

Kwame Nkrumah University of Science and Technology

School of Graduate Studies


Department of Computer Science

Advanced Operating Systems

Operating System Paper Review Assignment

By Yaw Ntiri Lartey

Student Number: 20651715


Title of Paper Reviewed: Memory Management: Challenges and Techniques for Traditional
Memory Allocation Algorithms in Relation with Today's Real Time Needs

Author: Muhammad Abdullah Awais (MS150200157, Virtual University of Pakistan


[email protected])

Problem Statement: What are challenges and issues associated with traditional memory
management techniques which hinders the performance in real time systems?

Goal: The goal of the research is to analyze different traditional dynamic memory allocation
algorithms to find out their response times and viability against real time applications

Objectives:
1. Discussion of related work and background knowledge
2. Perform comparative analysis on memory allocation techniques
3. Propose new technique suitable for real time applications

Motivation: The motivation of the research was to understand operating system memory
management and issues related to traditional memory management techniques and reasons why
these techniques are not best used for today’s real time memory usage for applications

Methodology
Muhammad., A (2016) discussed different memory allocation techniques along with their
comparative analysis with respect to internal fragmentation, response time, allocation time, de-
allocation time and memory footprint. He started his discussions on his research with an extensive
literature review according to the research guidance provided by B.Kitchenham. He used a
searching strategy that allowed him to retrieve research articles for memory management techniques
in operating systems. This was to broaden and enhance his understanding of memory management.

The search was conducted various digital libraries such as IEEE explore digital library, Google
scholar and third part research paper providing libraries such as Research Gate using keywords such
as memory management, memory allocation in operating system, real time operating system
memory allocation, issues in memory allocation and techniques for dynamic memory allocation.
After he studied the basics of operating system memory management from the research papers, he
shortlisted those that had issues relating to traditional memory management techniques and reasons
why the techniques were not best suited for today’s real time memory usage for applications and
operating systems.

Dynamic Memory Management


Muhammad., A (2016) discussed the dynamic memory management algorithms with a focus on
traditional algorithms. His approach consisted of eight (8) different traditional algorithms. The first
algorithm discussed was the sequential fit algorithm that utilize the free blocks of memory in linear
order in the form of a list called free list and allocating memory blocks from this free list using a
pointer in different ways according to the situation in hand.

Sequential Fit Algorithm


Four different strategies used by the sequential fit method are as follows:
 First Fit: uses the first available memory block which is greater or equal to the demanded
memory.
 Next Fit: similar to first fit but it starts searching the list from the position where last search
stopped and it serves the next available memory block.
 Best Fit: allocates the block which is best in terms of demanding size.
 Worst Fit: always returns the largest memory block available

Segregated Fit Algorithm


The second algorithm he discussed was the Segregated Fit Algorithm. The Segregated Fit Algorithm
employs array of free blocks to allocate memory. The main theme of segregated free list algorithm
is to use size in power of two (Shalan., M. A, 2003) and divide the memory blocks into classes
holding different size blocks. Four strategies used by the segregated fit method are as follows:
 Strict Size classes: Basic idea behind this kind of strategy is to maintain a list of different
classes holding memory blocks of similar sizes. In this way each class of particular size will
hold memory blocks of same size in list.
 Exact List: This strategy involves in marinating large number of free lists of all possible
memory block sizes and it’s best used if there are small size classes containing free lists of
huge number.
 Classes with Range: In this type of segregated free list, free list may contain different size
blocks.
Buddy System Algorithm
The third algorithm discussed was the Buddy System which is an innovative way of memory
allocation based on the idea behind segregated free list methodology where size of classes is used
with rounding. This method divides the memory area into allowable block size and partition the
area until minimum block size is achieved. With the buddy system, five strategies are discussed:
 Binary Buddy: In binary buddy variation, all block sizes preserve the property of power of
2 and splitting of memory in 2 equal halves.
 Weighted Buddy: Like binary buddy version, weighted buddy also exhibits the power of 2
scenarios but splitting can take place in 2 equal halves or 2 unequal halves because series
can be power of two and 3 times the power of two
 Fibonacci Buddy: According to the name, the Fibonacci buddy follow the ancient
Fibonacci sequence and size classes are based on Fibonacci sequence
 Double Buddy: Just like binary buddy and weighted buddy, in this variation there are 2
classes, one following the rule of power of two while in other list there is power of 2 and an
offset value is used.
 Tertiary Buddy: This is an extension to binary buddy. In tertiary buddy block sizes are
power of 2 and 3 x 2 x-3 . By this variation its far more better than binary buddy. A detailed
analysis is provided by Masmano et al, 2004.

He provides a comparison of the different buddy systems. In his comparison the binary buddy is the
simplest of all the buddy systems. Due to the equal size partition it easy to compute the pointer
making the buddy allocator a real time allocator. Irrespective of this advantage, internal
fragmentation higher in the binary buddy as compared to the others. On the other hand Fibonacci
buddy has lower internal fragmentation than binary buddy while weighted buddy with different
classes has lower internal fragmentation than all other buddy system variations.

Index Fit Algorithm


The Fourth algorithm he discussed is the Index Fit Algorithm. Indexed fit memory allocator an
index of free and reserved memory blocks is maintained using different types of data structures.
Indexing is employed in any other technique in several ways because it’s the most basic mechanism
for traversing or searching an array or list.

Bitmapped Fit Algorithm


Bitmapped Fit Algorithm is the fifth algorithm he discussed. It is an improvement on the indexed fit
algorithm and it keeps references to used and free portions of array by using bits. Due to searching
time which is quite high, the bitmapped fit algorithm is not used as much as other allocators are
used.

Half Fit Algorithm


The sixth Algorithm discussed is the Half Fit Algorithm which is a much older technique. It used
bitmaps to keep reference to unfilled lists while using instructions of bitmap search technique to get
those bits which are set in bitmaps. The bitmap is little bit slow, but combining it with other
techniques provided good results. The main theme behind half fit is to use segregated list of single
level which is used to link variable size free blocks.

Hoard
The seventh algorithm discussed is the Hoard. Hoard is designed especially for multiprocessor
systems and its performance is quite remarkable among other discussed algorithms. The idea behind
hoard is to use operating system virtual memory as superblocks to serve blocks of memory of one
class.

Two Level Segregated Fit


The last algorithm discussed is the Two Level Segregated Fit. This algorithm according to him is an
important algorithm in modern dynamic memory allocation. It derives its root from segregated fit
and half fit as described earlier. It is different from traditional hoard algorithm because it uses
segregated lists in 2 levels as its name suggests. Three (3) levels of segregated free lists are used
to carry free blocks of memory of same class which reduces internal fragmentation. In first level
there are free blocks of memory following the power of 2 sequences while the second list uses
user’s configured variables to divide free block classes of first list.

A comparative analysis of all algorithms was made with respect to allocation and deallocation time
of different algorithms and also with respect to fragmentation and response time of the methods.
The table below described the worst time complexity required for allocation and deallocation of the
algorithms.

Advantages and Disadvantages


Advantages of Sequential Fit Algorithms
1. Sequential Fit Algorithms are simple and easy to use
2. Best Fit algorithm minimizes the fragmentation as if found memory block is optimal and
larger than the requirement
Disadvantages of Sequential Fit Algorithms
1. Sequential fit algorithm is slow because it has to traverse the list of memory blocks before
allocation is made
2. Sequential fit algorithm causes a lot of fragmentation
3. As memory available for allocation become large, the search time becomes large and in the
worst case can be proportional to the memory size
4. As the free list becomes large, the memory used to store the free list becomes large; hence
the memory overhead becomes large
5. It is not good for Real-Time Systems because it is based on sequential search whose cost
depends on the number of existing free blocks

Advantages of Segregated Fit Algorithm


It is an essential alogorithm in devising more advanced optimal algorithms such as hoard and two
level Segregated Fit Algorithms

Advantages of Buddy System / Allocator


The advantage of a buddy system is that the buddy of a block being freed can be quickly found by
a simple address computation

Disadvantage of Buddy System / Allocator


The disadvantage of buddy systems is that the restricted set of block sizes leads to high internal
fragmentation, as does the limited ability to coalesce.

Advantages of Index Fit Algorithm


1. The index fit alogrithm uses advanced structures to index free memory blocks thus
providing better performance.
2. Response time is somewhat faster than traditional sequential fit algorithm

Advantages of Bitmapped Fit Algorithm


The search time is proportional to the bitmap size which result in a small memory overhead

Disadvantage of Bitmapped Fit Algorithm


The searching time is quite high, hence bitmapped algorithms is not used as much as other
allocators are used.
Summary discussion - TLSF: a New Dynamic Memory Allocator for Real-Time
Systems by Masmano et al
Masmano et al (2004) proposes a new dynamic memory allocator called the Two Level Segregated
Fit (TSLF) Algorithm, based on two levels of segregated lists which provides explicit allocation and
deallocation of memory blocks with a temporal cost. The proposed algorithm shows excellent
performance with respect to both response time and fragmentation in an experiment carried out.

According to Masmano et al (2004), the TSLF has been designed with the following guidelines:
 Immediate coalescing: Here, as soon as a block of memory is released, TLSF will
immediately merge it with adjacent free blocks, if any, to build up a larger free block.
 Splitting threshold: With splitting threshold, The smallest block of allocatable memory
is 16 bytes. By limiting the minimum block size to 16 bytes, it is possible to store, inside the
free blocks, the information needed to manage them, including the list of free blocks
pointers. This approach optimizes the use of memory.
 Good-fit strategy: TLSF will try toreturn the smallestchunk of memory big enough to
hold the requestedblock.
 No reallocation: with no-rellocation, it is assumed assume that the original memory pool
is a single large block of free memory, and nosbrk()2 function is available.
 Same strategy for all block sizes: The same allocation strategy is used for any requested
size.
 Memory is not cleaned-up: Neither the initial pool nor the free blocks are zeroed.

Advantages of the Two Level Segregated Fit Algorithms

1. Two level Segregated Fit Algorithm solves the problem of worst case bound maintaining the
efficiency of the allocation and deallocation operations allowing the reasonable use of
dynamic memory allocation in real-time applications.
2. TLSF uses the guidelines described above for optimizing memory usage which tends to
produce the lowest fragmentation on real workloads.
3. TLSF cause very low internal fragmentation, its response time is very good which is the
primary demand of real time system where time is most important factor.
4. TLSF allocation and de-allocation time is small constant time that makes it much faster than
other traditional techniques.
Conclusion
Muhammad., A (2016) discussed different memory allocation techniques such as sequential fit,
segregation fit, buddy system, along with their comparative analysis with respect to internal
fragmentation they cause, response time, allocation time, de allocation time and memory footprint
they use. All these techniques discussed by Muhammad., A (2016) belonging to dynamic memory
management has advantages and disadvantages and can be utilized in particular situations.
The TSLF is an improved version of previously the other schemes such as sequential and
segregated fit. From Masmano et al (2004), TLSF is the recommended technique to use for real
time systems because TLSF cause very low internal fragmentation, its response time is very good
which is the primary demand of real time system where time is most important factor. Also
TLSF allocation and de allocation time is small constant time that makes it much faster than other
traditional techniques.
References
Shalan., M. A (2003), “Dynamic Memory Management for Embedded Real-Time Multiprocessor
System On a Chip”

M. Masmano, I. Ripoll, A. Crespo and J. Real, "TLSF: a new dynamic memory allocator for real-
time systems," Proceedings. 16th Euromicro Conference on Real-Time Systems, 2004. ECRTS
2004., Catania, Italy, 2004, pp. 79-88.

Silberschatz, A., Galvin, P., & Gagne, G. (2012). Operating System Concepts, 9th Edition. John
Wiley & Sons.

You might also like