Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area (a so-called core common area) to pass information from the current program to the new program. Computer programs (also software programs, or just programs) are instructions for a Computer. The core common area is that area of a computer program wherein Data can remain between the end of execution of one program and the start of execution of a subsequent program It occurs in several areas of computing.
Chain loading is similar to the use of overlays. In a general computing sense overlaying means "replacement of a block of stored instructions or data with another" Overlaying is a programming method that allows programs Like the use of overlays, the use of chain loading increases the I/O load of an application. In Computing, input/output, or I/O, refers to the communication between an Information processing system (such as a Computer) and the outside Unlike overlays, however, chain loading replaces the currently executing program in its entirety. Overlays usually replace only a portion of the running program.
Contents |
In operating system boot manager programs, chain loading is used to pass control from the boot manager to a boot sector. In Computing, booting ( booting up) is a bootstrapping process that starts Operating systems when the user turns on a Computer system A boot sector (sometimes called a bootblock) is a sector of a Hard disk, Floppy disk, or similar Data storage device that contains The target boot sector is loaded in from disk, replacing the boot sector from which the boot manager itself was bootstrapped, and executed. A hard disk drive ( HDD) commonly referred to as a hard drive, hard disk, or fixed disk drive, is a Non-volatile storage device
In Unix (and in Unix-like operating systems), the exec() system call is used to perform chain loading. Unix (officially trademarked as UNIX, sometimes also written as Unix with Small caps) is a computer A Unix-like (sometimes shortened to *nix) Operating system is one that behaves in a manner similar to a Unix system while not necessarily conforming In Operating systems an overlay is when a process replaces itself with the code of another program The program image of the current process is replaced with an entirely new image, and the current thread begins execution of that image. The common data area comprises data such as the process' environment variables, which are preserved across the system call. In computing a process is an instance of a Computer program that is being sequentially executed by a computer system that has the ability to run several computer Environment variables are a set of dynamic values that can affect the way running processes will behave on a computer
Chain loading is extensively used in toolsets written by Daniel J. Bernstein, for example. Daniel Julius Bernstein (sometimes known simply as djb; born October 29, 1971) is a Professor at the University of Illinois at Chicago Programs such as Bernstein's envuidgid and setuidgid are intended to be chain loaded from other programs, and themselves chain load to yet further programs having made alterations to the process' execution environment in between. In use, Bernstein's tools often comprise a series of programs, each chain loading to the next. For example:
exec envuidgid safeuser tcpserver -U 0 80 httpd /webroot
This idea is often referred to as Bernstein chaining, but the fundamental technique is as old as the getty and login programs.
In BASIC programs, chain loading is the purview of the CHAIN statement (or, in Commodore BASIC, the LOAD statement), which causes the current program to be terminated and the chained-to program to be loaded and invoked (with, on those dialects of BASIC that support it, an optional parameter specifying the line number from which execution is to commence, rather than the default of the first line of the new program). In Computer programming, BASIC (an Acronym for Beginner's All-purpose Symbolic Instruction Code) is a family of High-level programming languages Commodore BASIC, also known as PET BASIC, is the dialect of the BASIC programming language used in Commodore International 's 8-bit Home In Computing, a line number is a method used to specify a particular sequence of characters in a Text file. The common data area varies according to the particular dialect of BASIC that is in use. On BBC BASIC, for example, only a specific subset of all variables are preserved across a CHAIN. On other BASICs, the COMMON statement can be used in conjunction with CHAIN to specify which variables are to be preserved as common data across a chain operation.
Chain loading is used in BASIC programs in order to permit the execution of more program code than could fit in the working memory available for program and variable storage. Applications written in BASIC could thus be far larger than the size of working memory, by comprising a set of cooperating programs written to CHAIN back and forth amongst themselves as program flow moved amongst various areas of the overall application.