Electronic – Pipeline and real parallelism

alucpuparallel

I have read several articles which say that the CPU has the ALU (and other small specific execution units), Control Unit and the Registers and well other buffers/pipelines, internal buses etc.

The Control unit:

The control unit implements the architecture of the CPU. It performs
the tasks of fetching, decoding, managing execution and then storing
results.

Studying pipeline concept, and what I understand is that at least two steps:

1. Fetch,Decode--->CONTROL UNIT

2. Execute-------->ALU and OTHER EXECUTE UNITS

Both steps PERFORMED IN PARALLEL. That is, while the CPU is executing an instruction, at that same time another is being fetched and decoded.

Am I correct in assuming the above? Or do the Control unit and Execution unit work one after the other like some kind of switching between clock cycles?

Best Answer

Yes. This is the exactly benefit in use a pipeline. The most simple real life example is a laundry.

When you just arrive there, you have dirty clothes that you want to "process". You put the first group of clothes inside the washer and wait until it finishes. When it is ready, you get your first pack of clothes and put all in the dryer machine and fetch and load more clothes into the washer in parallel. When the dryer end its job you then start the "folding cycle", releasing the dryer.

I think you get the idea that while you are folding you can load more clothes in the washer and dry more clothes from the washer in parallel.

The main idea in both cases, processor and laundry, are similar: you can do more in less time by doing parallel jobs.

In the opposite, a processor without a pipeline have to wait all the execution ends to fetch another instruction. Using the laundry analogy again, it is like you only start to wash another group of clothes only after fold all clothes from the first group, wasting time in the middle.