Course Content
Part 1: What Does the CPU Really Do?
What Is a CPU and Why Is It So Important? The Difference Between RAM, Storage, and the CPU What Happens When You Click a Button on Your Computer?
0/4
Part 5: How the CPU Talks to Memory and Storage
This part will explain how the CPU and memory are like two people trying to talk across a busy room — and why the CPU needs clever helpers like RAM and cache instead of going straight to the hard drive.
0/4
Part 6: Paths and Highways: How CPUs Talk to Everything
So far, we’ve learned how the CPU works with RAM, cache, and storage. But the CPU doesn’t live alone — it has to talk to memory, graphics cards, USB sticks, and more.
0/4
How Computers Think: Inside the CPU

🧩 Quick Recap First!

Before we dive in, let’s remind ourselves:

  • The CPU is the part of the computer that follows instructions.

  • It follows these instructions using the Fetch → Decode → Execute cycle.

  • Inside the CPU are tiny parts called registers, an ALU (Arithmetic Logic Unit), and a control unit.

  • The CPU works one tick at a time — billions of ticks every second!

Now, let’s talk about how this little brain does math — using nothing but switches!

 

🔌 What Do We Mean by “Switches”?

A switch is just something that can be on (1) or off (0). You can think of it like:

  • A light switch: ON = 1, OFF = 0

  • A button: Pressed = 1, Not pressed = 0

  • Electricity flowing = 1, No electricity = 0

That’s it. Nothing fancy.

Now imagine this: If we connect lots of tiny switches together, we can build machines that add numbers, subtract, and even multiply.

Let’s see how.

 

➕ Step 1: How to Add Two Bits

Let’s start really small.

What’s a bit again?

A bit is just one switch. It can be:

  • 0 (off)

  • 1 (on)

Let’s try adding two bits together:

A (bit 1) B (bit 2) A + B = ?
0 0 0
0 1 1
1 0 1
1 1 10

Wait! What’s “10” doing there?

Let’s explain…

 

🔄 What Happens When 1 + 1 = 10?

Remember: Computers count in binary (just 0s and 1s).
In binary:

  • 0 + 1 = 1

  • 1 + 0 = 1

  • 1 + 1 = 2 → which is 10 in binary.

So, when we add 1 + 1 in the CPU, the answer is:

  • 0 on the bottom

  • And a carry of 1 to the next column.

Just like how we carry in normal math:

markdown
 
   1
+ 1
----
 
   0 (carry 1)

This is the start of something called a half-adder.

 

🔀 What’s a Full-Adder?

A full-adder adds:

  • One bit

  • Another bit

  • And a carry bit from before

It gives you:

  • A new sum bit

  • And a new carry bit

This is how CPUs add big numbers — by lining up lots of full-adders, side by side!

 

🧠 Let’s Add Two 4-Bit Numbers

Let’s say we want to add:

  • 0101 (which is 5 in decimal)

  • 0011 (which is 3 in decimal)

We feed them into 4 full-adders like this:

 

   0101
+ 0011
 ———-
   1000

 

5 + 3 = 8!
That’s 1000 in binary.

Cool, right?

 

🧮 What Part of the CPU Does This?

This job is handled by the ALU — the Arithmetic Logic Unit.

It’s like the calculator inside your CPU.

  • It takes in two binary numbers

  • It runs them through the adders

  • It gives you a result — fast

No fingers. No calculator. Just switches!

 

➖ What About Subtraction?

Subtracting is just like adding — but with a little trick.

Let’s say we want to do:

 

5 – 3 = 2

 

In binary:

  • 5 = 0101

  • 3 = 0011

The CPU uses a special math trick called “two’s complement” to turn subtraction into addition.

It’s like saying:

 

5 + (-3) = 2

 

So instead of building a new subtractor, the CPU just uses the same adder to do both jobs.

Smart!

 

🧮 How Big Can CPUs Add?

Early computers could only add 8-bit numbers.

Now we have:

  • 32-bit CPUs → Add numbers up to 4 billion

  • 64-bit CPUs → Add huge numbers

More bits = more powerful math.

But it’s still all built from tiny switches doing simple things!

 

⚙️ Where Do the Switches Live?

All these switches (called transistors) live inside the CPU chip.

In fact:

  • Your CPU might have billions of these switches

  • All packed into a space smaller than your fingernail

So when you click “Add” on your calculator app —
Billions of little switches wake up and do math for you.

 

💡 Recap: How the CPU Adds and Subtracts

  • The CPU adds numbers using special circuits called adders

  • It uses binary (0s and 1s) to count

  • It handles subtraction by a cool trick called two’s complement

  • Everything is built from simple switches

  • The ALU is the part of the CPU that does this work.

 

 

0% Complete