Skip to content

Computer Organization (Hardware · Software · System Bus) ​

A computer system is broadly divided into hardware and software. Hardware is the physical machinery you can see, and software is a bundle of instructions that tells that machine "what to do, and in what order."

At a Glance ​

  • Analogy: think of a computer as a restaurant.
    • Hardware is the kitchen equipment (stove, fridge, counter).
    • Software is the recipes and the kitchen's operating rules. No matter how good the equipment is, no food comes out without a recipe, and the same is true if you have a recipe but no equipment.
  • Inside the hardware, the CPU (the cook), memory (the fridge and counter), and input/output devices (the order window and the serving window) are connected by the system bus (the kitchen aisle) and pass ingredients and signals to each other.

Hardware and Software ​

CategoryMeaningExamples
HardwareThe mechanical devices that make up a computerCPU, memory (RAM, HDD/SSD), input/output devices (mouse, printer)
SoftwareA set of instructions that directs and controls how the hardware operatesThe two kinds below

Software is further divided into two kinds.

  • System software: software that manages the hardware and provides the foundation for other programs to run. Operating systems and compilers belong here. Operating systems are covered in detail in What Is an Operating System.
  • Application software: programs that users use to get specific tasks done. Word processors, spreadsheets, and web browsers belong here.

Hardware Components ​

Hardware consists of the Central Processing Unit (CPU), memory, and input/output devices, which are connected by the system bus. The system bus carries data, instructions, and control signals to each device.

text
 [ CPU ]            [ Memory ]            [ I/O devices ]
 compute/control    RAM, ROM, etc.        keyboard, monitor, etc.
    │                    │                     │
════╪════════════════════╪═════════════════════╪════  Data bus    : data travels (bidirectional)
════╪════════════════════╪═════════════════════╪════  Address bus : CPU sends addresses (unidirectional)
════╧════════════════════╧═════════════════════╧════  Control bus : read/write/interrupt signals (bidirectional)

        The three buses together are called the "system bus"

The figure below shows how data, programs, and control signals flow between the devices. The control unit and the arithmetic unit inside the CPU exchange information with the input devices, output devices, and secondary storage, with main memory in the middle.

Flow of data, programs, and control signals between hardware components

Image source: gyoogle tech interview notes, Computer Organization

Central Processing Unit (CPU) ​

This is the part that corresponds to a person's brain. It reads program instructions and data from main memory, processes them, and controls the order in which instructions are executed.

The CPU is made up of three parts.

ComponentWhat it doesRestaurant analogy
Arithmetic Logic Unit (ALU)Calculations like addition and logical operations like comparing sizesThe actual cooking, like chopping and stir-frying
Control unitInterprets instructions and sends the signals needed for execution to each deviceThe head chef who reads the recipe and directs the order
RegistersVery fast, small storage spaces inside the CPUA small plate right next to the cook's hands

In small computers like personal computers, the CPU is built as a single chip, so it is also called a microprocessor. The CPU's internal operation is covered in detail in How a CPU Works.

Memory ​

Devices that store programs, data, and intermediate results produced during computation. They are divided into main memory and secondary storage.

  • Main memory: memory that the CPU can read and write directly. RAM and ROM belong here.
    • RAM: stores the currently running programs and the data they need temporarily. Its contents disappear when the power is turned off (volatile).
    • ROM: read-only memory whose contents remain even when the power is off (non-volatile). It holds programs that rarely change, such as the firmware (BIOS/UEFI) that runs first when the computer is turned on.
  • Secondary storage: devices such as hard disks (HDD) and SSDs. Slower than main memory, but they can keep far more data permanently.

As an analogy, RAM is the counter (not very big, but right at hand, and cleared at the end of the day), and secondary storage is the storeroom (large and keeps things for a long time, but it takes time to go get things). How programs divide up RAM is covered in Memory Layout, and how the operating system manages memory is covered in Memory Management.

Input/Output Devices ​

