Overlays: An Essential Technique for Memory Management

Define overlays?

An overlay is a technique used to allow a program to exceed the amount of memory allocated to it by loading data or instructions into memory only when they are needed, and then unloading them when they are no longer required.

The basic idea behind overlays is to divide a program into logical segments, and then load each segment into memory only when it is needed.

For example, if a program has multiple functions or procedures, each function or procedure can be stored in a separate overlay. When the program calls a function, the overlay containing that function is loaded into memory, and when the function returns, the overlay is unloaded to free up memory.

Overlays are typically used in systems with limited memory, where it is not possible to load an entire program into memory at once. By using overlays, the system can execute larger programs than would otherwise be possible, because only the portions of the program that are currently needed are loaded into memory.