Overlay (programming)
From Wikipedia, the free encyclopedia
In a general computing sense, overlaying means "replacement of a block of stored instructions or data with another"[1] 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 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[2]
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 did 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 (e.g. 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.[citation needed] 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.
[edit] References
- ^ Oxford Dictionaries (Feb 19, 2007).
- ^ The GNU Linker (Feb 19, 2007).