Memory allocation strategies, Data Structure & Algorithms

Assignment Help:

Q. Explain the various memory allocation strategies.                                                          

Ans.

Memory Allocation Strategies are given as follows

If it is not required to move blocks of allocated storage from one area of memory to the other area of memory,  it may be possible to relocate memory blocks that have been freed dynamically. Each time a request is made for storage or saving, the free area large enough to accommodate the size needed must be allocated. The most obvious methods for keeping track of the free blocks is to make use of linear linked list. Each free block contains a field comprising the size of the blocks and a field containing a pointer to be next free block. A global P for free block points to the 1st free block on this list. There are several methods or techniques of selecting the free block to use at when requesting storage.

The First - Fit Method:-       The free list is traversed sequentially or in order  to find the 1st free block whose size is greater than or equal to the amount requested. Once the block is found it is removed from the list (if it is greater than the amount requested). The 1st of these portions remains on the list and the 2nd is allocated.

The Best - Fit Method:- This method obtains the smallest free block whose size is greater than or equal to obtain such a block by traversing the full free list follows.
The Worst Fit method:- In this the system every time allocate a portion of the largest free block in memory. The philosophy at the back of this method is that by using small number of a very big block repeatedly to satisfy the majority of requested, many moderately sized blocks would be left un-fragmented.

The Free Storage List

 

The First fit method is as follows

294_memory allocation strategies.png

 

Best Fit method is as follows


 

1409_memory allocation strategies1.png

 Worst Fit Strategy is as follows

2008_memory allocation strategies2.png


Related Discussions:- Memory allocation strategies

Explain in detail about the ruby arrays, Explain in detail about the Ruby a...

Explain in detail about the Ruby arrays Ruby arrays have many interesting and powerful methods. Besides indexing operations which go well beyond those discussed above, arrays h

A tree having ''m'' nodes has (m-1) branches. prove., Q. Prove the hypothes...

Q. Prove the hypothesis that "A tree having 'm' nodes has exactly (m-1) branches".      Ans: A tree having m number of nodes has exactly (m-1) branches Proof: A root

Tradeoff between space and time complexity, We might sometimes seek a trade...

We might sometimes seek a tradeoff among space & time complexity. For instance, we may have to select a data structure which requires a lot of storage to reduce the computation tim

Naïve recursive algorithm for binomial coefficients, How many recursive cal...

How many recursive calls are called by the naïve recursive algorithm for binomial coefficients, C(10, 5) and C(21, 12) C(n,k){c(n-1,k)+c(n-1,k-1) if 1 1 if k = n or k = 0

Explain about the abstract data type, Explain about the Abstract data type ...

Explain about the Abstract data type Abstract data type (ADT) A set of values (the carrier set) and operations on those values

Non-recursive algorithm to traverse a tree in preorder, Write the non-recur...

Write the non-recursive algorithm to traverse a tree in preorder.    The Non- Recursive algorithm for preorder traversal is as follows: Initially  push NULL onto stack and

Array implementation of a multiqueue, Program gives the program segment by ...

Program gives the program segment by using arrays for the insertion of an element to a queue into the multiqueue. Program: Program segment for the insertion of any element to t

Stack, Explain in detail the algorithmic implementation of multiple stacks....

Explain in detail the algorithmic implementation of multiple stacks.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd