# How does a CPU work?

Asked by

PhiNotPi (

12670)
March 1st, 2011

How does a computer’s CPU work?

Observing members:
0
Composing members:
0
## 11 Answers

It’s pretty advanced stuff, but here you have a pretty good article about the inner workings of a microprocessor.

The CPU chip is where hardware meets software. It’s where machine instructions, encoded as a set of digital voltages, are applied to transistor networks to carry out the logic to execute the instruction. This happens during one or a few clock cycles, on the order of nanoseconds or less. Some machine instructions access memory by placing voltages onto address wires and then reading or writing data to the transistors representing bits of data at that address. Others instructions carry out basic arithmetic, process / branching control, input-output, etc., in increasingly complex ways. In every case the CPU “runs code” in hardware, by means of actual voltages and currents (yet digital, hence non-linear) to represent ones and zeroes—not mere “symbolism” as in software.

If interested, read up on TTL and CMOS logic, totem-pole logic gates, & related topics.

My first microcomputer, Imsai kit in 1977, used an Intel 8080A, an 8-bit processor that ran at 2 MHz, accessing up to 64K of memory via a16-bit addresses bus. CPU chips today are obviously bigger and faster by orders of magnitude. Yet hardware meets software in the same manner I described.

LOTS of Yeses & No’s (1s&0s) being put together at unbelievable speed to create something wonderful. Switches at its most basic level.

In my mind it has similarities to the art-form pointillism.

This is the same as asking how advanced quantum mechanics work?

@SuppRatings , No. Its advanced but understandable, not yet in the same league as quantum mechanics.

However, quantum computers Will be coming to a store near you. :)

You know, I REALLY can’t resist answering this one so don’t be offended…..

-You press the ON button. :D

@SuppRatings *This is the same as asking how advanced quantum mechanics works?*

Not really. Quantum mechanics involves the mathematics of complex numbers to represent the wave function. You use differential equations, matrix algebra, and other kinds of math to describe a particle’s quantum states. The operation of a CPU involves Boolean algebra, symbolic logic, systems analysis, etc.—having a different character than quantum mechanics or physics in general.

You may be thinking of the similarity between quantum particles, which are always observed to be either in one state or another but not in between, and bits of digital data, which are constrained to be 0 or 1 but not in between. Good observation! Mathematically this distinction is described as “discrete versus continuous,” akin to digital versus analog.

But while digital information is *inherently* discrete, quantum mechanics uses continuous, “analog” mathematics to calculate probabilities of a particle’s discrete quantum states. So I’d say that’s where the similarity ends.

1 AND 1 = 1

1 AND 0 = 0

0 AND 0 = 0

1 OR 1 = 1

1 OR 1 = 1

0 OR 0 = 0

NOT 1 = 0

NOT 0 = 1

That’s all you need. Group them together and you can do things like 1010 TIMES 1010 = 1100100

Like the T-shirt says: “There are 10 kinds of people—those who know binary and those who don’t.”

@mattbrowne I know how logic gates and circuits work, what I want to know is how so many different things, like different programs or operations, can be done with the same hardware, logic gates and circuits.

CPUs get more and more complex. What was software in the past becomes part of the hardware of the CPU. Another important feature are caches.

## Answer this question

This question is in the General Section. Responses must be helpful and on-topic.