Computer Basics

 

A computer (often called simply a machine) is a device for the fast, accurate processing of symbolic information under the control of a stored sequence of instructions called a program.

Figure 1: A simple computer system

Figure 1 is a schematic diagram of a simple computer system.

The control unit controls the operation of the whole machine. It:

The memory

Figure 2: The memory

The memory stores programs and information. It consists of an array of storage units called words, all of equal length and numbered in sequence. The number of each word is called its address.

Each word contains a row of storage elements, which can individually be set to either of two states, conventionally represented as 0 and 1. Thus information is represented by binary codes.

When a program is run, each instruction in sequence is fetched from memory and executed. An instruction can order the control unit to fetch its next instruction from an address other than the next in memory. In this way, different sequences of instructions can be executed. This makes it possible to execute instruction sequences conditionally and iteratively.

Programming Languages

To be executable, a program must be written in the binary machine code recognised by the processor. Machine code programming is difficult and prone to error. Furthermore, since each type of processor has its own machine code, a program written for one type of processor is not executable by any other.

High Level Languages

Today, most programs are written in high level languages, which resemble English and are therefore easier to use than machine code, but which have a limited, specialised vocabulary and a simple syntax free from ambiguity.

FORTRAN (FORmula TRANslation), introduced in 1956, was the first high level language. It has since been revised several times. FORTRAN 77, though not the latest version, is widely available and is compatible with later versions.

High level language instructions are not executable. Instead, a high level language source program is read as input by a program called a compiler, which checks its syntax and, if it is free from errors, compiles an equivalent machine code object program. (If the source program contains syntax errors, the compiler outputs a number of messages indicating the nature of the errors and where they occur.)

Although it is in machine code, the object program is incomplete because it includes references to subprograms which it requires for such common tasks as reading input, producing output and computing mathematical functions. These subprograms are grouped together in libraries which are available for use by all object programs. To create an executable program, the object program must be linked to the subprogram libraries it requires. The executable program may then be loaded into memory and run. The steps required to compile, link and run a FORTRAN program are illustrated by Figure 3.

Figure 3: Compiling, linking and running a FORTRAN program

[Contents]  [Next]  [Home]

NDP77
http://www.ndp77.net
webmaster Massimo F. ARENA
webmaster@ndp77.net
2004:02:14:17:30:17