CS 3330: Lecture 10: Bubble and Stall, an Analogy

This page does not represent the most current semester of this course; it is present merely as an archive.

Pipeline like a Factory

Imagine you are working in a factory. You have to put nut 7 on bolt B. You get your part (without nut 7) from Jim and give you part (with nut 7) to Julie. But you don't actually hand the parts to them directly; there is a box large enough to hold one part between each of you, like so:

Jim [box] You [box] Julie

They each have other boxes and other people in the assembly line:

... [box] Nazia [box] Jim [box] You [box] Julie [box] Tung [box] ...

The boxes are like pipeline registers and the people are like pipeline phases. Now let's add in the clock:

You have a really strict boss who want to make sure everyone it working on schedule. So once every minute he takes a picture of each of you and you shouldn't be holding a part when he does it: your finished part should be in the box between you and Julie and your next part should be in the box between Jim and you.

Bubbling

Consider a particular moment in time, with numbered parts in each box:

... [6] Nazia [5] Jim [4] You [3] Julie [2] Tung [1] ...

After the boss takes this snapshot you each pick up your parts and start working

... [ ] Naz6ia [ ] Ji5m [ ] Yo4u [ ] Jul3ie [ ] Tu2ng [ ] ...

As you are doing this Jim realizes that he made a mistake on the last two parts he put together, as well as the one he is working on now. He discards his part and shouts down the line "discard parts 3 and 4!", which you and Julie do.

... [ ] Naz6ia [ ] Jim [ ] You [ ] Julie [ ] Tu2ng [ ] ...

Now the time to put parts in boxes is approaching. Empty boxes make the boss mad, so you put a dummy part in the box to fool your boss:

... [7] Nazia [6] Jim [nop] You [nop] Julie [nop] Tung [2] ...

That is called "bubbling" the pipeline registers: inserting a nop instead of the normal instruction.

The next cycle everyone can act normally. You pick up your dummy part, do nothing to it, then put it in the box between you and Julie.

... [8] Nazia [7] Jim [6] You [nop] Julie [nop] Tung [nop] ...
... [9] Nazia [8] Jim [7] You [6] Julie [nop] Tung [nop] ...

Stalling (which includes a bubble)

Consider a particular moment in time, with numbered parts in each box:

... [6] Nazia [5] Jim [4] You [3] Julie [2] Tung [1] ...

After the boss takes this snapshot you each pick up your parts and start working

... [ ] Naz6ia [ ] Ji5m [ ] Yo4u [ ] Jul3ie [ ] Tu2ng [ ] ...

But you accidentally drop your wrench and can't finish with the part in time. You don't want the boss to see you with the part in your hand, so you put part 4 back in the box between you and Jim:

... [ ] Naz6ia [ ] Ji5m [4] You [ ] Jul3ie [ ] Tu2ng [ ] ...

This is called "stalling" the pipeline register between you an Jim: it has the same part next cycle that it did this cycle.

Since the box between you and Jim is full, Jim also has to stall, and so does everyone before him:

... [6] Nazia [5] Jim [4] You [ ] Jul3ie [ ] Tu2ng [ ] ...

But Julie and those after her don't: they can put their parts int the boxes like normal.

... [6] Nazia [5] Jim [4] You [ ] Julie [3] Tung [2] ...

And now there's an empty box. Empty boxes make the boss mad, so you put a dummy part in the box to fool your boss:

... [6] Nazia [5] Jim [4] You [nop] Julie [3] Tung [2] ...

That is called "bubbling" the pipeline register between you can Julie.

The next cycle everyone can act normally. Julie successfully does her work with the dummy part and passes it on down the line, etc.

... [7] Nazia [6] Jim [5] You [4] Julie [nop] Tung [3] ...
... [8] Nazia [7] Jim [6] You [5] Julie [4] Tung [nop] ...
Copyright © 2015 by Luther Tychonievich. All rights reserved.
Last updated 2014-10-30 10:26 -0400