Hardware Components
Different approaches to storage resulted in multiple storage components for different purposes, some of which are part of the processing hardware. We also need other components for moving data, dealing with specialized tasks, and communicating between the computer and the outside world.
Main Memory is the short term storage in a computer, used for storing the data and instructions of the current task. Main Memory (MM) is also called RAM, but RAM stands for “Random Access Memory,” and in a modern computer all storage is random access, so this is not a particularly meaningful name.
Main memory can store millions of binary patterns, so we need some way to keep track of where things are. Each pattern is numbered, and this number is called the memory address. The memory address is not the same as the pattern (data or an instruction) at that location in MM. The pattern can be changed at any time. Getting a pattern is called reading, changing a pattern is called writing.
Main memory stores patterns based on power ON and power OFF. When the computer is shut off and no more power is going to main memory, all the patterns are all OFFs, and any patterns that were once there are lost forever. When we turn the computer on again later, we start with all OFFs. Storage that has this property of losing its data when the power goes away is volatile. So main memory is volatile.
If all our storage were volatile, we couldn’t store anything long term. So real computers have a hard drive for long-term storage, which still uses binary patterns but using a different system from ONs and OFFs. The hard drive is non-volatile.
Inside the CPU we need a little bit of storage for the instruction and the data we are working on right at this moment. Storage areas in the CPU are called registers. There is one instruction register and several data registers. These are volatile.
The CPU needs an instruction in the instruction register to tell it what to do. Usually these instructions come from the current program in main memory, but when the computer first turns on, there are no instructions in MM because it is volatile. The hard drive is non-volatile, but the CPU actually needs some instructions just to be able to read from the hard drive. So we need some non-volatile storage that is immediately available to the CPU for start-up instructions.
The ROM (Read Only Memory) is a small storage area that just holds start-up instructions. “Read Only” means that it can not be written to[1], only read from, which makes sense because the very simple instructions to get the computer started never need to be changed.
The registers hold very little and are extremely fast to read from and write to. Main memory is large enough to hold a few programs and their data, and is very fast. The hard drive can hold many many programs and files but is very slow compared to main memory.[2]
It turns out that waiting to get data from main memory often slows the CPU down. So we add one more type of storage, the cache. The cache is sort of like a piece of scratch paper for the CPU. The cache is small storage, faster than MM, attached to the CPU. Data that is used over and over again during the running of one program initially comes from MM, but then is stored in the cache so it can be read/written to faster. When we’re done with it, it can then go back to MM. The cache is volatile.
So, in general, as storage components get farther from the CPU, they get larger, but they also get slower, while the closer to the CPU the faster, but smaller.
The CPU and all of these storage components have to work together to run programs, so most of them are attached to a device called the motherboard that takes care of letting them communicate by providing power and connections between components, for instance there is such a connection, called a bus between the CPU and MM.
Since electrical components are easily damaged, everything is stored in a protective outer case. Power coming in from a plug is controlled by the power system unit and since the electricity they need also heats up components, which damages them, one or more fans cools the system.
Remember that inside the CPU the ALU actually carries out operations on data, which is stored in the data registers, depending on what operation the instruction register is currently storing. Since we want our CPU to do one instruction after another, working through a program stored in MM, we need a way to keep track of what line we’re on. The PC, program counter, is storage in the CPU to keep track of the current MM address, like a bookmark so we don’t lose our place in the program we’re running.
The cache is attached to the CPU (sometimes even as part of the same component. Then a bus allows the CPU to exchange data with MM, and also to other components such as the ROM.
Since the CPU is so much faster than the MM, it will need to wait and not try to do operations on data that MM has not sent yet. To keep all components of the computer working at the same speed, the system clock provides synchronization. You can think of it as a metronome; slower components must keep up with the metronome while faster components wait for the next tick.
Some devices, particularly those that are more commonly replaced, such as the HD are attached to the motherboard through busses, but not located on the motherboard itself. Only the CPU, cache, MM, ROM, and clock are typically built onto the motherboard.
With a CPU and these storage devices, our computer is capable of running programs, but for some tasks, especially input and output, we often add extra devices to take over these so the CPU doesn’t have to do everything. These expansion cards may have their own processing and storage components built in, specialized for jobs such as video and audio processing, or communicating with other computers – networking.
With these extra devices we have a capable computer, but even having devices to process input and output don’t help until we have a way to get information into and out of the case. A port is a hole in the case for data to flow through. There are various types of port for different purposes, but one standard type increasingly used for multiple devices is the USB (Universal Serial Bus) port. If we have several of these we have a place to plug in a mouse, keyboard, and also various outside devices. There should also be a video port to plug a monitor into, an audio port for plugging in speakers, and a network port so our computer can talk to the rest of the world.