# How many ALUs (and threads) are in a Pentium CPU?

I'm reading a book bottom up where it said:

The Arithmetic Logic Unit (ALU) is the heart of the CPU operation. It takes values in registers and performs any of the multitude of operations the CPU is capable of. All modern processors have a number of ALUs so each can be working independently. In fact, processors such as the Pentium (*emphasis by me) have both fast and slow ALUs; the fast ones are smaller (so you can fit more on the CPU) but can do only the most common operations, slow ALUs can do all operations but are bigger.

I started to find out how many and found that question https://stackoverflow.com/questions/29056968/how-many-alus-are-in-a-cpu where as far as understood many ALU referred to multi-threading, but Pentium is single threaded.

Here I've found Are 32-bit ALUs really just 32 1-bit ALUs in parallell?. So I guess what was meant in the book is kind of many parallel "small" ALUs - am I right?

• It would be more beneficial to consider super-scalar architectures than multi-threaded programs. The number of cores and the number of execution units per core relates to hardware. Threads are a software concept. For many years all implementations of the x86 architecture have benefited from multiple execution units per core. Sep 25 '19 at 21:41

The Pentium processor has two execution units: the U and the V pipes. When two instructions execute in parallel in the two pipes, the two instructions are considered to have paired.

The U-pipe can execute any instruction in the Intel(R) architecture while the V-pipe can execute only simple instructions.

When two instructions pair, the instruction issued to the V-pipe is always the next sequential instruction after the one issued to the U-pipe.

Simple instructions are entirely hardwired; they do not require any microcode control and, in general, execute in one clock. The exceptions are the ALU mem, reg and ALU reg, mem instructions which are three and two clock operations respectively. Sequencing hardware is used to allow them to function as simple instructions.

So in answer to your question, one ALU can work while the other one is working, so it's not exactly multithreading, because if a thread need u-pipe and it's busy, it will have to wait.

In fact, processors such as the Pentium (*emphasis by me) have both fast and slow ALUs; the fast ones are smaller (so you can fit more on the CPU) but can do only the most common operations, slow ALUs can do all operations but are bigger.

This is a rather imprecise description, and isn't especially accurate for modern processors.

Execution units (a more general term for what the book refers to as "ALUs") typically don't differ in speed so much as in their capabilities. A representative example of a modern CPU is Intel's Sandy Bridge microarchitecture, which has six execution units. Three of them handle integer and floating-point operations, with common operations available on all three and various other operations split between them; two more handle memory loads, and a sixth handles memory stores.

What's critical to note here is that there is no execution unit which can perform all operations! In particular, it is common for memory operations to be placed on dedicated EUs, as these operations are very common, and the hardware required to implement them is significantly different from that which is present on other EUs.