HOME

TheInfoList



OR:

In a general computing sense, overlaying means "the process of transferring a block of program code or other data into
main 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 comput ...
, 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 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 comput ...
. 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, which is
internal 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 computer ...
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), memo ...
, 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 a general sense object code is a sequence of statements or instructions in a computer language, usually a machine code language (i.e., binary) or an intermediate lang ...
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 daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
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 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 mo ...
, C++,
Smalltalk Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by ...
). 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 ...
(MMU). In addition many embedded systems are real-time systems and overlays provide more determinate response-time than paging. 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 na ...
''Primary Avionics System Software (PASS)'' uses programmed overlays. Even on platforms with virtual memory,
software components Component-based software engineering (CBSE), also called component-based development (CBD), is a branch of software engineering that emphasizes the separation of concerns with respect to the wide-ranging functionality available throughout a giv ...
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 to the point where they can be loaded in and out as needed.


Historical use

IBM introduced the concept of a ''
chain job 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. ...
'' 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 SVC or .svc may refer to: Biology * Spring viraemia of carp, a disease of fish * Superior vena cava, a heart vein Colleges * Saginaw Valley College, now Saginaw Valley State University, Michigan, US * School of Visual Concepts, Seattle, Was ...
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 The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the IBM PC model line and the basis for the IBM PC compatible de facto standard. Released on August 12, 1981, it was created by a tea ...
had between 16K and 64K, depending on configuration. Overlays were a popular technique in Commodore BASIC 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 fi ...
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 computing, 16-bit PC OSes. Rob Ba ...
(consisting of the main executable WS.COM and the overlay modules WSMSGS.OVR, WSOVLY1.OVR, MAILMERGE.OVR and SPELSTAR.OVR, where the " fat" overlay files were even binary identical in their ports for
CP/M-86 CP/M-86 was a version of the CP/M operating system that Digital Research (DR) made for the Intel 8086 and Intel 8088. The system commands are the same as in CP/M-80. Executable files used the relocatable .CMD file format. Digital Research al ...
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 includes the core database engine, a query system, a forms engine, and a programming langua ...
, and the '' Enable'' DOS office automation software package from Enable Software. 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 t ...
(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 * Paging *
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 exampl ...
*
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 mathematic ...


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 #REDIRECT GEOS {{redirect category shell, {{R from other capitalisation{{R from ambiguous page ...
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 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 (occasionally nybble, nyble, or nybl to match the spelling of byte) is a four-bit aggregation, or half an octet. It is also known as half-byte or tetrade. In a networking or telecommunication context, the nibble is ofte ...
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 virtual memory, paging and safe multi-taskin ...
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