Operating System - Overlays



In this chapter, we will discuss overlays, how it is used in operating systems for memory management, and its advantages and disadvantages.

What are Overlays?

Overlays are a memory management technique used in traditional operating systems to run programs that are larger than the available physical memory (RAM). The basic idea behind overlays is to divide a program into smaller, manageable sections called overlays, which can be loaded into memory as needed. The program is designed in such a way that only the necessary overlays are loaded into memory at any given time.

The image below illustrates the concept of overlays in operating systems −

Overlays in Operating System

In the image above, the process P1 have three overlays - Overlay 1, Overlay 2, and Overlay 3. At any given time, only one overlay is loaded into the main memory (RAM). When the process needs to access a different overlay, the current overlay is swapped out of memory and new overlay is loaded into memory.

Need for Overlays

In early computing systems, overlays are commonly used due less amount of storage capacity for RAM. Overlays are primarily used to for −

  • Running programs larger than the available RAM storage.
  • Ensuring maximum utilization of memory resources.
  • Allowing multiple programs to run simultaneously by sharing memory.

Working of Overlays

The working of overlays involves the following steps −

  • The program is divided into smaller sections called overlays.
  • A part of the program will always remain in memory, called the base overlay. This base overlay contains the main logic of the program and is always loaded into memory.
  • When the program needs to access a different overlay, the current overlay is swapped out of memory and the new overlay is loaded into memory.
  • The process continues until the program completes its execution.

Advantages of Overlays

The overlay technique offers several advantages such as −

  • Memory Efficiency − Overlays allow programs larger than the available memory to run by loading only the necessary parts into memory.
  • Reduced Memory Footprint − By loading only the required overlays, the overall memory usage is reduced, allowing more programs to run simultaneously.
  • Simplicity − The overlay technique is relatively simple to implement and does not require complex memory management algorithms.

Disadvantages of Overlays

Overlays technique also comes with certain disadvantages such as −

  • Increased Overhead − The process of swapping overlays in and out of memory can introduce significant overhead, leading to performance degradation.
  • Complex Program Design − Designing programs to work with overlays can be complex and requires careful planning to ensure that the necessary overlays are loaded at the right time.
  • Limited Flexibility − Overlays are less flexible compared to modern memory management techniques like paging and segmentation, which allow for more dynamic memory allocation.

Conclusion

Overlays are traditional memory management technique used in early operating systems to run programs larger than the available physical memory. Modern operating systems prefer more advanced memory management techniques like paging and segmentation instead of overlays. However, it is important to understand the concept of overlays as it this is basis for memory management in operating systems.

Advertisements