Computing Background

The parts of a computer are the central processing unit (CPU), memory, and the disk. In addition there are periperals like the keyboard, mouse, and screen. All these parts are connected by the system bus. The CPU is where the (machine language) instructions of programs are carried out. The CPU contains a few named storage locations called registers (AX, BX, CX, etc) and circuits to carry out the machine language instructions. Memory is fast, temporary, volatile storage. When the computer is off all values stored in memory are lost.

The disk is slower, non-volatile storage. Turning the computer off will not cause the loss of what is stored on the disk. The disk will store the files that you will use for the class. This will include the C/C++ program files that you will write. These are called "source" code. Their names will all end with a .c. In addition you will have the file a.out which will contain the compiled version of one of your source code files. Before running a.out, a copy is loaded into memory. Recall that the complied program consists of machine language instructions. These are instructions that the CPU can execute. Each machine language instruction is executed (carried out) by copying it into the CPU where the circuits of the CPU can execute it.

Memory consists of a large number of storage locations. Each memory location has a content and an address. The content is the value that is stored at the location. The address is the way the CPU can refer to a specific memory location. In the picture above you can see the addresses of some of the memory locations. The contents of locations are not shown. Some of content will be the machine language instuctions; other content will be the values that the program is computing.

Interpretation of Content. The content in each storage location is ultimately binary strings, strings of 0's and 1's. Consider the string

01000001
Depending on the CPU and on how the program uses it, this content is the integer 65, the character A, or the machine instruction INC CX. This machine instruction tells the CPU to make the value stored in the CX register one larger.

CPU Memory Interaction. The CPU interacts with memory with a pair of operations:

WRITE value, address
READ address

The WRITE operation stores the value into the memory location specified by the address. The old content of the location is destroyed. The READ operation copies the content of the memory location specified by the address into the CPU. It does not change the content of the memory location.

Consider the following two machine language instructions:

ADD AX,[100]
MOV [200],AX 
The first instruction says "add the content of address 100 to AX".
The second instruction says "copy the content of AX into the storage location at address 200.
The first instruction does a READ to get a copy of what's stored at address 100 and the second instruction does a WRITE to store the content of the AX register at address 200.

The program