 
- OS - Home
- OS - Needs
- OS - Overview
- OS - History
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- Process Management
- OS - Processes
- OS - Process Control Block
- OS - Operations on Processes
- OS - Inter Process Communication
- OS - Context Switching
- OS - Multi-threading
- Scheduling Algorithms
- OS - Process Scheduling
- Preemptive and Non-Preemptive Scheduling
- Scheduling Algorithms Overview
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithm
- HRRN Scheduling Algorithm
- Priority Scheduling Algorithm
- Multilevel Queue Scheduling
- Lottery Scheduling Algorithm
- OS - TAT & WAT
- Predicting Burst Time in SJF Scheduling
- Process Synchronization
- OS - Process Synchronization
- OS - Critical Section Problem
- OS - Critical Section Synchronization
- OS - Mutual Exclusion Synchronization
- OS - Semaphores
- OS - Counting Semaphores
- OS - Mutex
- OS - Turn Variable
- OS - Bounded Buffer Problem
- OS - Reader Writer Locks
- OS - Test and Set Lock
- OS - Peterson's Solution
- OS - Monitors
- OS - Sleep and Wake
- OS - Race Condition
- OS Deadlock
- Introduction to Deadlock in Operating System
- Conditions for Deadlock in Operating System
- Memory Management
- OS - Memory Management
- OS - Contiguous Memory Allocation
- OS - Non-Contiguous Memory Allocation
- OS - First Fit Algorithm
- OS - Next Fit Algorithm
- OS - Best Fit Algorithm
- OS - Worst Fit Algorithm
- OS - Fragmentation
- OS - Virtual Memory
- OS - Segmentation
- OS - Buddy System
- OS - Allocating Kernel Memory
- OS - Overlays
- Paging and Page Replacement
- OS - Paging
- OS - Demand Paging
- OS - Page Table
- OS - Page Replacement Algorithms
- OS - Optimal Page Replacement Algorithm
- OS - Belady's Anomaly
- OS - Thrashing
- Storage and File Management
- OS - File Systems
- OS - File Attributes
- OS - Structures of Directory
- OS - Linked Index Allocation
- OS - Indexed Allocation
- I/O Systems
- OS - I/O Hardware
- OS - I/O Software
- OS Types
- OS - Types
- OS - Batch Processing
- OS - Multiprocessing
- OS - Hybrid
- OS - Monolithic
- OS - Zephyr
- OS - Nix
- OS - Linux
- OS - Blackberry
- OS - Garuda
- OS - Tails
- OS - Clustered
- OS - Haiku
- OS - AIX
- OS - Solus
- OS - Tizen
- OS - Bharat
- OS - Fire
- OS - Bliss
- OS - VxWorks
- OS - Embedded
- OS - Single User
- Miscellaneous Topics
- OS - Security
- OS Questions Answers
- OS - Questions Answers
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
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?
- Need for Overlays
- Working of Overlays
- Advantages of Overlays
- Disadvantages of Overlays
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 −
 
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.