Chain loading

Last updated

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.

Contents

Chain loading is similar to the use of overlays. Unlike overlays, however, chain loading replaces the currently executing program in its entirety. Overlays usually replace only a portion of the running program. Like the use of overlays, the use of chain loading increases the I/O load of an application.

Chain loading in boot manager programs

In operating system boot manager programs, chain loading is used to pass control from the boot manager to a boot sector. The target boot sector is loaded in from disk, replacing the in-memory boot sector from which the boot manager itself was bootstrapped, and executed.

Chain loading in Unix

In Unix (and in Unix-like operating systems), the exec() system call is used to perform chain loading. 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 the process' environment variables, which are preserved across the system call.

Chain loading in Linux

In addition to the exec() process level chain loading Linux supports the kexec() system call to replace the entire operating system kernel with a different version. The new kernel boots as if it were started from power up and no running processes are preserved.

Chain loading in BASIC 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). 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 COM statement [1] can be used in conjunction with CHAIN to specify which variables are to be preserved as common data across a chain operation.

Chain loading permits BASIC programs to execute more program code than could fit into available program and variable memory. Applications written in BASIC could thus be far larger than the size of working memory, via a set of cooperating programs that CHAIN back and forth amongst themselves as program flow moves within the overall application.

Chain loading in FORTRAN programs

Many versions of Fortran include a CALL CHAIN or CALL LINK statement that performs chain loading, preserving the contents of COMMON storage. [2] This is not the same as the unrelated LINK subroutine in GNU Fortran. [3]

Chain loading in OS/360

OS/360 and successors use the XCTL (for "transfer control") macro for chain loading. Because of the operating system's memory management this may or may not result in replacement of the code of the calling program in memory.

See also

Related Research Articles

Emacs Lisp

Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs. It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C, as is the Lisp interpreter. Emacs Lisp is also termed Elisp, although there is also an older, unrelated Lisp dialect with that name.

Booting Process of starting a computer

In computing, booting is the process of starting a computer as initiated via hardware such as a button or by a software command. After it is switched on, a computer's central processing unit (CPU) has no software in its main memory, so some process must load software into memory before it can be executed. This may be done by hardware or firmware in the CPU, or by a separate processor in the computer system.

A terminate-and-stay-resident program is a computer program running under DOS that uses a system call to return control to DOS as though it has finished, but remains in computer memory so it can be reactivated later. This technique partially overcame DOS's limitation of executing only one program, or task, at a time. TSRs are used only in DOS, not in Windows.

GNU GRUB Boot loader package

GNU GRUB is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.

In computer programming, the term magic number has multiple meanings. It could refer to one or more of the following:

In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution. Loading a program involves reading the contents of the executable file containing the program instructions into memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing control to the loaded program code.

In computing, Quark is an operating system kernel used in MorphOS. It is a microkernel designed to run fully virtualized computers, called boxes. As of 2020, only one box is available, the ABox, that lets users run extant AmigaOS software compiled for Motorola 68000 series and PowerPC central processing units (CPUs).

time (Unix) Command in Unix and Unix-like operating systems

In computing, time is a command in Unix and Unix-like operating systems. It is used to determine the duration of execution of a particular command.

Bootloader Software responsible for starting the computer and load other software to the CPU memory

A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer.

CONFIG.SYS is the primary configuration file for the DOS and OS/2 operating systems. It is a special ASCII text file that contains user-accessible setup or configuration directives evaluated by the operating system's DOS BIOS during boot. CONFIG.SYS was introduced with DOS 2.0.

AUTOEXEC.BAT is a system file that was originally on DOS-type operating systems. It is a plain-text batch file in the root directory of the boot device. The name of the file is an abbreviation of "automatic execution", which describes its function in automatically executing commands on system startup; the filename was coined in response to the 8.3 filename limitations of the FAT file system family.

The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel than traditional tracing methods or direct access to kernel memory. Typically, it is mapped to a mount point named /proc at boot time. The proc file system acts as an interface to internal data structures about running processes in the kernel. In Linux, it can also be used to obtain information about the kernel and to change certain kernel parameters at runtime (sysctl).

The Windows NT booting process is the process by which Windows NT 4.0, Windows 2000, Windows XP and Windows Server 2003 operating systems initialize. In Windows Vista and later, this process has changed significantly; see Windows NT 6 startup process for information about what has changed.

In computing, exec is a functionality of an operating system that runs an executable file in the context of an already existing process, replacing the previous executable. This act is also referred to as an overlay. It is especially important in Unix-like systems, although it exists elsewhere. As no new process is created, the process identifier (PID) does not change, but the machine code, data, heap, and stack of the process are replaced by those of the new program.

In a general computing sense, overlaying means "the process of transferring a block 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 would normally use overlays because of the limitation of physical memory, which is internal memory for a system-on-chip, and the lack of virtual memory facilities.

The Windows booting process is the process by which the Microsoft Windows series of operating systems boots.

SpartaDOS X

SpartaDOS X is a disk operating system for the Atari 8-bit family of computers that closely resembles MS-DOS. It was developed and sold by ICD, Inc. in 1987-1993, and many years later picked up by the third-party community SpartaDOS X Upgrade Project, which still maintains the software.

DOS Group of closely related PC-compatible operating systems

DOS is a platform-independent acronym for disk operating system which later became a common shorthand for disk-based operating systems on IBM PC compatibles. DOS primarily consists of Microsoft's MS-DOS and a rebranded version under the name IBM PC DOS, both of which were introduced in 1981. Later compatible systems from other manufacturers include DR DOS (1988), ROM-DOS (1989), PTS-DOS (1993), and FreeDOS (1998). MS-DOS dominated the IBM PC compatible market between 1981 and 1995.

Architecture of Windows 9x

The Windows 9x series of operating systems refers to the kernel which lies at the heart of Windows 9x. Its architecture is monolithic.

References

  1. "HP 2000/Access BASIC" (PDF). bitsavers.trailing-edge.com. HP. p. 11-25. Retrieved 16 January 2020.
  2. IBM Corporation (1974). IBM 1130/1800 Basic FORTRAN IV Language (PDF). p. 14.
  3. "The GNU Fortran Compiler" . Retrieved Oct 27, 2013.