Next: Summary
Up: The Computer
Previous: Representation of information in
When a computer obeys the instructions in a computer program it is said to be running or executing the program. Before a computer can execute a computer program the program must be resident in memory. The program must occupy a set of consecutive bytes in memory and must be written in the internal machine language for the computer. Each CPU has its own machine language which means that before a program can be executed on another CPU it has to be re-written in the internal machine language of the other CPU.
The concept that the program to be executed is stored in the computer memory is an important one. This is what makes the computer such a general-purpose problem-solving machine -- merely by changing the program stored in memory the computer can be used to carry out an entirely different task.
Once the program is loaded into memory then the following sequence is carried out:
set instruction address to the address of the first instruction while program not finished { fetch instruction from current instruction address update current instruction address execute the fetched instruction }This sequence is usually called the fetch-execute cycle.