
In a general computing sense, overlaying means "the process of transferring a
block
Block or blocked may refer to:
Arts, entertainment and media Broadcasting
* Block programming, the result of a programming strategy in broadcasting
* W242BX, a radio station licensed to Greenville, South Carolina, United States known as ''96.3 ...
of program code or other data into
main memory
Computer data storage or digital data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processin ...
, replacing what is already stored".
Overlaying is a
programming method that allows programs to be larger than the computer's
main memory
Computer data storage or digital data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processin ...
.
An
embedded system
An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
would normally use overlays because of the limitation of
physical memory, which is
internal memory for a
system-on-chip
A system on a chip (SoC) is an integrated circuit that combines most or all key components of a computer or electronic system onto a single microchip. Typically, an SoC includes a central processing unit (CPU) with memory, input/output, and da ...
, and the lack of
virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
facilities.
Usage
Constructing an overlay program involves manually dividing a program into self-contained
object code
In computing, object code or object module is the product of an assembler or compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' ...
blocks called overlays or links, generally laid out in a
tree structure
A tree structure, tree diagram, or tree model is a way of representing the hierarchical nature of a structure in a graphical form. It is named a "tree structure" because the classic representation resembles a tree, although the chart is gen ...
. ''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
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
or part of the overlay program, loads the required overlay from
external memory into its destination region when it is needed; this may be automatic or via explicit code. Often
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
s provide support for overlays.
Example
The following example shows the control statements that instruct the
OS/360
OS/360, officially known as IBM System/360 Operating System, is a discontinued batch processing operating system developed by IBM for their then-new System/360 mainframe computer, announced in 1964; it was influenced by the earlier IBSYS/IBJOB a ...
Linkage Editor to link an overlay program containing a single region, indented to show structure (segment names are arbitrary):
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)
+--------------+
, Root Segment ,
, MOD1, MOD2 ,
+--------------+
,
+----------+----------+
, ,
+-------------+ +-------------+
, Overlay A , , Overlay B ,
, MOD3 , , MOD7 ,
+-------------+ +-------------+
,
+--------+--------+
, ,
+-------------+ +-------------+
, Overlay AA , , Overlay AB ,
, MOD4, MOD5 , , MOD6 ,
+-------------+ +-------------+
These statements define a tree consisting of the permanently resident segment, called the ''root'', 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
, most business applications are intended to run on platforms with
virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
. A developer on such a platform can design a program as if the memory constraint does not exist unless the program's
working set
Working set is a concept in computer science which defines the amount of memory that a process (computing), process requires in a given time interval.
Definition
Peter_J._Denning, Peter Denning (1968) defines "the working set of information W(t ...
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
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
C++,
Smalltalk
Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
).
Still, overlays remain useful in embedded systems.
Some low-cost processors used in
embedded systems
An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is em ...
do not provide a
memory management unit
A memory management unit (MMU), sometimes called paged memory management unit (PMMU), is a computer hardware unit that examines all references to computer memory, memory, and translates the memory addresses being referenced, known as virtual mem ...
(MMU). In addition many embedded systems are
real-time systems and overlays provide more determinate response-time than
paging
In computer operating systems, memory paging is a memory management scheme that allows the physical Computer memory, memory used by a program to be non-contiguous. This also helps avoid the problem of memory fragmentation and requiring compact ...
. For example, the
Space Shuttle
The Space Shuttle is a retired, partially reusable launch system, reusable low Earth orbital spacecraft system operated from 1981 to 2011 by the U.S. National Aeronautics and Space Administration (NASA) as part of the Space Shuttle program. ...
''Primary Avionics System Software (PASS)'' uses programmed overlays.
Even on platforms with virtual memory,
software components such as
codec
A codec is a computer hardware or software component that encodes or decodes a data stream or signal. ''Codec'' is a portmanteau of coder/decoder.
In electronic communications, an endec is a device that acts as both an encoder and a decoder o ...
s may be
decoupled to the point where they can be
loaded in and out as needed.
Historical use
IBM introduced the concept of a ''
chain job''
in
FORTRAN II. The program had to explicitly call the CHAIN subroutine to load a new link,
and the new link replaced all of the old link's storage except for the Fortran COMMON area.
IBM introduced more general overlay handling
in
IBSYS/
IBJOB, including a tree structure and automatic loading of links as part of CALL processing.
In OS/360, IBM extended the overlay facility of
IBLDR by allowing an overlay program to have independent overlay regions, each with its own overlay tree. OS/360 also had a simpler overlay system for transient
SVC routines, using 1024-byte SVC transient areas.
In the
home computer
Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
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
The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the List of IBM Personal Computer models, IBM PC model line and the basis for the IBM PC compatible ''de facto'' standard. Released on ...
had between 16K and 64K, depending on configuration. Overlays were a popular technique in
Commodore BASIC
Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the Dialect (computing), dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the Commodore PET, PET (1977) to the Commodore ...
to load graphics screens.
"Several
DOS linkers in the 1980s supported
verlaysin a form nearly identical to that used 25 years earlier on mainframe computers."
Binary file
A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file". Many binary file formats contain parts that can be interpreted as text; for example, some computer document files ...
s containing memory overlays had de facto standard extensions .OVL
or .OVR
(but also used numerical file extensions like .000, .001, etc. for subsequent files
). This file type was used among others by
WordStar
WordStar is a discontinued word processor application for microcomputers. It was published by MicroPro International and originally written for the CP/M-80 operating system (OS), with later editions added for MS-DOS and other 16-bit computing, ...
(consisting of the main executable
WS.COM
and the overlay modules
WSMSGS.OVR
,
WSOVLY1.OVR
,
MAILMERGE.OVR
and
SPELSTAR.OVR
, where the "
fat
In nutrition science, nutrition, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such chemical compound, compounds, most commonly those that occur in living beings or in food.
The term often refers specif ...
" overlay files were even binary identical in their ports for
CP/M-86 and MS-DOS
),
dBase
dBase (also stylized dBASE) was one of the first database management systems for microcomputers and the most successful in its day. The dBase system included the core database engine, a query system, a Form (programming), forms engine, and a pr ...
,
and the ''
Enable'' DOS office automation software package from
Enable Software.
Borland
Borland Software Corporation was a computing technology company founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad, and Philippe Kahn. Its main business was developing and selling software development and software deployment products. B ...
's
Turbo Pascal
Turbo Pascal is a software development system that includes a compiler and an integrated development environment (IDE) for the programming language Pascal (programming language), Pascal running on the operating systems CP/M, CP/M-86, and MS-DOS. ...
and the
GFA BASIC compiler were able to produce .OVL files.
See also
*
Expanded memory
In DOS memory management, expanded memory is a system of bank switching that provided additional memory to DOS programs beyond the limit of conventional memory (640 KiB).
''Expanded memory'' is an umbrella term for several incompatible tech ...
(EMS)
*
Virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
*
Chain loading
*
Paging
In computer operating systems, memory paging is a memory management scheme that allows the physical Computer memory, memory used by a program to be non-contiguous. This also helps avoid the problem of memory fragmentation and requiring compact ...
*
Bank switching
Bank switching is a technique used in computer design to increase the amount of usable memory beyond the amount directly addressable by the Processor (computing), processor instructions. It can be used to configure a system differently at diffe ...
*
Recursion
Recursion occurs when the definition of a concept or process depends on a simpler or previous version of itself. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in m ...
Notes
References
Further reading
* (2+244+4 pages)
* {{cite newsgroup , title=GEOS/NDO info for RBIL62? , author-first1=Marcus , author-last1=Groeber , author-first2=Edward "Ed" , author-last2=Di Geronimo, Jr. , author-first3=Matthias R. , author-last3=Paul , date=2002-03-02 , orig-date=2002-02-24 , newsgroup=comp.os.geos.programmer , url=https://groups.google.com/d/msg/comp.os.geos.programmer/8NNPJ4VU23A/cucVV95kf9oJ , access-date=2019-04-20 , url-status=live , archive-url=https://archive.today/20190420111421/https://groups.google.com/forum/%23!msg/comp.os.geos.programmer/8NNPJ4VU23A/cucVV95kf9oJ , archive-date=2019-04-20 , quote=
��The reason
Geos needs 16 interrupts is because the scheme is used to convert inter-segment ("far") function calls into interrupts, without changing the size of the code. The reason this is done so that "something" (the kernel) can hook itself into every inter-segment call made by a Geos application and make sure that the proper code segments are loaded from
virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
and locked down. In
DOS terms, this would be comparable to an overlay loader, but one that can be added without requiring explicit support from the compiler or the application. What happens is something like this:
��1. The real mode compiler generates an instruction like this: CALL
: -> 9A
with normally being defined as an address that must be fixed up at load time depending on the address where the code has been placed. ��2. The Geos linker turns this into something else: INT 8xh -> CD 8x ��DB ,, ��Note that this is again five bytes, so it can be fixed up "in place". Now the problem is that an interrupt requires two bytes, while a CALL FAR instruction only needs one. As a result, the 32-bit vector () must be compressed into 24 bits. ��This is achieved by two things: First, the address is encoded as a "handle" to the segment, whose lowest nibble
In computing, a nibble, or spelled nybble to match byte, is a unit of information that is an aggregation of four- bits; half of a byte/ octet. The unit is alternatively called nyble, nybl, half-byte or tetrade. In networking or telecommuni ...
is always zero. This saves four bits. In addition ��the remaining four bits go into the low nibble of the interrupt vector, thus creating anything from INT 80h to 8Fh. ��The interrupt handler for all those vectors is the same. It will "unpack" the address from the three-and-a-half byte notation, look up the absolute address of the segment, and forward the call, after having done its virtual memory loading thing... Return from the call will also pass through the corresponding unlocking code. ��The low nibble of the interrupt vector (80h–8Fh) holds bit 4 through 7 of the segment handle. Bit 0 to 3 of a segment handle are (by definition of a Geos handle) always 0. ��all Geos API run through the "overlay" scheme �� when a Geos application is loaded into memory, the loader will automatically replace calls to functions in the system libraries by the corresponding INT-based calls. Anyway, these are not constant, but depend on the handle assigned to the library's code segment. ��Geos was originally intended to be converted to protected mode
In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units (CPUs). It allows system software to use features such as Memory_segmentation, segmentation, virtual mem ...
very early on �� with real mode
Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20- bit s ...
only being a "legacy option" ��almost every single line of assembly code is ready for it ��}
External links
* http://computer-programming-forum.com/29-pascal/45df7513ab22cf7e.htm
Virtual memory