Skip to content

32 bit & 64 bit

The evolution from 32-bit to 64-bit systems is one of the most significant milestones in computing history. It was driven primarily by one problem: The 4GB Memory Wall. [[sizeof(pointer)#3. More | What is the 4GB Memory Wall]] Here is the story of that evolution and the technical distinctions between the two architectures.


1. The Evolution: Hitting the Ceiling

The Era of "Enough" (1985–2003)

When 32-bit systems (like the Intel 80386 and later Pentium series) became standard, 4 GB of RAM seemed like an infinite amount of space.

  • Context: In 1995, a high-end PC had 16 MB of RAM.

  • The limit of 4,294,967,296 bytes (4 GB) felt unattainable.

The Crisis (2004–2009)

As software exploded in complexity (3D gaming, video editing, massive databases), applications became "memory hungry."

  • By the mid-2000s, enthusiasts wanted to install 8 GB or 16 GB of RAM to run Windows Vista or Windows 7 smoothly.

  • The Problem: You could physically plug in 8 GB of RAM, but a 32-bit OS (like Windows XP 32-bit) would ignore everything past the 4 GB mark. It physically couldn't "speak" to those memory sticks.

The Solution: x86-64 (AMD64)

Interestingly, AMD (not Intel) created the standard that we use today. They extended the existing 32-bit architecture to 64-bit in a way that was backward compatible. This allowed computers to run old 32-bit programs while gradually adopting new 64-bit capabilities. Intel later adopted this standard.


2. Main Distinctions: 32-bit vs. 64-bit

While memory is the most famous difference, the change affected the processor's "brain" (Registers) and its "highway" (Data Bus).

A. The Address Bus (Memory Capacity) 地址总线

  • 32-bit: Can address  pow(2,32) bytes = 4 GB.

  • 64-bit: Can address pow(2,64) bytes = 16 Exabytes (16 billion Gigabytes).

  • Practical Result: You can load massive files (like a 50GB 4K video file) entirely into RAM for editing, rather than reading it slowly from the hard drive in chunks.

B. The General Purpose Registers (GPRs) 寄存器

The CPU has small, ultra-fast storage slots called Registers where it does math.

  • 32-bit CPU: The registers are 32 bits wide. It can store numbers up to roughly 4 billion in a single cycle.

    • If you need to calculate 5,000,000,000+1: The CPU has to break this big number into two smaller chunks, do two separate additions, and combine them. It takes extra time.
  • 64-bit CPU: The registers are 64 bits wide.

    • Calculation: It can handle massive integers (up to 1.8×pow(10,19)) in a single clock cycle. This makes heavy math (encryption, scientific simulation, high-res graphics) significantly faster.

C. The Data Bus (Throughput) 数据总线

Think of the Data Bus as the highway between the CPU and the RAM.

  • 32-bit: The highway has 32 lanes. The CPU can fetch 4 bytes of data at a time.

  • 64-bit: The highway has 64 lanes. The CPU can fetch 8 bytes of data at a time.

    • Result: The CPU spends less time waiting for data to arrive from memory.

3. Summary of Differences

Feature 32-bit (x86) 64-bit (x64)
Pointer Size 4 Bytes (32 bits) 8 Bytes (64 bits)
Max RAM 4 GB 16 Exabytes (Theoretical)
Register Width 32 bits 64 bits
Integer Math Slower for large numbers Faster for large numbers
Compatibility Can ONLY run 32-bit apps Can run 64-bit AND 32-bit apps

4. What This Means for a C Programmer

If you are writing C code today, the move to 64-bit brings a specific set of changes known as the Data Model. The most common model for Linux/macOS 64-bit is called LP64.

  1. int stays 32-bit: Even though the CPU is 64-bit, the standard int usually remains 4 bytes. Why? Because 4 billion is usually big enough for loop counters (for int i=0...), and using 8 bytes for every single number would waste memory cache.

  2. long and Pointers grow:

    • long becomes 8 bytes (usually).

    • void * (pointers) becomes 8 bytes.

  3. Portability Issues:
    Code that assumed int and pointer were the same size (common in the 1990s) broke when 64-bit systems arrived.

    c // BAD CODE (Works on 32-bit, fails on 64-bit) int *ptr = &variable; int stored_address = (int)ptr; // On 64-bit, 'ptr' is 8 bytes, 'stored_address' is 4 bytes. // You just chopped off half the address! The program will crash.

Correction for Modern Code:
You should use intptr_t (a special type guaranteed to be the same size as a pointer) if you ever need to store an address in an integer variable.