In a general computing sense, overlaying means "replacement of a block of stored instructions or data with another" Overlaying is a programming method that allows programs to be larger than the central processing unit‘s main memory. An embedded system would normally use overlays because of the limitation of physical memory, which is internal memory for a system-on-chip.
The method assumes dividing a program into self-contained object code blocks called overlays. The size of an overlay is limited according to memory constraints. The place in memory where an overlay is loaded is called an overlay region or destination region. Although the idea is to reuse the same block of main memory, multiple region systems could be defined. The regions can be different sizes. An overlay manager, possibly part of the operating system, will load the required overlay from external memory into its destination region in order to be used. Some linkers provide support for overlays
Overlay programming requires the program designer to be very aware of the size of each part of the program. This meant using programming languages or assemblers that allow the designer or architect control over the size of the program and more importantly, the size of the overlay. This constraint added many design difficulties that do not exist with virtual memory.
As of 2007, most business applications are intended to run on platforms with virtual memory. A developer on such a platform can design a program as if the memory constraint does not exist unless the program’s working set exceeds the available physical memory. Most importantly, the architect can focus on the problem being solved without the added design difficulty of forcing the processing into steps constrained by the overlay size. Thus, the designer can use higher-level programming languages that do not allow the programmer much control over size (i.e. Java, C++, Smalltalk).
Still, overlays remain popular in embedded systems because many cannot use virtual memory. When a program enters a part that has been paged out, the virtual memory may not respond in time, causing a real-time computing system to miss deadlines. The delay of loading an overlay is more predictable. In addition, paging hardware is not without cost, and in many embedded systems sold in millions of units, the reduction in manufacturing costs from simpler hardware outweighs the extra cost of programmer time. Even on platforms with virtual memory, software components such as codecs may be decoupled to the point where they can be loaded in and out as needed.
Overlays as a solution is the past operating systems and the programmer was suffering from this issue