How does a computer work?
This page is created to give you a better understanding of how the personal computer works starting when you press the power button.
Powering on the computer
When you first press the power button, the computer sends a signal to the computer power supply, which converts the AC (alternating current) to DC (direct current). This power supplies the computer and its components with the proper amount of voltage and electricity.
Once the computer and its components have ample power and the power supply reports no errors, it sends a signal (using transistors) to the motherboard and the computer processor (CPU). While this is happening, the processor clears any leftover data in the memory registers and gives the CPU program counter a F000 hexadecimal number. This number tells the CPU that it's ready to process the instructions at this location contained in the basic input/output system (BIOS).
BIOS and the POST
When the computer first looks at the BIOS, it begins the power-on self-test (POST). This sequence makes sure the necessary components are present and functioning properly. If the computer does not pass any of these tests, it encounters an irregular POST. An irregular POST is a beep code that is different from the standard one or two beeps. For example, an irregular POST could generate no beeps or a combination of different beeps to indicate the cause of the failure.
If the computer passes the POST, it looks at the first 64-bytes of memory located in the CMOS chip. This chip is kept alive by the CMOS battery even when the computer is turned off. This chip contains information such as the system time and date and information about all the hardware installed in your computer.
After loading the CMOS information, the POST begins inspecting and comparing the system settings with what is installed in the computer. If no errors are found, it loads the basic device drivers and interrupt handlers for hardware such as the hard drive, keyboard, mouse, and a floppy drive. These basic drivers allow the CPU to communicate with these hardware devices and allow the computer to continue its boot process.
Next, the POST checks the real-time clock (RTC) or system timer and the system bus to make sure both are working. Finally, you'll get a picture on your display after the POST has loaded the memory on the display adapter.
Next, the BIOS checks to see if it's performing a cold boot or warm boot (reboot) by looking at the memory address 0000:0472. If it sees 1234h, the BIOS knows that this is a reboot, and skips the remainder of the POST steps.
If 1234h is not seen, the BIOS knows that this is a cold boot and continues running additional POST steps. Next, it tests the computer memory (RAM) installed in the computer by writing to each chip. Early computers would show this step as the memory was counted during boot.
Finally, the POST sends signals to the computer optical drive and hard drive for testing. If all drives pass the test, the POST is complete and instructs the computer to start loading the operating system.
Loading the operating system
After the computer has passed the POST, it starts the boot process. This process is responsible for loading the operating system and all its associated system files. Because Microsoft Windows is the most commonly used operating system, this section covers loading Microsoft Windows.
The BIOS first hands control over to the bootstrap loader, which looks at the boot sector of the hard drive. If your boot sequence in CMOS setup is not set to look at the hard drive first, it may boot from the first available boot media (e.g., DVD or flash drive).
In this example, the Microsoft Windows 10 bootmgr (Windows boot manager) is found on the boot sector. It tells the computer where to find the remaining code on the hard drive. Next, Windows is loaded, beginning with the Windows splash screen and loading the Windows registry. After loading the registry, Windows begins to load many low-level programs that make up the operating system into memory. Many of the initially loaded programs are what allow Windows to communicate with the essential hardware, and other programs running on the computer.
After the registry has loaded, the initial basic hardware devices, it begins to load plug and play devices, PCI, and ISA devices. After loading all these devices, Windows loads full support of the hard drive, partitions, and any other disk drives, and then moves to all other drivers that are installed.
Finally, after completing the steps above, any additional required services are loaded, and Windows starts.
Hardware devices communicating with the computer
After the computer has loaded the operating system, the hardware attached to the computer must be able to communicate with the CPU. Hardware communication is done using an interrupt request (IRQ). The interrupt controller sends the request (INTR) to the CPU to stop what it's doing to process a new hardware request. Anything being performed by the CPU is put on hold and stored as a memory address in the memory stack. Then, that task resumes when the current (more urgent) task is completed.