These are divided into input devices and output devices.

  • Input devices: devices that put data into the computer. Keyboard, mouse, etc.
  • Output devices: devices that present results from inside the computer to the outside. Printer, monitor, speakers, etc.

System Bus ​

A pathway (a bundle of wires) that physically connects hardware components

It creates paths so that each component can send data to other components. By purpose, it is divided into three kinds: the data bus, the address bus, and the control bus.

As an analogy, it is similar to a parcel delivery system. The data bus is the road the packages travel on, the address bus is the address written on the shipping label, and the control bus is a request form like "please deliver this / please return this."

The address bus, data bus, and control bus connecting the CPU with RAM, ROM, and input/output devices

Image source: Wikimedia Commons (Public domain)

In the figure, the yellow address bus has one-way arrows going out from the CPU, while the light blue data bus and the pink control bus have two-way arrows.

Data Bus ​

The pathway that carries data between the CPU and other devices.

It sends instructions and data from memory and I/O devices to the CPU, and also sends the CPU's computation results to memory and I/O devices. Because data travels both ways, it is a bidirectional bus.

Address Bus ​

To deliver data to exactly the right place, the memory address has to be specified first.

The address bus is the pathway through which the CPU tells main memory or an I/O device the address, that is, "which location to read (or write)." Addresses are decided and sent only by the CPU, so it is a unidirectional bus.

  • The number of wires (width) of the address bus determines how many addresses can be pointed to. For example, with 32 address lines, it can point to 2 to the 32nd power, or about 4.3 billion addresses (4GB in bytes).
  • For reference, in methods like DMA, where a device moves data directly to memory without going through the CPU, a device other than the CPU (the DMA controller) may also put out addresses. As a basic concept, understanding it as "the CPU puts out addresses" is enough.

Control Bus ​

Since the address bus and the data bus are shared by all devices, there needs to be a way to decide whose turn it is to do what right now.

The control bus is the pathway that carries such control signals. The kinds of control signals are as follows.

  • Memory read and write
  • Bus request and grant
  • Interrupt request and acknowledgment (see Interrupts)
  • Clock (timing signal), reset

The control bus is considered bidirectional. The reason, though, is less "because it does both reading and writing" and more because signals travel in both directions.

  • CPU → device: signals like "read," "write," "bus use granted"
  • Device → CPU: request signals like "I want to raise an interrupt," "I want to use the bus"

Each individual wire usually carries signals in only one direction, but looking at the control bus as a whole, signals travel both ways.

The Basic Flow of How a Computer Works ​

A computer basically repeats the process of reading, processing, and then storing.

text
READ → PROCESS → WRITE

Throughout this process, the CPU constantly exchanges data with main memory (RAM).

It is often explained that "on a 64-bit computer, the CPU reads 64 bits at a time from RAM." To be a bit more precise:

  • The number 64 bits refers not to the operating system but to the size of data the CPU handles at once (word size, register size). A 64-bit operating system is one built for this 64-bit CPU, and even if you install a 32-bit operating system on a 64-bit CPU, the CPU's own word size remains 64 bits.
  • In practice, modern CPUs fetch data from RAM not 64 bits (8 bytes) at a time, but usually in 64-byte chunks (cache lines) all at once, and keep them in cache memory. This is because nearby data is likely to be used again soon.

Summary ​

ConceptPlain-language summary
HardwareThe machinery you can see (CPU, memory, keyboard, etc.)
SoftwareBundles of instructions that tell the machine what to do (operating system, apps, etc.)
CPUThe brain that calculates and directs (ALU + control unit + registers)
Main memoryThe counter where what's in use right now is placed (RAM is wiped when the power is off, ROM remains)
Secondary storageThe large storeroom that keeps things long-term (HDD, SSD)
System busThe roads connecting devices. Three kinds: data, address, and control buses
Data busThe road actual data travels on (bidirectional)
Address busThe road that tells "which location" (from the CPU to devices, unidirectional)
Control busThe road for signals like "read/write/interrupt" (bidirectional)