ArticleslgStudy

computer science

Tomasulo's algorithm

Tomasulo's algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Tomasulo's algorithm rather than just read about it. In short: Tomasulo's algorithm is a computer architecture hardware algorithm for dynamic scheduling of instructions that allows out-of-order execution and enables more efficient use of multiple execution units. It was developed by Robert Tomasulo at IBM in 1967 and was first implemented in the IBM System/360 Model 91's floating-point unit.

Tomasulo's algorithm — main illustration
Tomasulo's algorithm — illustration

Key takeaways

  • Tomasulo's algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Tomasulo's algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Tomasulo's algorithm from memory before moving on to harder problems.

Reference excerpt

Tomasulo's algorithm is a computer architecture hardware algorithm for dynamic scheduling of instructions that allows out-of-order execution and enables more efficient use of multiple execution units. It was developed by Robert Tomasulo at IBM in 1967 and was first implemented in the IBM System/360 Model 91's floating-point unit. The major innovations of Tomasulo's algorithm include register renaming in hardware, reservation stations for all execution units, and a common data bus (CDB) on which computed values broadcast to all reservation stations that may need them. These developments allow for improved parallel execution of instructions that would otherwise stall under the use of scoreboarding or other earlier algorithms. Robert Tomasulo received the Eckert–Mauchly Award in 1997 for his work on the algorithm.

Implementation concepts

The following are the concepts necessary to the implementation of Tomasulo's algorithm:

Common data bus The Common Data Bus (CDB) connects reservation stations directly to functional units. According to Tomasulo it "preserves precedence while encouraging concurrency". This has two important effects:

Functional units can access the result of any operation without involving a floating-point-register, allowing multiple units waiting on a result to proceed without waiting to resolve contention for access to register file read ports. Hazard Detection and control execution are distributed. The reservation stations control when an instruction can execute, rather than a single dedicated hazard unit.

Instruction order

Instructions are issued sequentially so that the effects of a sequence of instructions, such as exceptions raised by these instructions, occur in the same order as they would on an in-order processor, regardless of the fact that they are being executed out-of-order (i.e. non-sequentially).

Register renaming Tomasulo's algorithm uses register renaming to correctly perform out-of-order execution. All general-purpose and reservation station registers hold either a real value or a placeholder value. If a real value is unavailable to a destination register during the issue stage, a placeholder value is initially used. The placeholder value is a tag indicating which reservation station will produce the real value. When the unit finishes and broadcasts the result on the CDB, the placeholder will be replaced with the real value. Each functional unit has a single reservation station. Reservation stations hold information needed to execute a single instruction, including the operation and the operands. The functional unit begins processing when it is free and when all source operands needed for an instruction are real.

Exceptions Practically speaking, there may be exceptions for which not enough status information about an exception is available, in which case the processor may raise a special exception, called an imprecise exception. Imprecise exceptions cannot occur in in-order implementations, as processor state is changed only in program order (see Classic RISC pipeline § Exceptions). Programs that experience precise exceptions, where the specific instruction that took the exception can be determined, can restart or re-execute at the point of the exception. However, those that experience imprecise exceptions generally cannot restart or re-execute, as the system cannot determine the specific instruction that took the exception.

Instruction lifecycle The three stages listed below are the stages through which each instruction passes from the time it is issued to the time its execution is complete.

Legend RS - Reservation Status RegisterStat - Register Status; contains information about the registers. regs[x] - Value of register x Mem[A] - Value of memory at address A rd - destination register number rs, rt - source register numbers imm - sign extended immediate field r - reservation station or buffer that the instruction is assigned to

Reservation Station Fields Op - represents the operation being performed on operands Qj, Qk - the reservation station that will produce the relevant source operand (0 indicates the value is in Vj, Vk) Vj, Vk - the value of the source operands A - used to hold the memory address information for a load or store Busy - 1 if occupied, 0 if not occupied

Register Status Fields Qi - the reservation station whose result should be stored in this register (if blank or 0, no values are destined for this register)

Stage 1: issue In the issue stage, instructions are issued for execution if all operands and reservation stations are ready or else they are stalled. Registers are renamed in this step, eliminating WAR and WAW hazards.

Retrieve the next instruction from the head of the instruction queue. If the instruction operands are currently in the registers, then If a matching functional unit is available, issue the instruction. Else, as there is no available functional unit, stall the instruction until a station or buffer is free. Otherwise, we can assume the operands are not in the registers, and so use virtual values. The functional unit must calculate the real value to keep track of the functional units that produce the operand.

Stage 2: execute In the execute stage, the instruction operations are carried out. Instructions are delayed in this step until all of their operands are available, eliminating RAW hazards. Program correctness is maintained through effective address calculation to prevent hazards through memory.

If one or more of the operands is not yet available then: wait for operand to become available on the CDB. When all operands are available, then: if the instruction is a load or store Compute the effective address when the base register is available, and place it in the load/store buffer If the instruction is a load then: execute as soon as the memory unit is available Else, if the instruction is a store then: wait for the value to be stored before sending it to the memory unit Else, the instruction is an arithmetic logic unit (ALU) operation then: execute the instruction at the corresponding functional unit

Stage 3: write result In the write Result stage, ALU operations results are written back to registers and store operations are written back to memory.

If the instruction was an ALU operation If the result is available, then: write it on the CDB and from there into the registers and any reservation stations waiting for this result Else, if the instruction was a store then: write the data to memory during this step

… excerpt ends here. Continue reading the full article.

Illustrations

Tomasulo's algorithm: Example of Tomasulo's algorithm[4]
Example of Tomasulo's algorithm[4]

Worked examples

Example 1 — a first encounter with Tomasulo's algorithm

Start with the simplest possible case. Write down what Tomasulo's algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Tomasulo's algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Tomasulo's algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Tomasulo's algorithm

In research
Tomasulo's algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Tomasulo's algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Tomasulo's algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Instruction processing, so understanding it makes those chapters shorter.
In everyday life
Look for Tomasulo's algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Tomasulo's algorithm” →

How to study Tomasulo's algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Tomasulo's algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Tomasulo's algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Tomasulo's algorithm in simple terms?

Tomasulo's algorithm is a computer architecture hardware algorithm for dynamic scheduling of instructions that allows out-of-order execution and enables more efficient use of multiple execution units. It was developed by Robert Tomasulo at IBM in 1967 and was first implemented in the IBM System/360…

Why does Tomasulo's algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Tomasulo's algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Tomasulo's algorithm.

Tags

  • Instruction processing

Keep exploring