DEV Community

Cristian Sifuentes
Cristian Sifuentes

Posted on

CPUs & RAM Explained — How Computers Actually Think and Remember

CPUs & RAM Explained — How Computers Actually Think and Remember

CPUs & RAM Explained — How Computers Actually Think and Remember

Every modern device you use — laptops, phones, ATMs, smart TVs, even car dashboards — relies on two core components:

the CPU (processor) and memory (RAM).

They are the thinking and remembering parts of a computer.

Understanding how they work together is a foundational skill for any software engineer. This article explains CPUs and RAM from the ground up — not as marketing terms, but as real physical systems built from transistors, electricity, and time.


What Is a CPU?

The CPU (Central Processing Unit) is the component responsible for executing instructions.

Every calculation, comparison, loop, condition, or function call in your code eventually becomes an operation executed by the CPU.

At a high level, the CPU:

  • Performs mathematical operations
  • Moves data between memory locations
  • Makes decisions (branching)
  • Coordinates the execution of programs

It does all of this using one fundamental building block: the transistor.


The Role of Transistors Inside a CPU

Internally, a CPU is made up of billions of transistors.

A transistor is an electronic switch that can:

  • Allow electricity to pass
  • Block electricity

By combining transistors, CPUs can perform:

  • Addition
  • Subtraction
  • Multiplication
  • Logical comparisons
  • Data movement and storage

Every instruction your program executes — even something as simple as:

C = A + B
Enter fullscreen mode Exit fullscreen mode

is broken down into electrical operations performed by transistors.


CPU Speed and Hertz (Hz)

When we talk about CPU speed, we usually talk about frequency, measured in Hertz (Hz).

  • 1 Hz = one electrical cycle per second
  • 1 MHz = one million cycles per second
  • 1 GHz = one billion cycles per second

A higher frequency means:

  • More cycles per second
  • More instructions executed per second

However, higher speed also means higher electrical current — and that produces heat.


Heat: The Hidden Limiting Factor

CPU performance is directly limited by temperature.

  • Higher speed → more current
  • More current → more heat
  • Too much heat → instability or damage

That’s why CPUs require:

  • Fans
  • Heat sinks
  • Advanced cooling systems

Modern processors are often limited not by design, but by how effectively they can dissipate heat.


How CPUs Are Manufactured

CPUs are built primarily from silicon, element number 14 on the periodic table and the main component of sand.

The manufacturing process begins by purifying sand and forming a crystal called a wafer.

This wafer is processed using extreme ultraviolet (EUV) lithography, a cutting-edge technology developed mainly by ASML, a Dutch company.

EUV lithography uses a highly focused laser and specialized photomasks to “print” transistors at an atomic scale — often placing them just 10 to 25 atoms apart.

This is one of the most advanced manufacturing processes humanity has ever created.


What Is RAM?

RAM (Random Access Memory) is the CPU’s working memory.

RAM stores:

  • Variables
  • Intermediate calculations
  • Program state
  • Data currently in use

RAM is fast, but it is also temporary:

  • When the computer turns off, RAM is cleared

Memory Hierarchy: Not All Memory Is Equal

CPUs interact with multiple layers of memory, each with different speed and capacity:

Registers & Cache (On-Chip Memory)

  • Located inside the CPU
  • Extremely fast (1–20 nanoseconds)
  • Very limited capacity

RAM

  • Slower than cache (~70 nanoseconds)
  • Much larger capacity
  • Stores active programs and data

Storage (SSD / HDD)

  • Very slow compared to RAM
  • Stores data permanently
  • Data must be loaded into RAM before the CPU can use it

💡 Key rule:

The CPU cannot execute code directly from disk — everything must pass through RAM first.


CPU Architectures: Different Ways to Think

CPUs are built using different architectures, each optimized for different goals.

x86

  • Common in desktops and laptops
  • Optimized for general-purpose computing

RISC

  • Simpler instruction sets
  • Common in servers and high-performance environments

ARM

  • Designed for energy efficiency
  • Dominates mobile devices and modern laptops
  • Prioritizes battery life

Each architecture represents a different philosophy of computation.


CPU Cores: Parallel Thinking

To increase performance, manufacturers can:

  • Shrink transistors
  • Increase clock speed
  • Add multiple cores

Each core is effectively a mini CPU capable of executing instructions independently.

Processors like Intel Core i3, i5, and i7 often share the same base architecture. The difference comes from:

  • Number of enabled cores
  • Cache size
  • Power limits

Chips are tested extensively, and their final classification depends on how many cores pass quality control.


Assembly Language: Speaking the CPU’s Language

Assembly language is the closest human-readable language to what the CPU actually understands.

During compilation:

  • High-level code (C#, Java, Python, etc.)
  • Is translated into assembly
  • Then converted into machine instructions

When the CPU executes code like:

A = 1
B = 2
C = A + B
Enter fullscreen mode Exit fullscreen mode

It:

  • Allocates memory addresses in RAM
  • Loads values into registers
  • Executes arithmetic using transistors
  • Stores the result back into memory

All software — no matter how abstract — eventually becomes electrical activity.


Why This Matters for Software Engineers

Understanding CPUs and RAM helps you:

  • Write more efficient code
  • Understand performance bottlenecks
  • Reason about memory usage
  • Debug low-level issues
  • Design better systems

Abstractions are powerful — but mastery comes from understanding what lies beneath them.


Final Thoughts

The CPU doesn’t “think” like a human.

It switches transistors on and off — billions of times per second — guided by your code.

RAM doesn’t “remember” intelligently.

It temporarily holds electrical states so the CPU can work efficiently.

Together, they form the physical foundation of everything we build in software.


✍️ Written by Cristian Sifuentes

Software engineering fundamentals, systems thinking, and architecture

Top comments (0)