Concept of Virtual Storage

Q17. Explain the concept of virtual storage.

Ans. A program can be stored at non contiguous locations, suppose even if we use all available free memory areas still the program cannot be loaded into the main storage because the total free memory is still less than the size of the program. To solve such a problem, we require a technique with which a program can still be executed even if all of it is not loaded in the memory. Virtual storage helps one perform such an execution. Two main approaches to virtual storage are

  • program-paging
  • program-segmentation

Solution to Problem of External Fragmentation

Q5. What is the Solution to the Problem of External Fragmentation?

Ans. Solution to the problem of external fragmentation is compaction. The process is to shuffle the memory contents so that all free memory is placed together in one large block. It is only possible if relocation is dynamic and done only at run time.

The simplest compaction algorithm is to move all processes towards one end of the memory, all holes move in one direction, producing one large hole of available memory.


Figure: Compaction

Another solution to external fragmentation is to permit logical address space of the processes to be noncontiguous. The process is allocated with the available physical memory and whenever the later is available, it is assigned to the process. This solution is achieved through two complementary techniques:

Paging and Segmentation.

Explain Fragmentation

Q1. Explain Fragmentation.

Ans. The process of allocation of memory is ready only half of the story of the memory management. We must also be able to de-allocate or free memory. When memory is free from a segment, it leaves a hole of a certain size, which is added to the free list. Eventually, the number of these holes grows quite large and the memory is said to be fragmented.

Fragmentation can lead to wasted resources and we would definitely like to reuse the free memory as far as possible. The problem becomes critical when the size of hole is not big enough to hold the data segment.