How a Computer Operates
By Charles Hopkins
Published 04/23/2006 | Computer
The average person who uses a computer on a regular basis doesn't think about what happens inside a computer once the power is turned on. As long as their version of MS Windows pops up within a few seconds, most people are quite content to continue on with what they want to do on their computer. A computer goes through many processes from the moment the power is turned on before its operating system (ex. Windows, Linux) is fully loaded and takes over.
The operating system is stored on the hard disk of a computer. It is stored on the hard disk because this type of storage is much less expensive and an operating system requires a large amount of storage space. So, in order to make computers more economical, they are designed to use a combination of ROM, DRAM, and hard disks. An explanation of each follows.
Once the power switch is turned on, the "boot-up" process begins. To "boot-up" a computer simply means to start it. Electricity then flows through all of the chips and their circuits. The instructions for what the computer is supposed to do next are found in the Read Only Memory, Basic Input/Output System (ROM BIOS). ROM is memory that can only be read from and has information that is permanently burned into it. It is nonvolatile and will not be lost or disappear once the power is turned off.
ROM BIOS or just BIOS, is designed to begin giving commands as soon as it receives power. The BIOS contains an entire set of instructions, in effect a computer program written into the chip that manages the boot-up process. Without the BIOS, the computer would not know what to do next. The first task that BIOS completes is to make sure that all of the hardware components are working properly (for example: disk drives, external buses, the mouse, the printer). This is called a power-on self-test (POST). After the POST is complete, the BIOS activates other chips on different cards installed in the computer (SCSI and graphics cards) and provides a set of low-level routines that the operating system uses to interface to different hardware devices such as the keyboard, mouse, printer, etc.
Once the POST is complete, the BIOS hands the next stage in the boot-up process over to the central processing unit (CPU). The CPU is a one chip processor or microprocessor that has two distinct capabilities:
1. The CPU carries out all of the mathematical and logical operations including basic math and comparisons of two or more numbers.
2. The CPU has the ability to intelligently manage the flow of instructions and data going into and out of its circuits.
The last instruction that the ROM sends to the CPU is to go to a specific location or address to find its next instruction. An address is a string of numbers that gives directions to where something can be found, much like an address on an envelope. Computers use addresses to keep track of information much the same way as the post office uses them to find residences and businesses. The bigger the number in an address the more locations it can refer to. Most current computers use a 32-bit address space for memory, which means that there can be over four billion separate locations to hold information.
The instruction that the ROM BIOS wants the CPU to carry out is sent through a chip on a bus (a set of wires) to the address specified. The data bus is able to carry information into and out of the chip within the CPU. The information is not available within the CPU so it has to look elsewhere. The CPU then sends the address on another bus called an address bus. When the CPU does this, it is called a fetch. The address bus is "fetching" information from elsewhere within the computer. The address bus is only able to carry instructions out of the CPU.
The address bus fetches information from the computer's memory. Memory is a type of silicon chip that can hold instructions or data. This type of memory can be read from or written to by the CPU, but this type of memory or Dynamic Random Access Memory (DRAM) is volatile. Once the power is turned off, the DRAM looses its memory or information. Since the DRAM is basically a blank slate, the CPU has within, a set of sequential instructions as to where to look for the required information.
Before the address bus can get to memory, it has to pass through a set of chips called a chipset. The chipset refers to a group of chips that provide an intelligent interface for the core components of a computer - CPU, memory, graphics, I/O system, described as core logic or glue logic. If the information that the chipset requires is not in memory, the chipset then sends or redirects it to the Input/Output (I/O) bus. The I/O bus connects the chipset to other places where the information is stored, such as the hard disk. The hard disk allows the CPU to read from it and to write to it. The hard disk is non-volatile so it retains its data or information once the power is turned off. A hard disk is much slower at retrieving data from than memory but memory is much more expensive.
Once the hard disk receives the address (via the I/O bus and chipset), it retrieves the information and sends it back through the chipset and then puts it on the address bus back into the CPU. The chipset functions as a bridge for the two buses; the I/O bus and the address bus.
The CPU uses a four step sequence: fetch, decode, execute, and store. Since the CPU does not retain its memory, it has to obtain its information or fetch the information from elsewhere within the computer. To help with the speed of the process of fetching, the CPU has a pre-fetch area to make the information available more quickly.
Once the information has been fetched, it has to be decoded. Part of the decoding process of the CPU is to decide which circuits are appropriate to use for executing the instructions. Once that decision has been made, the CPU begins to execute the instructions. The part of the CPU where the actual execution of instructions takes place is called the Arithmetic Logical Unit (ALU). The ALU includes groups of transistors, known as logic gates, which are organized to carry out basic mathematical and logical operations. Logic gates are grouped into electrical circuits that execute the CPU's instructions such as "add" two numbers or "compare" two numbers.
The final step of the CPU is to store the information. This final step takes place after the ALU completes its calculations. The results of the calculations are stored on a chip that has an area called a register. Registers can be accessed more quickly than any other kind of memory but are only for temporary holding (storage) of information.
The CPU also has a clock within it to keep the timing of all of the flow of information and processes of the computer. This clock is vital to the synchronization of all of the processes of the computer. This CPU clock controls all of the operations on its chip. The processes of the CPU can also be interrupted by an external interrupt controller chip which is part of the chipset. The chipset contains a small database of interrupt vector (numerical table). When an interrupt signal comes onto the chip, the CPU saves what it is doing and goes to the interrupt vector to find the address of the instruction that the interrupt is telling it to execute instead. Once it is finished with the interrupt, it goes back to what it was doing. The CPU finds what it was doing in a register called a stack. If interrupts were not possible, the CPU would have to complete one task before it could start another causing the speed to be greatly reduced.
Now that the CPU has found the operating system, loaded it into memory, the operating system takes over and the computer is now ready to be used by its owner. The user can now check email, play a game, or do whatever they wanted to do when they started the computer.