# Why do we need so many transistors in a chip, and how are they managed?

My knowledge is very vague as all we have are visual diagrams etc, but we have memory address and registers, the ALU being the heart(apparently). Single core CPUs process one instruction at a time AFAIK and multi-core have parallelism to some degree. So where do the millions of transistors come in and how do 32 registers manage everything. We have FPU's I know, how many transistors would these use roughly. Any way to get a fairly simple idea of what the bulk of the transistors do, why more means faster and how the registers 'manage' everything.

-
I think this is below the resolution of CS; maybe this question would be better off on Electrical Engineering? (This question may be helpful.) –  Raphael Feb 7 at 7:50
Why do you say that the registers manage the CPU? That seems like saying that a piece of paper on my desk manages me; isn't it the other way around? –  David Richerby Feb 7 at 10:43
fairly similar to this question how does a computer work. the question seems to be about how the different transistors are allocated across different fns of the cpu. actually ALU mentioned takes a significant part... as for last question "how the registers 'manage' everything" is not very meaningful, registers do not "manage" anything, its more eg that a compiler "manages" the use of registers through optimization etc.... one can write working code that uses almost no registers. –  vzn Feb 7 at 16:07
Why does more transistors = more processing power? on the Electrical Engineering SE might be of interest. (I am somewhat proud of my answer there, but it might be a little too technical.) –  Paul A. Clayton Feb 7 at 16:24

This is a huge question. To fully answer it would take far more space than you'd want to read (not to mention that I suspect that there's a limit on the length of any SE answer), but I'll try to give you an idea of what goes on in the CPU.

First, a transistor (when used in a CPU) is essentially a switch, like a light switch except that you don't have to turn it on or off manually. Rather, it is controlled by an electrical current. The most important thing to understand is that modern computers are two-state devices: the only thing that really matters is whether a wire has a current or not.

One then begins the process of chip design by, for example, deciding how an integer (or other data) will be represented. For integers, say, the chip designers generally decide to them by ganging wires together in a logical unit, so with a collection of four wires it would be possible to represent 16 possible patterns: $\mathtt{0000}, \mathtt{0001}, \dots \mathtt{1111}$, where a pattern like $\mathtt{1101}$ would represent a voltage in wires 1, 2, and 4, and no voltage in wire 3 and this collection might be interpreted as the number 13. In this example, we'd have what's known a a 4-bit chip. A modern computer would have either 32 or 64 wires treated as a unit.

It happens that with a suitably-connected collection of switches (aka transistors), one can do things like add two numbers, compare two numbers for equality, decide whether a number is zero or not, and so on. Often, all of these operations are often done at once, simultaneously, and the relevant one is chosen by the current instruction, which determines which of the various results to use, and where that result will be sent. All of this traffic control is also controlled by switches, depending on what the current instruction is (in the program being executed). In addition, things like memory and registers which store information can also be implemented by these switches.

To get a feel for the number of transistors used, an adder circuit in a $n$-bit computer might require about, say, $20n$ transistors, an $n$-bit register might require $50n$ transistors, and the traffic control circuitry to sent the results to the right place might require several hundred more for each bit. It's not hard to imagine that with a lot of functionality and a wide data path (the number of wires ganged together) a modern CPU could easily take millions of transistors.

As to why "more [transistors] means faster", the answer is "not necessarily", but in general, doubling the width of the data path, say from 32 bits to 64, gives you the ability to manipulate larger numbers in a single instruction at the cost of requiring more transistors.

Finally, the registers don't really "manage everything". A register is simply a very fast storage unit, capable of storing and retrieving information far faster than, say RAM memory. For that reason, things like the current instruction are often stored in a special register (called the instruction register), simply because access to its bits is very fast. The current instruction actually "manages everything", and it's stored in a register for speed.

This is a very abbreviated explanation---I've left out a ton of detail and glossed over a lot of technical matters, but I hope it at least gives you a sense of what goes on in a modern computer. [entering duck-and-cover mode in expectation of howls of complaints from computer engineers]

-
The 'more means faster' came from the many years when Moore's Law (transistor scaling) and frequency scaling were happening at almost the same rate. In many people's minds they're still conflated a bit. One other thing to mention- there's an impression here that everything is linear; however, there's a number of places where the number of transistors will be polynomial or higher in the number of stages, or elements, or wires. –  Matthew G. Feb 7 at 14:33

Typically one bit of cache memory requires 6 transistors (some designs use more or less, with different tradeoffs; see http://en.wikipedia.org/wiki/Static_random-access_memory), so modern CPUs with large caches spend a lot of transistors there.

Modern CPUs also execute multiple instructions concurrently, so there are multiple execution units (ALUs) on the chip, each of which is fairly complex.

Certain mathematical algorithms in the FPU can be accelerated by table lookup plus interpolation; the reciprocal square root instruction in Intel SSE units, for example, is implemented with a table that gives 12-bit precision almost instantly; this table is essentially a chunk of ROM on the chip -- that is, still more transistors.

-