Representing Programs

All types of data are stored inside the computer as numbers. What the number represents depends on the type of information being stored:

What about programs that manipulate this data, though? How are they represented?

Representing a Program

You might have heard that what distinguishes a general purpose computer from something like a calculator is that the program - the intructions - are stored in the primary storage (e.g. RAM) and can be changed, just like other data. This also means that those instructions need to be stored in the form of numbers.

Instruction Set

Just as a computer has a character set - a set of characters or symbols that can be represented in text - it also has an instruction set, which is the set of instructions that the processor can perform. Each processor type, or family of processors, will have its own instruction set, which is why applications tend to run on only one type of device - e.g. you can't run Windows applications on an iPhone.

Below is a small extract from the ARM instruction set. ARM is a type of RISC processor that powers most mobile and other low-powered devices.

Section of ARM instruction set

The second column is the OpCode, which is the number representing the action to be performed. It's in binary form, so you can see for example that subtraction is represented by the number 2 and addition by the number 4. This is the number that would be stored in the RAM and fetched and decoded during the Fetch-Decode-Execute cycle.

CISC and RISC

Some processors, such as the Intel and AMD processors found in Windows PCs, can have a large instruction set and can therefore perform a wide range of actions with a single instruction. These are called CISC (Complex Instruction Set) devices. Mobile devices often contain a processor with a smaller number of possible instructions - a RISC (Reduced Instruction Set Computer) processor. The "missing" instructions in a RISC processor can often be reproduced by using a number of simpler instructions - in the same way that you can multiply by using repeated addition.

The simpler RISC chips are usually physically smaller and use less power, making them suitable for mobile devices that run on batteries. They sometimes run more quickly than CISC processors due to a process called pipelining and also some other reasons explained in the video below.

British computer manufacturer Acorn introduced one of the first commercially-available RISC processors back in the 1980s, and ARM originally stood for Acorn RISC Machine. In this introductory video to the ARM processor from 1987, designer Roger (now Sophie) Wilson explains what makes it so fast.