In this tutorial, I am going to explain one of the methods of dynamic memory management that is name as compaction. In this process, all marked or used node is shifted to one end and variable or available memory is kept at another end.
In a very simple language, the compaction is a process in which we mode all the used node to the one end of the memory and all the available memory to the other end. And the algorithm to perform such operation is called compaction algorithm.
In this scheme initially, memory is one large block of available storage. When requests arrive for storage, a block of memory is allocated sequentially starting from the first location in the memory as shown in Fig1.
A variable free point contains the address of the first location following the last block allocated as in Fig1, a free point equals 950. When a block is freed, the free point remains unchanged and no combination of free spaces take place.
When a block of size n is allocated free point is increased by n. This continues until a block of size n is requested and free point+ n-1 is larger than the highest address in the memory. The request can not be satisfied without further action being taken.
At that point, user routines come to a halt and system compaction routine is called. this routine copies all allocated blocks into sequential memory locations starting from the lowest address in the memory.
Thus all free blocks that were interspersed with allocated blocks are eliminated, and the free point is reset to the sum of the size of all the allocated blocks. thus, one large free block is created at the upper end of the memory and the user request may be filled if there is sufficient storage available. this process is shown in Fig1 on a memory of 1024 words.
When allocated blocks are copied into a lower portion of memory, special care must be taken so that pointer value remains correct. for example, the contents of memory location 420 in allocated block 2 of Fig1 might contain the address340. After block2 is moved to locations 125 through 299, 420 to 220, those content must be changed to 140.
Memory compaction is the process to shift all the free memory at one end and used or marked node at one end so that when a request memory is less than the size of free pool memory then we can easily allocate the memory to that block.
In the case of any queries, you can write to us at email@example.com we will get back to you ASAP.
Hope! you would have enjoyed this post about memory compaction.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!
- Important facts about Gmail in Hindi? Gmail के बारे में कुछ रोचक तथ्य?
- Software Maintenance Issues & Problem in Hindi? सॉफ्टवेयर मेंटेनेंस मुद्दा और दिक्कते हिंदी में
- What is Requirement engineering in Hindi& Requirement analysis?रेक्विरेमेंट इंजीनियरिंग क्या होता है?
- White Box Testing in Hindi? वाइट बॉक्स टेस्टिंग क्या है हिंदी में?
- Compare and contrast the important life cycle models in Hindi: लाइफ साइकिल मॉडल्स इन हिंदी 2019?
- What is Spiral Model In Hindi? स्पाइरल मॉडल क्या है?
- Rapid Application Development Model in Hindi (RAD Model)? रेड मॉडल क्या है ?
- Incremental Model in Software Engineering? इंक्रीमेंटल मॉडल क्या होता है?
- Waterfall model(वॉटरफॉल मॉडल ) is not used in making bigger software system in Hindi?
- Difference between waterfall and prototype Model in Hindi: वॉटरफॉल मॉडल और प्रोटोटाइप मॉडल में अंतर