What is Storage Management?

The compiler demands a block of memory for the operating system. The compiler uses this block of memory to implement the compiled program. This block of memory is known as storage management. A compiler should execute is to designate the resources of the target machine to define the data objects that are being manipulated by the source code.

There are three basic storage management phases are as follows −

  • Initial allocation − Initially each piece of storage is either free or in use. If free, it is available for dynamic allocation as the execution proceeds. A storage management system needed several methods to hold track of free storage and structure for free storage allocation as the need appears during execution.

  • Recovery − The storage that has been allocated and in use, must be recovered by the storage manager when the allocated storage becomes available for reuse. This involves finding the data objects which are no longer referenced and reclaim that memory.

The return of recently freed storage to the free-space list is simple, offers such storage that can be recognized and recovered. The main issue lies in deciding which elements are accessible for reuse and thus can be restored to the free-space list.

  • Compaction and reuse − The storage recovered can be directly ready for reuse, or compaction can be essential to generate large blocks of free storage from small elements. As the computation proceeds, the storage block is disintegrated into smaller elements through allocation, recovery, and reuse.

Free-space blocks extend to divide into ever smaller elements. Eventually one reaches a point where a storage allocator cannot recognize a request for an adequately large size block request, even though the free space list includes in unlimited more than a requested block.

Therefore compaction is used to shuffle the memory contents to insert all free memory together in one block. It is depending upon whether active blocks within the heap may be shifted in position, two approaches to compaction can be used.

  • Partial compaction − If it is too expensive to shift active blocks (or active blocks cannot be transformed), then only contiguous free blocks on the free-space list can be compacted.

  • Full compaction − If active blocks can be transformed, thus all active blocks can be transformed to one end of the heap, leaving all void at the additional is contiguous block. Full compaction is needed that when an active block is transformed, all pointers to that block be changed to point to the new location.