At its simplest a computer is made up of the following parts, most of them in the system unit.
- A Central Processing Unit (also called a CPU)
- Read-Only Memory (ROM) that holds Permanently Stored instructions.
- Random Access Memory (RAM) to hold software and data.
- Input and Output Devices such as Screen, Keyboard, Mouse and Printer.
- A permanent storage device such as a hard disk, floppy disk or Flash drive.
But what exactly is software?It is the combination of Instructions and Data, known as machine code that forms the building blocks of applications such as Word Processor, Computer Game or Spreadsheet.
This machine code lives in the memory of the computer as billions of little on off switches. Exactly the same as a number in a calculator.
The CPU is the Brain
The heart of the computer is the CPU plus its RAM. The CPU fetches data from RAM, carries out operations on the data and then stores it back in RAM. The CPU can also fetch data from permanent storage such as ROM, floppy disk, Flash or hard disk. It's permanent because when the power is switched off, a copy remains there.
The data in memory (RAM or ROM) is organised in blocks of 8 switches. Each switch is known as bit and a block is a byte. Each bit can be On or Off. When a bit is On, it has the value 1, when its Off it has the value 0. This is called Binary Notation. There are 256 different combinations of 8 bits with the values 0 to 255.
Table of Bit Values
- Bits - Value
- 00000000 - 0
- 00000001 - 1
- 00000010 - 2
- 11111111 - 255
Binary Conversion 101In normal numbers, a value like 456 is made up of 4 x 100 + 5 x 10 + 6 x 1. This is a base 10 number. 10112 is a base 2 number which is equal to 8 x 1 + 4 x 0 + 2 x 1 + 1 x 1 = 11 in base 10. Most programmers don't need or use binary, but in C it can be a useful skill to have.
A CPU handles data in multiples of 8 bits. In the 1980s when Home Computers like the CBM-64 existed, the CPUs were 8 bit processors, reading single bytes of data and could only execute three hundred thousand instructions per second. Now they can handle 64 bits of data in one go. Longer bit length means that the CPU is faster as it processes more data with each instruction.
How Big is a Program?Computer programs can be as small as a few hundred bytes or as large as a few billion bytes. When a program is loaded into RAM from disk, the pattern of the bits is copied exactly- even one bit wrong can cause the program to fail. Computer hardware has been engineered so this doesn't happen.
If an application is 40 Megabytes in size, then roughly 320 Million bits are copied into RAM.
The prefix Kilo, Mega and Giga indicate the size of a program or data file in bytes. A Kilobyte is 1024 bytes, a Megabyte is 1024 Kilobytes and a Gigabyte is 1024 Megabytes. Put another way, a Gigabyte is 8,589,934,592 individual on/off switches!
Instructions are just data
The CPU is driven by machine code instructions and data - this is the stuff of software, just a pattern of bits in RAM. Instructions and data are indistingushable- they're just bit patterns. A typical CPU can read and process hundreds of millions of instructions each second. It is possible to program computers by just entering numbers directly into RAM but it is a very tedious and unproductive way of doing things.
Find out what is a programming language?