Overlay (programming)

from Wikipedia, the free encyclopedia
Schematic representation

An overlay is a part of a computer program that is loaded into an area of ​​the main memory that is alternately shared by several program parts (overlays) and executed there.

Problem

For many years the available RAM memory in computers was insufficient to load complex executable programs as a whole.

In the 1960s, even mainframe computers only had small maximum storage sizes in the range of a few 100 kB, and decidedly too little for complex computer programs. Therefore, methods were developed from a relatively small main program, in which, for example, all memory areas for permanent data were created, to dynamically load subroutines (and additional subroutines) to the main program (using level techniques), using the previously loaded program code of the same level has been overwritten.

This was controlled via control commands in the source code of the entire program (package). Here as an example (from a FORTRAN programming manual for a CDC 6400, 1971):

  Hauptprogramm
     ...
     CALL OVERLAY (filename1, Mainlevel1, SubLevel0, ...ggf. weitere Parameter) *1
     CALL OVERLAY (filename2, Mainlevel1, SubLevel1, ...ggf. weitere Parameter) *2
     ...
     CALL OVERLAY (filename3, Mainlevel1, SubLevel2, ...ggf. weitere Parameter) *3
     ...
     CALL OVERLAY (filename4, Mainlevel2, SubLevel0, ...ggf. weitere Parameter) *4
     ...
  Ende Hauptprogramm
  OVERLAY (filename1, Mainlevel1, Sublevel0, … ggf. weitere Parameter)
     Fortran-Code für das gesamte OVERLAY Paket 1.0
     END
  OVERLAY (filename2, Mainlevel1, Sublevel1, … ggf. weitere Parameter)
     Fortran-Code für das gesamte OVERLAY Paket 1.1
  END
  OVERLAY (filename3, Mainlevel1, Sublevel2, … ggf. weitere Parameter)
     Fortran-Code für das gesamte OVERLAY Paket 1.2
  END
  OVERLAY (filename4, Mainlevel2, Sublevel0, … ggf. weitere Parameter)
     Fortran-Code für das gesamte OVERLAY Paket 2.0
  END

The entire program package was compiled by the compiler and the overlay parts in the lower part were written individually into the respective files (filename1,… 2,…). The only media available were actually data drums and tape devices. After starting the main program, the overlay parts were then reloaded: * 1 loads the first package and immediately afterwards the first sub-package (* 2). With * 3 the overlay loaded with * 2 is overwritten. And with * 4 the entire overlay loaded with * 1, * 2 and then * 3 is replaced.

In the 1970s the size of the available memory increased rapidly and the (time consuming) overlay technique was almost forgotten.

With the advent of highly integrated semiconductor devices existing microcomputer in the 1980s to disposal using the 8 bit - microprocessors Intel 8080 and Zilog Z80 under the operating system CP / M -80 only about a maximum of 64 kilobytes of memory. The IBM PCs with the 16-bit processor 8088 from Intel could not use more than 640 kilobytes of RAM under the MS-DOS operating system . The size of an executable program, including the necessary data areas, was therefore limited to this maximum size of the available main memory. The "old" overlay technique was remembered again.

Overlay

As an emergency solution to such problems, it was decided in special cases to modularize computer programs and split them into parts that did not have to be executed at the same time. These were implemented as separate program files. In order to use them individually, the maximum required memory area has been reserved in the RAM. Such a module could be temporarily loaded and executed as an overlay and, if necessary, dynamically replaced by another module that had to be reloaded there. Overlay files were mostly identified by the file extension OVR or OVL, but there were no binding conventions.

software

The programmer had to take care of the division into overlays and initially also the reloading, i.e. program this functionality. In some cases, overlays were also supported by programming systems - for example by later versions of Turbo Pascal  . The modularization in program files according to the instructions of the programmer was done by the compiler or linker , the memory management and the reloading by the runtime system .

A program in Turbo Pascal 3.0 could be imagined in the following form:

program meinprojekt;
overlay procedure kundenverwaltung;
...
overlay procedure warenverwaltung;
...
{ Hauptprogramm }
begin
while input <> "ende" do begin
  case input of
  "kunden": kundenverwaltung;
  "waren": warenverwaltung;
  end;
end;
end.

From Turbo Pascal version 5.0 onwards, the term overlay is used at the unit level.

Professional use

WordStar, a software formerly based on overlays

In times of limited hardware, professional software in particular was affected by the problem of memory shortage due to its necessary functionality. One of the programs known at the time for modularization in overlays is the word processing software WordStar with the main program WS.COM and the overlay modules WSMSGS.OVR, WSOVLY1.OVR, MAILMERGE.OVR and SPELSTAR.OVR. The database program dBASE was also modularized accordingly. Even the space shuttle software Primary Avionics System Software (PASS) uses overlays.

Current meaning

Due to the further development in the field of hardware and software, overlays are generally of little importance. At most , overlays are still useful in small, relatively simple systems such as embedded systems .

The overlay technique with the aid of kernel modules is also used in some live operating systems that are designed to make economical use of the RAM memory .

Modern computer systems with sufficient main memory and linear addressing as well as operating systems with efficient memory management make overlays superfluous or no longer allow them. A functionality similar to the overlays can be implemented if required with dynamic link libraries (under Windows DLLs ) and loading at runtime.

literature

  • Rudolf Herschel, Ernst-Wolfgang Dieterich: Turbo Pascal 7.0 . 2nd Edition. Verlag Oldenbourg, 2000, ISBN 3-486-25499-5 , p. 249.
  • Alan Mabbett: Getting started with WordStar, MailMerge + SpellStar . Cambridge University Press, 1985, ISBN 0-521-31805-X (English)

Web links

Individual evidence

  1. Announcement dBASE IV, Version 1.1. (PDF) Ashton Tate, July 31, 1990, accessed February 13, 2014 .
  2. An Assessment of Space Shuttle Flight Software Development Processes. The National Academies Press, accessed February 13, 2014 .