In a general computing sense , '''overlaying''' means "the process of transferring a [[Block (data storage)|block]] of program code or other data into [[main memory ]], replacing what is already stored". <ref name="OED"/> Overlaying is a [[computer programming|programming ]] method that allows programs to be larger than the computer's [[main memory ]]. <ref name="Commodore"/> An [[embedded system ]] would normally use overlays because of the limitation of [[physical memory ]], which is [[internal memory ]] for a [[system-on-chip ]], and the lack of [[virtual memory ]] facilities. ▼
{{Use dmy dates|date=July 2019|cs1-dates=y}}
▲In a general computing sense, '''overlaying''' means "the process of transferring a [[Block (data storage)|block]] of program code or other data into [[main memory]], replacing what is already stored".<ref name="OED"/> Overlaying is a [[computer programming|programming]] method that allows programs to be larger than the computer's [[main memory]].<ref name="Commodore"/> An [[embedded system]] would normally use overlays because of the limitation of [[physical memory]], which is [[internal memory]] for a [[system-on-chip]], and the lack of [[virtual memory]] facilities.
==Usage==
Constructing an overlay program involves manually dividing a program into self-contained [[object code]] blocks called '''overlays''' laid out in a [[tree structure]]. ''Sibling'' segments, those at the same depth level, share the same memory, called ''overlay region'' or ''destination region''. An overlay manager, either part of the [[operating system]] or part of the overlay program, loads the required overlay from [[Auxiliary memory|external memory]] into its destination region when it is needed. Often [[Linker (computing)|linker]]s provide support for overlays.<ref name="GNULink"/> ▼
▲Constructing an overlay program involves manually dividing a program into self-contained [[object code ]] blocks called '''overlays'''over laid out in a [[tree structure ]]. ''Sibling'' segments, those at the same depth level, share the same memory, called ''overlay region'' or ''destination region''. An overlay manager, either part of the [[operating system ]] or part of the overlay program, loads the required overlay from [[Auxiliary memory|external memory ]] into its destination region when it is needed. Often [[Linker (computing)|linker]]slinkers provide support for overlays. <ref name="GNULink"/>
==Example==
The following example shows the control statements that instruct the [[OS/360]] Linkage Editor to link an overlay program, indented to show structure (segment names are arbitrary): ▼
<pre>
INCLUDE SYSLIB(MOD1)
INCLUDE SYSLIB(MOD2)
OVERLAY A
INCLUDE SYSLIB(MOD3)
OVERLAY AA
INCLUDE SYSLIB(MOD4)
INCLUDE SYSLIB(MOD5)
OVERLAY AB
INCLUDE SYSLIB(MOD6)
OVERLAY B
INCLUDE SYSLIB(MOD7)
</pre>
=
<pre>
▲The following example shows the control statements that instruct the [[OS/360]] Linkage Editor to link an overlay program, indented to show structure (segment names are arbitrary):
+--------------+
| Root Segment |
| MOD1, MOD2 |
+--------------+
|
+----------+----------+
| |
+-------------+ +-------------+
| Overlay A | | Overlay B |
| MOD3 | | MOD7 |
+-------------+ +-------------+
|
+--------+--------+
| |
+-------------+ +-------------+
| Overlay AA | | Overlay AB |
| MOD4, MOD5 | | MOD6 |
+-------------+ +-------------+
</pre>
These statements define a tree consisting of the permanently resident segment, called the ''root'',segmen and two overlays A and B which will be loaded following the end of MOD2. Overlay A itself consists of two overlay segments, AA, and AB. At execution time overlays A and B will both utilize the same memory locations; AA and AB will both utilize the same locations following the end of MOD3.
All the segments between the root and a given overlay segment are called a ''path''.
==Applications==
{{As of|2015}}, 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 (e.g. [[Java (programming language)|Java]], [[C++]], [[Smalltalk]]). ▼
Still, overlays remain useful in embedded systems.<ref name="Levine"/> Some low-cost processors used in [[embedded systems]] do not provide a [[memory management unit]] (MMU). In addition many embedded systems are [[Real-time computing|real-time]] systems and overlays provide more determinate response-time than [[paging]]. For example, the [[Space Shuttle]] ''Primary Avionics System Software (PASS)'' uses programmed overlays.<ref name="Shuttle"/> ▼
▲{{As of|2015}}, 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 (e.g. [[Java (programming language)|Java]], [[C++]], [[Smalltalk]]).
Even on platforms with virtual memory, [[Software componentry|software components]] such as [[codec]]s may be [[Coupling (computer science)#Low coupling|decoupled]] to the point where they can be [[Library (computing)#Dynamic loading|loaded in and out as needed]].
▲Still, overlays remain useful in embedded systems. <ref name="Levine"/> Some low-cost processors used in [[embedded systems ]] do not provide a [[memory management unit ]] (MMU). In addition many embedded systems are [[Real-time computing|real-time ]] systems and overlays provide more determinate response-time than [[paging]]. For example, the [[Space Shuttle]] ''Primary Avionics System Software (PASS)'' uses programmed overlays.<ref name="Shuttle"/>
==Historical use==
In the [[home computer]] era overlays were popular because the operating system and many of the computer systems it ran on lacked virtual memory and had very little RAM by current standards: the original [[IBM PC]] had between 16K and 64K, depending on configuration. Overlays were a popular technique in [[Commodore BASIC]] to load graphics screens. In order to detect when an overlay was already loaded, a [[flag (computing)|flag variable]] could be used.<ref name="Commodore"/> ▼
Even on platforms with memory, software components such as codecs overlays were popular because the operating system and many of the computer systems it ran on memory and had very little RAM by current standards: the original had between 16K and 64k. Overlays were a popular technique to load graphics screens.
"Several DOS linkers in the 1980s supported [overlays] in a form nearly identical to that used 25 years earlier on mainframe computers."<ref name="Levine"/> [[Binary file]]s containing memory overlays had a de facto standard extension, '''.OVL'''. This file type was used among others by [[WordStar]], [[dBase]], and the ''Enable'' DOS office automation software package from [[Enable Software, Inc.]]. The [[GFA BASIC]] compiler was able to produce .OVL files.
▲In the [[home computer]] era overlays were popular because the operating system and many of the computer systems it ran on lacked virtual memory and had very little RAM by current standards: the original [[IBM PC]] had between 16K and 64K, depending on configuration. Overlays were a popular technique in [[Commodore BASIC]] to load graphics screens. In order to detect when an overlay was already loaded, a [[flag (computing)|flag variable]] could be used. <ref name="Commodore"/>
== See also ==
* [[Virtual memory]]
* [[Chain loading]]
* [[Paging]]
"Several linkers in the 1980s supported overlays in a form nearly identical to that used 25 years earlier on mainframe computers."
==References==
{{reflist|refs=
<ref name="OED">{{cite web |date=2015-11-26 | url=https://www.oxforddictionaries.com/definition/american_english/overlay |title=Oxford Dictionaries}}</ref>
<ref name="Commodore">{{cite book |author-first=Jim |author-last=Butterfield |url=http://www.atarimagazines.com/compute/issue73/loading_and_linking.php |title=Loading And Linking Commodore Programs |chapter=Part 4: Overlaying |issue=73
|date=June 1986 |page=74 |magazine=[[Compute!]] |quote=This lets you run programs which are, in effect, much larger than the amount of memory in your computer.}}</ref>
<ref name="GNULink">{{cite web |date=2008-06-03 |url=http://sourceware.org/binutils/docs/ld/Overlay-Description.html |title=The GNU Linker documentation: Overlay Description}}</ref>
<ref name="Levine">{{cite book |author-last=Levine |author-first=John R. |author-link=John R. Levine |title=Linkers & Loaders |date=2000 |publisher=[[Morgan Kaufmann Publishers]] |isbn=1-55860-496-0 |url=http://linker.iecc.com/ |page=177}} [http://www.iecc.com/linker/]</ref>
<ref name="Shuttle">{{cite web |title=An Assessment of Space Shuttle Flight Software Development Processes |url=http://www.nap.edu/openbook.php?record_id=2222&page=39 |access-date=2012-10-29}}</ref>
}}
==External links==
* {{cite book |publisher=[[IBM Corporation]] |title=IBM OS Linkage Editor and Loader |id=GC28-6538 |version=Release 21 |date=March 1972 |orig-year=January 1972 |pages=244 |url=http://www.bitsavers.org/pdf/ibm/360/os/R21.0_Mar72/GC28-6538-9_OS_Linkage_Editor_and_Loader_Release_21_Jan72.pdf}}
[[Category:Virtual memory]]
|