Overlay (programming)
   HOME

TheInfoList



OR:

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, replacing what is already stored". Overlaying is a programming method that allows programs to be larger than the computer's main memory. An
embedded system An embedded system is a 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 ''embedded'' ...
would normally use overlays because of the limitation of
physical memory Computer 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 processing unit (CPU) of a compute ...
, which is internal memory for a
system-on-chip A system on a chip or system-on-chip (SoC ; pl. ''SoCs'' ) is an integrated circuit that integrates most or all components of a computer or other electronic system. These components almost always include a central processing unit (CPU), memor ...
, 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 very ...
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 a compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ...
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 genera ...
. ''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, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also i ...
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 ...
Linkage Editor In computing, a linker or link editor is a computer system program that takes one or more object files (generated by a compiler or an assembler) and combines them into a single executable file, library file, or another "object" file. A simple ...
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 very ...
. 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 Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
,
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, Smalltalk). Still, overlays remain useful in embedded systems. Some low-cost processors used in
embedded systems An embedded system is a 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 ''embedded'' ...
do not provide a
memory management unit A memory management unit (MMU), sometimes called paged memory management unit (PMMU), is a computer hardware unit having all memory references passed through itself, primarily performing the translation of virtual memory addresses to physical a ...
(MMU). In addition many embedded systems are
real-time Real-time or real time describes various operations in computing or other processes that must guarantee response times within a specified time (deadline), usually a relatively short time. A real-time process is generally one that happens in defined ...
systems and overlays provide more determinate response-time than
paging In computer operating systems, memory paging is a memory management scheme by which a computer stores and retrieves data from secondary storage for use in main memory. In this scheme, the operating system retrieves data from secondary storage ...
. For example, the
Space Shuttle The Space Shuttle is a retired, partially 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. Its official program ...
''Primary Avionics System Software (PASS)'' uses programmed overlays. Even on platforms with virtual memory, software components such as
codec A codec is a device or computer program 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 on a signal or ...
s may be
decoupled '' Decoupled'' is an Indian English-language comedy web series for Netflix written by Manu Joseph and directed by Hardik Mehta. The series stars R. Madhavan and Surveen Chawla in the lead roles. Plot A misanthropic writer and his startup-foun ...
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 IBSYS is the discontinued tape-based operating system that IBM supplied with its IBM 709, IBM 7090 and IBM 7094 computers. A similar operating system (but with several significant differences), also called IBSYS, was provided with IBM 7040 an ...
/
IBJOB IBSYS is the discontinued Magnetic tape data storage, tape-based operating system that IBM supplied with its IBM 709, IBM 7090 and IBM 7094 computers. A similar operating system (but with several significant differences), also called IBSYS, was p ...
, 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 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 Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET of 1977 to the C128 of 1985. The core is based on 6502 ...
to load graphics screens. "Several
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
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 fil ...
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 word processor application for microcomputers. It was published by MicroPro International and originally written for the CP/M-80 operating system, and later written also for MS-DOS and other 16-bit PC OSes. Rob Barnaby was the so ...
(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, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such compounds, most commonly those that occur in living beings or in food. The term often refers specifically to triglycerides (triple est ...
" overlay files were even binary identical in their ports for CP/M-86 and MS-DOS), dBase, and the '' Enable'' DOS office automation software package from
Enable Software Enable Software, Inc. was a privately held software development company located in Ballston Lake, New York. Enable was founded in 1984 by Ron Quake and Bob Hamilton. The company's flagship product, called ''Enable'' was an integrated office suite ...
. Borland's
Turbo Pascal Turbo Pascal is a software development system that includes a compiler and an integrated development environment (IDE) for the Pascal programming language running on CP/M, CP/M-86, and DOS. It was originally developed by Anders Hejlsberg at ...
and the
GFA BASIC GFA BASIC is a dialect of the BASIC programming language, by Frank Ostrowski. The name is derived from the company ("GFA Systemtechnik GmbH"), which distributed the software. In the mid-1980s to the 1990s it enjoyed popularity as an advanced BA ...
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 tec ...
(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 very ...
*
Chain loading Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program. It occurs in several areas of computing. ...
*
Paging In computer operating systems, memory paging is a memory management scheme by which a computer stores and retrieves data from secondary storage for use in main memory. In this scheme, the operating system retrieves data from secondary storage ...
*
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 instructions. It can be used to configure a system differently at different times; for example ...
*
Recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathemati ...


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 very ...
and locked down. In
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
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 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 very early on €¦ with real mode 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