Initialization system

Computer programs require services from the operating system they run on. If nothing else, they at least need a way to exit once finished. In any event, there is bound to be some "bookkeeping" or "housekeeping" needed to be done in order for the program to start. This can do things like open a console (for programs running in text mode) or a window (for graphical programs). It might also need to request memory for variables and arrays. It might need to set up file handles for any files that are used. Then, once this is done, the program itself can be run. If the language is powerful enough, it may be able to install the initialization code into itself at the start of the program. Otherwise, it requires an initialization system, written in another language (usually assembly language) to create an initialization system. There are two ways it can be done:


 * 1) The program issues a subroutine call to the external initialization system before doing anything. When the initialized returns, the program can begin.
 * 2) The program is operated through a run-time system that does all necessary housekeeping, then transfers control to the program.
 * 3) The initializer is given control first, by being inserted before the program. When the initializer is finished, it jumps to the first byte that is after itself, that the user's program could be located at. Or, it's located after the program, then jumps to the lowest address it could be loaded at.
 * 4) The program indicates that it should start with the initializer first. The initializer then calls a specific named program, which, whenever a program is using that initializer, has as its external name or an alias.