Computer program

A computer program tells a computer what to do. Typically, what to do to or with some data. 'Program' is generally considered as a separate concept/entity from 'data'.

Running a Program

To run a program, the computer is initialized to a starting state by loading the program and perhaps the data and then some mechanism to begin is invoked. At the lowest level this is begun with a boot sequence.

In most computers, an operating system loads and executes programs. In this context, a computer program refers to the individual executable image rather than all the programming currently running on the computer.

The Von Neumann Architecture

In a computer with the most common Von Neumann architecture or Harvard architecture the program is loaded from a peripheral device of some kind, often a hard drive. In a machine following the Von Neumann architecture, the program is loaded into main memory. The instruction sequence are then executed in order until a jump or branch instruction is executed or an interrupt occurs. These instructions change the program counter.

A computer program consists of a set of instructions that the computer understands. A computer of this architecture without a program does absolutely nothing.

The instructions in a computer program are in machine code; they are usually originally written in a computer programming language, and translated to machine code using a computer program called a compiler or an interpreter. Sometimes the programming language is simply a set of abbreviations for the machine code instructions, called assembly language -- in this case, a program called an assembler is used to make the translation.

Software

Program is sometimes used as a synonym for "software"; although the main part of any software is programs, software also often includes resource files that contain data of some kind; these are not part of the program per se.

Neural Networks

In neural network computers, many computing units with many connections between these units work in concert to solve problems. While there are many architectures following this general model, the programming of these computers often consists of weights on each connection and thresholds within the nodes. As the machine 'learns', these weights and thresholds change. In most neural networks, the learned state can be saved and later restored, making it a computer program.

Some neural networks learn from scratch every time they are turned on, and don't have programs, per se.

Virtual Machines

Many programs today run in a virtual machine. An idealized instruction set is created on top of the actual instruction set of the machines that run the program inside of the virtual machine. Many non Von Neumann machines exist only as simulations implemented as virtual machines and have not been constructed using hardware.

Analog Computers

In analog computers, as opposed to digital computers, the states saved are not discrete values like the zeros and ones of most common computers, but are rather saved as a more continuous value. For example, in the Water integrator the initial state was set by setting valve flow rates, and the amount of water in various containers of the machine.

Certain insectoid autonomous robots are good examples of this type of computer that has no program in the classic sense. They are hard wired and learn from their environment.

Data

Computer programs are generally assumed to be that part of the computer's initial state that is not data. While this distinction is trivial in most digital Von Neumann type computers, it gets much more difficult to quantify in other architectures. Are the weights in a neural network data or program? In a simulation of a neural network, they are clearly implemented as data, however they simulate program for the virtual machine. It's even more fuzzy for most analog computers. For example, is the water in a Water integrater program or data?

Algorithms

An abstract program is sometimes called an algorithm.

Computer programs are now also the subject of mathematics - for example, algorithmic information theory studies the behavior of idealized computers executing randomly generated computer programs.

An alternative British spelling is computer programme, although this is rare and the British spelling in this context is generally 'program'.

See also




copyright 2004 FactsAbout.com