Sunday, June 7, 2009

Self-modifying programs

A computer program in execution is normally treated as being different from the data the program operates on. However, in some cases this distinction is blurred when a computer program modifies itself.

The modified computer program is subsequently executed as part of the same program. Self-modifying code is possible for programs written in Machine code, assembly language, Lisp, COBOL, PL/1 and Prolog, among others.

Typically, computer programs are stored in non-volatile memory until requested either directly or indirectly to be executed by the computer user. Upon such a request, the program is loaded into random access memory, by a computer program called an operating system, where it can be accessed directly by the central processor.

The central processor then executes ("runs") the program, instruction by instruction, until termination. A program in execution is called a process.[6] Termination is either by normal self-termination or by error — software or hardware error.

No comments:

Post a Comment