Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 1. Some Basic Ideas > 1.2 WHAT IS A COMPUTER PROGRAM?

1.2 WHAT IS A COMPUTER PROGRAM?

Computer programs perform tasks and solve problems by manipulating data. The data might be the characters that my word processor is assembling right now to form this sentence, the text and images comprising a Web page or again the satellite navigation signals and other information needed to fly an airliner across a continent.

Representing data appropriately so that they may be stored and manipulated correctly and efficiently is a study area of major concern. Inside the machine, all items of data are stored as 'bits' of binary logic, just as are the program's instructions. In the early days of computing, programming involved working at this very low level, translating instructions and data into 0's and 1's and flipping switches in order to store them in the machine's limited memory, before executing the program. Writing programs using 'machine code' was tedious, prone to error and involved mental gymnastics on the part of the programmer to transform the problem to be solved into operations to move numbers around between the various parts of the machine's hardware.

Figure 1.1. Executing a program


The program is executed by a processor using an 'instruction set'. These low-level operations include

  • storing and retrieving items from the machine's memory;

  • arithmetic operations—adding, subtracting values;

  • logical operations—comparing items for equality or inequality.

Both the instructions and data of the program are held in the machine's main storage, 'random access memory' (RAM), which consists of a number of locations to which items may be written and from which they may be retrieved. Each has its own unique address; although these are shown in Figure 1.1 in denary or decimal (base-10) form, hexadecimal notation (base-16) is the more conventional form in that large values can be expressed compactly.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint