In computers, an overlay is a primitive (and outdated) method of doing the equivalent of demand paging
in user space. Overlays were used heavily for larger programs
due to the 640k
Since the overlay is implemented in user space or x86 real mode, its implementation can't
make use of the page fault technique, and instead must
break the program into sections which are hopefully
self-contained. Each overlay would be loaded into memory,
possibly over laying a previous overlay.
Also, since the overlay can't make use of virtual addressing in real mode,
overlays either must be implemented either as relocatable code or must be loaded at the same address every time.
If it must be loaded at a fixed address, then there will
be a fixed set of other overlays it will always need to
However, if the overlay uses relocatable code, or is
patched during load, then it can be loaded anywhere.
This would allow it to overlay the least-recently used
other overlay, or allow the same program to perform
better in (for example) 640k, but still work in 384k, just
with fewer overlays loaded at once.
Turbo C supported writing programs with overlays.
Nethack for Windows 3.1 could be compiled either with
some features missing, or with overlays. Wordstar used
overlays heavily (even very early versions). That's why
your disk would start running the first time you hit some keys -- wordstar was loading the overlay to handle that function.
Overlays were not limited to msdos. For example, UCSD Pascal used
overlays to emulate a 128k virtual machine on hardware
with only 64k, on hardware that did not have a MMU.
This was brought to you by the Save Our Archaic
Technical Terms Society.