How does a computer work?

The role of a computer is to perform the instructions of a program. To run a program, it must be loaded into the main memory along with the data that the program handles. The main memory or RAM is volatile, meaning that it is lost when we turn off the computer.

Who loads the programs into the memory?

The programs are usually loaded by the operating system (OS), from a nonvolatile storage unit (in a PC this unit is usually the hard drive). But the operating system is a program so... Who loads the operating system?.

Who loads the operating system into the memory?

The operating system is loaded into memory by a program known as firmware. This firmware program is usually stored in a nonvolatile memory (ROM, Flash, etc..). The firmware is a small program which handles little more than the loading of the operating system, leaving to the operating system all the other tasks.

How to run a program

Once the machine code of the program is loaded into memory, the operating system tells the CPU, the memory address where the first instruction of the program is. The CPU stops executing the "Operating System" and begins to run the program.

Once they are running, the programs have full control over the computer. Today most modern computers limit this control.

Program interaction with input and output devices.

A program usually communicates with the user using the screen, keyboard and mouse. They can also read and write files stored on disks or connect to other computers using local network or internet.

In modern systems, programs perform these tasks using functions provided by the operating system. Often these functions are incompatible betweeen different systems. In an attempt to reduce the differences, languages ​​like Java and standards- such as Network Sockets, OpenGL (Open Graphics Library) for graphics-, have been developed.


Multitasking is the ability of most modern computers to run several programs at once. In fact, every program can run for a few milliseconds, giving us the impression that they are running simultaneously.

Limitation of the control of the computer

We have already mentioned that a running program can have the control of the computer. This can be very dangerous especially when the computer is multitasking. A program might interfere (maliciously or by mistake) on a running program or on the operating system.

Different mechanisms have been developed to restrict this absolute control. The protected and supervised modes, interruptions and other techniques are seen in more detail in "Operating System: What is it and how does it work?"