What is a Computer?
Computers are everywhere. You're probably reading this on a computer right now. It was sent to your computer by another computer. In between those two computers were lots of other computers, running the internet. Smartphones are computers, tablets are computers and lots of other things have computers 'inside them'. Most cars made today have at least one computer in them and increasingly everyday objects like TVs and even toasters have computers inside them. So, what is a computer? What do all these things have in common?
All of these devices are 'connected' to other things, usually with electrical connections, which allow them to interact with the world by receiving 'inputs' and producing 'outputs'. The way they produce outputs, based on a particular set of inputs, is determined by their 'programming' and this is what makes them computers. Simply put, a computer is any device that can be 'programmed'.
What Makes Up a Computer?
To be 'programmable' a computer must have some way for us to get information into it and some way for us to get the 'results' out. It also needs some way to store our program, expressed as a series of instructions for the computer to carry out, which it does in a component called its 'memory'.
The last and most important thing every computer has is a 'processor' which is connected to everything else in the computer and carries out the instructions that make up our program. The instructions we can use are determined by the manufacturer of the computer and make up its 'instruction set'.
Basically every computer in the world, then, has input and output methods, memory and a processor. The way these components are arranged together is referred to as 'von Neumann' architecture after the pioneering researcher John von Neumann (date-date).
There are lots and lots of other components inside a computer, but they're all there to facilitate the working of these main elements.
Input and Output
If a computer wasn't connected to the outside world in any way, there would be no point in it running at all, because we'd never know the result of its work. Computers are only useful at all because they can receive input and produce output.
The computer in your toaster may receive input from a thermometer and send output to a heater and a magnet to hold toast in place.
The computer in an iPad is connected to its own screen, to the touch digitiser, to the ports, to the network.
Memory and Processors
Modern electronic computers all store and transmit information in 'binary', meaning that it is encoded using only two states - the famous "1's and 0's". The size of the memory of the computer is measured in terms of how many ones and zeroes it can store. Typically this is a very large number, measured in the billions.
The 'clock speed' of a processor tells us how many instructions it can carry out each second. A typical number is 2Ghz, meaning it can carry out about two billion instructions each second.
This is an astronomical number, necessarily so. Even when it appears to be doing nothing, a computer has to do very many things each second. As well as running any programs that you or I have given it, it has to update all its outputs and scan all its inputs.
In practise, the processor of a computer is always managed by a piece of software called an Operating System or, more specifically, a Kernel which is responsible for parcelling out time to each of the processes that need to run during each tiny slice of time. The two billion instructions per second get divided up so that the screen knows what to show, the music keeps playing, the keyboard keeps responding to presses and the cursor moves with the mouse in addition to the computer running each of the programs that appear to be running 'at the same time'. In a way, it's all just a trick.
What is a Program?
The most fundamental kind of program, like we mentioned above, in a computer is one expressed as 'machine code'.
Most programs are not written in machine code. Instead they are written in languages which are easier for humans to use and then one of two things happens to them. They are either 'compiled' or they get 'interpreted'.