दुर्गा बेरागी Durga Beragi, homeEnter the study →

Library › Foundations of computing

Computer Architecture: A Quantitative Approach

John L. Hennessy and David A. Patterson · 1990 · Morgan Kaufmann

Processor design judged by measurement, not taste.

About the book

John Hennessy of Stanford and David Patterson of Berkeley published Computer Architecture: A Quantitative Approach in 1990 with Morgan Kaufmann. In the 1980s they had led the development of RISC processors at their universities. The book teaches processor and system design by measurement and cost. It covers performance measurement, instruction set design, pipelining, instruction-level parallelism, memory hierarchy and caches, and input and output. Examples used DLX, a simple RISC instruction set of their own design. Many later editions followed and kept it current. Hennessy and Patterson received the Turing Award for 2017.

Key ideas

  • Design choices should be judged by measured performance and cost, not by taste or fashion. The book uses benchmarks and simple formulas to compare alternatives on equal terms.
  • Processor performance depends on three factors: the number of instructions executed, the average cycles per instruction and the clock rate. Improving one of them can easily worsen another.
  • Amdahl's law limits speedup. Improving one part of a system helps only in proportion to the fraction of time spent in that part, so the common case should be made fast.
  • Simple, regular instruction sets, as in RISC designs, make efficient pipelining possible. The authors show by measurement how this leads to faster processors than complex instruction sets.
  • A memory hierarchy, with caches and virtual memory, bridges the gap between fast processors and slow memory. It works because programs show locality, reusing nearby data and code.

Why it is on this shelf

It explains why computers perform as they do and how designers trade cost against speed. Knowing it helps you judge hardware claims and write faster code. Its quantitative method, measure first and then decide, applies to almost any engineering decision you will face.

How to start reading it

Read Chapter 1 on fundamentals and measurement. Then read the chapters on pipelining and memory hierarchy. Later editions have newer material on multicore and warehouse-scale computers.

About this book

Computer Architecture: A Quantitative Approach was first published in 1990 by Morgan Kaufmann. Its authors were John L. Hennessy of Stanford University and David A. Patterson of the University of California at Berkeley. Both had spent the previous decade building experimental processors, and both had come to the same conclusion: the way computers were being designed, and the way design was being taught, rested too much on habit and opinion and too little on numbers.

The book set out to change that. Its question is simple to state and hard to answer well. It asks how a computer should be built, given a fixed budget of money, chip area, power and engineering time, so that it runs real programs as fast as possible. The authors answer it not with a single design but with a method. Measure what programs actually do. Model how each design choice changes the time a program takes. Count the cost. Then decide.

The audience was graduate students and working engineers. It assumed a reader who already knew how a simple processor works, at the level of logic gates, registers and assembly language, and who wanted to learn how professional designers make their trade-offs. Undergraduates were later served by the same authors' gentler companion, Computer Organization and Design, first published in 1994. The two books are often confused, and readers sometimes call them by the initials of the authors in opposite orders. The quantitative book, this one, puts Hennessy first.

The situation in 1990 matters. The industry was in the middle of a quarrel about instruction sets. On one side stood the established complex instruction set machines, such as the VAX from Digital Equipment Corporation and the x86 family from Intel, with many instructions, many addressing modes and variable instruction lengths. On the other side stood the reduced instruction set machines, or RISC designs, which the two authors had helped to create: few instructions, simple fixed formats, loads and stores as the only way to touch memory, and many registers. The book was partly a report on why the RISC approach had won the argument on the numbers.

But it was never a pamphlet. Its larger achievement was to give the whole field a shared vocabulary and a shared standard of evidence. After it, a designer who proposed a new feature was expected to show, with benchmarks and a simple performance equation, how much it would help and what it would cost. That expectation spread from universities into industry and has lasted for more than three decades and six editions.

This study edition is a companion to that book. It explains what the book is, how its method works, which ideas carry its weight, how it fits among the other books in our foundations of computing bay, and how a reader can work through it with profit. It does not reproduce the book's text, tables or exercises, and it is not a substitute for them. The real book is full of worked numbers and carefully drawn diagrams that no summary can replace.

The authors

John L. Hennessy

John Hennessy was born in 1952 and studied electrical engineering at Villanova University before taking his doctorate in computer science at Stony Brook. He joined the Stanford faculty in 1977. In the early 1980s he led the Stanford MIPS project, a processor designed so that its pipeline would rarely need to stall. The name stood for a microprocessor without interlocked pipeline stages: the design leaned on the compiler to arrange instructions so that the hardware did not need to check for every conflict.

In 1984 Hennessy co-founded MIPS Computer Systems to turn the research into products. MIPS processors went into workstations, game consoles, routers and many embedded devices. The company's experience fed directly into the book: Hennessy knew from practice that a clean design on paper must also survive compilers, operating systems, manufacturing yields and customers. He later became dean of engineering at Stanford, then the university's president from 2000 to 2016, and after that chairman of Alphabet, the parent company of Google.

David A. Patterson

David Patterson was born in 1947 and took all his degrees at the University of California, Los Angeles. He joined the Berkeley faculty in 1976. Around 1980, with David Ditzel, he argued in print that instruction sets had grown too complex and that a reduced set would serve better. He then led the Berkeley RISC project, whose chips RISC-I and RISC-II showed that a small team of students could build a competitive processor. The Berkeley designs influenced Sun Microsystems' SPARC architecture.

Patterson's later work kept to the same habit of building something real and measuring it. With Randy Katz and Garth Gibson he proposed RAID in 1988, the idea of combining many cheap disks into one reliable and fast storage system. He worked on networks of workstations as a substitute for expensive supercomputers, on reliable computing, and much later on RISC-V, an open instruction set launched at Berkeley around 2010. After retiring from Berkeley he joined Google, where he worked on the tensor processing unit, a chip built to accelerate machine learning.

The partnership

The two men represented the two leading RISC efforts in American universities, one on each side of San Francisco Bay. They were rivals in research and collaborators in teaching. They wrote the book together because each saw that the field lacked a text that taught design as an engineering discipline rather than a catalogue of existing machines. In 2018 they shared the Turing Award, given for 2017, for creating a systematic and quantitative approach to the design and evaluation of computer architectures. The citation names the method the book teaches, not only the chips they built.

Knowing who wrote the book helps a reader read it fairly. The authors are partisans of RISC, and early editions sometimes show it. They are also unusually willing to argue with themselves. Each edition revises earlier claims when the numbers changed, and the later editions say openly that some of the techniques the authors once championed have reached their limits.

The shape of the argument

The book is built like a ladder. Its first rung is a chapter on fundamentals that teaches the method itself: how to define performance, how to measure it, how to summarise results across many programs, how to think about cost, and later how to think about power and reliability. Everything after depends on this rung. A reader who skips it will find the rest a collection of tricks; a reader who masters it will see each later chapter as the same method applied to a new part of the machine.

The middle of the book moves through the machine from the inside out. It treats the instruction set as the contract between hardware and software, then the pipeline that executes instructions in overlapping stages, then the many techniques for finding and exploiting parallelism among nearby instructions, then the memory hierarchy that feeds the processor, and then storage and communication with the outside world. In the earliest editions the order put the instruction set first, as the foundation; later editions moved it to an appendix, because by then the RISC style had become the accepted default and the interesting questions had moved elsewhere.

The later editions add a further movement. As single processors stopped getting much faster in the middle of the 2000s, the book turned to parallelism at larger scales: many threads sharing memory, vector and graphics processors that apply one instruction to many data items, whole buildings of servers acting as one computer, and finally processors designed for one domain, such as neural network inference. The argument stays the same; only the scale changes.

Several recurring features carry the book's voice. Each chapter closes with a section on fallacies and pitfalls, a list of common beliefs and common mistakes, each examined against evidence. Each chapter also has an historical perspective, often written with great care, that traces where its ideas came from and who first had them. And each chapter puts its ideas together in a case study of a real machine, so that the reader sees how the textbook principles appear in a commercial product with all its compromises.

The exercises are a large part of the book. Many ask the reader to compute: to take a cache configuration and a miss rate and derive a speedup, or to schedule a loop on a pipeline by hand. The authors intend these calculations to become reflexes. A designer who has done enough of them can look at a proposal and estimate, within a few minutes and on the back of an envelope, whether it is worth building.

Across all of this runs one theme. Performance is not a single number on a box. It is the time a real program takes on a real machine, and it is shaped by every layer from the transistor to the compiler. A good design is one that spends its resources where programs actually spend their time.

A book that keeps changing

Few textbooks have been revised as thoroughly as this one. The first edition appeared in 1990, and new editions followed at intervals of roughly five years, reaching a sixth edition in 2017. Each edition was not a light refresh but a reconsideration of what mattered most. Chapters were reordered, merged, moved to appendices or placed online, and new chapters were written as the frontier moved. Contributors from industry and other universities helped with case studies and exercises in later editions.

The changes trace the history of the field. The early editions were dominated by the instruction set debate and by the design of a single fast processor. The middle editions gave increasing space to instruction-level parallelism, as processors became superscalar and speculative, and to the memory hierarchy, as the gap between processor and memory widened. The fifth and sixth editions were reorganised around parallelism of every kind, warehouse-scale computing, energy efficiency and, finally, specialised processors.

The example machines changed too. DLX served the early editions as a clean teaching design. It was replaced by MIPS, a real commercial instruction set close to DLX in spirit, and then by RISC-V, an open instruction set from Berkeley. Case studies moved from workstation processors to mobile chips, server processors, graphics processors and machine learning accelerators.

For a reader this has two consequences. First, any edition will teach the method, because the method has hardly changed. Second, the edition one reads shapes one's picture of the present. An older edition describes a world in which faster single processors were still the main road; a newer one describes a world in which that road has narrowed and many branches have opened. It is worth knowing which edition is in your hands and reading its frontier chapters with its date in mind.

There is also a lesson in the revisions themselves. The authors did not defend their earlier emphasis when the evidence moved. They rewrote it. A book about deciding by measurement has itself been decided by measurement, edition after edition, and that consistency is part of why it is trusted.

Idea one: performance is time, and time has three factors

The book begins by insisting on a definition. The performance that matters to a user is the time a program takes to finish. Peak rates, clock speeds and instruction counts are only parts of that time, and each can mislead when taken alone. This sounds obvious. In 1990 it was not how computers were sold. Advertisements quoted millions of instructions per second, or clock rates in megahertz, as though these were performance.

The authors break execution time into three factors multiplied together. The first is the number of instructions the program executes. The second is the average number of clock cycles each instruction takes, usually called CPI, for cycles per instruction. The third is the length of one clock cycle, which is the inverse of the clock rate. Multiply them and you get the time. This relation is sometimes called the iron law of processor performance, a name used widely in teaching even where the book itself does not lean on it.

The value of the equation lies in what it forces you to see. Each design decision pushes on all three factors at once, usually in different directions. A richer instruction set may lower the instruction count, because one instruction does more work, but raise the cycles per instruction, because each instruction is harder to execute, and lengthen the clock cycle, because the logic is deeper. A deeper pipeline shortens the clock cycle but raises the penalty for every wrong guess about a branch. No factor can be optimised alone.

An analogy helps. Think of a delivery run. The total time depends on how many stops there are, how long each stop takes on average, and how fast the van drives between them. A bigger van means fewer trips but slower driving. A faster driver who skips the address check makes more wrong stops. The only honest measure is when the last parcel arrives.

The equation also shows why the instruction count is not set by the hardware alone. The compiler chooses which instructions to emit. So the processor and its compiler must be designed together and measured together. This was one of the central lessons of the RISC research: a simpler instruction set, matched to what compilers actually generate, could lower the product of the three factors even if it raised the instruction count.

The idea is often confused with a claim that clock rate does not matter. It does matter, but only as one factor. The history of the early 2000s showed the cost of forgetting this, when some designs pushed clock rates very high by making pipelines very deep and then lost much of the gain in extra cycles per instruction and in power. The book's later editions use this episode as a warning.

Idea two: make the common case fast

If you had to keep one sentence from the book, it might be the advice to make the common case fast. It means that a designer should spend effort and silicon on the things programs do most often, and accept being merely adequate at the rare things. The rare case still has to work correctly. It need not be fast.

The principle has an exact form in Amdahl's law, named after Gene Amdahl, who argued in 1967 that parallel machines would be limited by the part of a program that cannot be run in parallel. The book generalises his point. Suppose an improvement speeds up some fraction of a program's running time. The overall speedup depends on two things: how large that fraction is, and how much faster it becomes. If the fraction is small, even an infinite speedup of that part barely helps.

Take a concrete case of our own. A program spends 80 percent of its time on arithmetic and 20 percent waiting for disk. Make the arithmetic ten times faster, and the arithmetic now takes 8 percent of the old time while the disk still takes 20. The new total is 28 percent of the old, a speedup of a little over three and a half, not ten. Make the arithmetic infinitely fast, and the speedup is only five, because the disk remains. The slow part you did not touch now sets the limit.

This has two consequences that the book returns to again and again. First, before improving anything, measure where the time goes. Intuition about which part is slow is often wrong. Second, every improvement shifts the bottleneck. Once the common case is fast, some other part becomes the common case, and the work begins again. This is why computer design never finishes.

The principle is sometimes confused with a licence to ignore rare cases entirely. That is a misreading. Rare cases that are catastrophically slow can dominate, as Amdahl's law itself shows: if a rare event costs a thousand times more than a common one, it may consume most of the time. The skill lies in knowing the actual frequencies and costs, which is to say, in measuring.

The idea reaches far beyond hardware. Anyone who has optimised software has met it: the program spends most of its time in a small part of the code, and speeding up anything else is wasted effort. Managers meet it in queues and supply chains. Amdahl's law is one of the few results from computer architecture that every engineer, and many non-engineers, would do well to carry.

Idea three: benchmarks and honest summaries

Measurement is only as good as what you measure. The book gives sustained attention to the choice of test programs, or benchmarks, and to the ways benchmark results can mislead. In the 1980s it was common to quote results on tiny synthetic programs that did not resemble any real workload. Designers and compiler writers learned to tune for those programs, and the numbers lost their meaning.

The authors favour suites of real programs, run as complete applications, with results reported in a way others can reproduce. The SPEC benchmarks, organised by an industry group formed in the late 1980s, became the standard example. A suite of real programs is harder to game, because a trick that speeds up one program by exploiting a quirk will not help the others, and it represents the mixture of work a real customer runs.

Summarising many results into one number raises its own problem. If one machine is twice as fast on one program and half as fast on another, an arithmetic mean of the ratios gives a different answer depending on which machine you take as the reference. The book explains why the geometric mean of ratios behaves consistently under a change of reference, while also noting that it does not correspond to the total time of any real workload. Each summary answers a different question, and the reader should know which question they are asking.

The authors also warn against single metrics that sound like performance. Millions of instructions per second depends on the instruction set, so it cannot compare machines with different instruction sets. Peak rates describe what a machine could do if every unit were busy every cycle, which never happens in real programs. These warnings appear in the fallacies and pitfalls sections, which read like a catalogue of mistakes the authors had watched intelligent people make.

The lesson generalises. Any metric that becomes a target will be optimised at the expense of what it was meant to measure. The book's answer is to measure the real thing, as directly as possible, and to report enough detail that others can check the result.

Idea four: the instruction set as a contract

An instruction set architecture is the boundary between hardware and software. It lists the instructions a processor understands, the registers it offers, how it addresses memory and how it encodes each instruction in bits. Software is written to this boundary. Hardware is built to honour it. A good instruction set lasts for decades and outlives every chip that implements it.

The book treats instruction set design as a set of measurable choices. The designer must settle how many registers to offer, whether arithmetic instructions may read memory directly or only registers, how many ways there should be to compute an address, and whether all instructions should have the same length. For each question the authors look at what compilers actually generate and what programs actually do. They find, for example, that a small number of simple addressing modes covers the great majority of real uses, and that the elaborate modes of older machines are rarely used.

From these measurements comes the case for the RISC style: a load and store design in which only explicit load and store instructions touch memory, a generous set of general registers, fixed-length instructions that are easy to decode, and few addressing modes. Such a design makes pipelining straightforward, because every instruction moves through the same stages in the same way. The first editions illustrated these principles with DLX, a simple teaching instruction set the authors defined for the purpose, pronounced like the name of a deluxe model. Later editions used MIPS, and the sixth edition uses RISC-V.

The idea is often misunderstood as the claim that simple instruction sets are always faster. The book's real claim is narrower and stronger: complexity in the instruction set must pay for itself in measured performance, and much of the complexity of 1970s machines did not. The x86 family survived and thrived by translating its complex instructions, inside the chip, into simpler internal operations that a RISC-like core could pipeline. In a sense the RISC argument won inside the processor even where it lost at the boundary.

A useful comparison is with a language and its grammar. A grammar with fewer irregular forms is easier to learn and to parse, but it may need more words to say the same thing. Whether the trade is good depends on who is reading and writing. For a processor, the reader is the pipeline and the writer is the compiler, and both prefer regularity.

Registers deserve a special word. A register is a tiny storage location inside the processor that can be read and written in a fraction of a cycle. Older designs had few registers, so programs moved values back and forth to memory constantly. The RISC designs offered many, typically thirty-two, and relied on compilers to keep the most used values in them. The book shows by measurement that good register allocation removes a large share of memory traffic. This is an instance of the book's larger point: a feature in the instruction set is valuable only to the extent that compilers can actually use it, and simple, plentiful resources are easier to use well than clever, scarce ones.

Instruction encoding is another quiet but important choice. Fixed-length instructions waste some bits, since short operations occupy as much space as long ones, but they allow the processor to find the next instruction without first decoding the current one. Variable-length instructions save memory but complicate fetching and decoding. When memory was expensive, compactness mattered more. As memory became cheap and speed became precious, the balance shifted towards regularity. Later, in small embedded devices where memory is again scarce, compressed instruction formats returned. The right answer depends on the prices of the day, which is exactly the book's point.

Idea five: pipelining and its hazards

Pipelining is the oldest and most important trick in processor design. An instruction is executed in several steps: fetch it from memory, decode it and read its registers, perform the operation, access memory if needed, and write the result. Instead of finishing one instruction before starting the next, a pipelined processor starts a new instruction every cycle, so that several instructions are in different stages at once. The analogy usually given is a laundry: while one load dries, the next washes. Each load takes as long as before, but loads finish more often.

In an ideal pipeline, one instruction completes every cycle and the cycles per instruction approaches one. Real pipelines fall short because of hazards, situations in which the next instruction cannot proceed in the next cycle. The book classifies them into three kinds. Structural hazards arise when two instructions need the same piece of hardware at once. Data hazards arise when an instruction needs a result that an earlier instruction has not yet produced. Control hazards arise from branches, because the processor does not know which instruction comes next until the branch is resolved.

Each hazard has its remedies. Structural hazards are removed by duplicating resources, for example by having separate caches for instructions and data. Many data hazards are removed by forwarding, which routes a result straight from the stage that computes it to the stage that needs it, without waiting for it to be written back. The remaining data hazards can be hidden by the compiler, which reorders independent instructions to fill the gaps. Control hazards are reduced by resolving branches early and, increasingly, by predicting them.

What makes this chapter powerful is that every remedy is evaluated with the same equation. A stall adds cycles. The designer estimates how often each hazard occurs and how many cycles it costs, adds these to the ideal cycles per instruction, and obtains a realistic figure. With this figure the designer can compare a cheap remedy that removes half the stalls with an expensive one that removes nine tenths, and decide whether the difference is worth its cost.

Pipelining is often confused with parallel processing in the sense of many processors. It is a finer-grained kind of parallelism, hidden from the programmer, that overlaps the steps of consecutive instructions within one processor. Its great virtue is that it speeds up existing programs without changing them. That virtue explains why designers pushed it so far, and why its limits, when they came, were felt so sharply.

Idea six: finding parallelism among instructions

Once a simple pipeline is working, the next question is whether the processor can do more than one instruction per cycle. The answer depends on instruction-level parallelism: the degree to which nearby instructions in a program are independent of one another and could run at the same time. The middle chapters of the book are devoted to this question, and they are the hardest and richest part.

There are two broad strategies. In the static approach, the compiler finds independent instructions and packs them together, and the hardware simply executes what it is given. Very long instruction word machines take this approach to its limit. In the dynamic approach, the hardware itself looks ahead in the instruction stream, finds instructions whose inputs are ready, and issues them out of program order. The book teaches the classic dynamic methods, including scoreboarding, developed for the CDC 6600 in the 1960s, and Tomasulo's algorithm, developed for the IBM 360/91 floating-point unit, which renames registers so that false dependences between instructions disappear.

Dynamic scheduling becomes far more effective when combined with branch prediction and speculation. A processor that predicts which way a branch will go can fetch and execute instructions beyond it before knowing whether they are needed. If the guess was right, time is saved. If it was wrong, the speculative results are discarded through a structure that commits instructions in order. Modern high-performance processors predict branches with very high accuracy, using histories of past behaviour, and keep many instructions in flight at once.

The book is careful to measure how much parallelism is actually there. Studies of idealised machines with perfect prediction and unlimited resources found considerable parallelism in many programs, but realistic limits on window size, prediction accuracy and memory delays cut it down sharply. Each additional instruction per cycle cost much more hardware and power than the last. By the middle of the 2000s the returns had fallen so far that designers stopped trying to make single cores much wider.

An analogy: a kitchen can prepare several dishes at once only if the recipes do not depend on each other at every step. A good head chef, looking ahead, can start the stock while the vegetables are being cut. But some steps must wait for others, and adding more cooks to a small kitchen soon produces more collisions than meals. The book makes this intuition precise and gives the reader the tools to estimate where the limit lies.

This idea is often confused with the claim that hardware should do everything automatically. The book's position is balanced. Compilers can find some parallelism cheaply; hardware can find other parallelism that is visible only at run time. The best designs use both, and the right mix has shifted over time as transistors became cheaper and power became dearer.

Idea seven: the memory hierarchy and locality

A processor is useless if it waits for data. Over the decades processor speed grew much faster than the speed of main memory, so that by the 1990s a single access to memory could cost the time of many instructions. The book calls attention to this widening gap and devotes a major part of every edition to the structures that hide it.

The solution is a hierarchy of memories. Close to the processor sit small, fast, expensive memories called caches. Further away sits larger, slower, cheaper main memory, and beyond that, disk or flash storage. The aim is to give the processor the illusion of a memory as large as the biggest level and as fast as the smallest. The illusion works because of locality, the observed tendency of programs to reuse data and instructions they have used recently, which is temporal locality, and to use data near what they have used recently, which is spatial locality.

The book gives a simple formula for the cost of the hierarchy. The average time to access memory equals the time for a hit in the cache plus the fraction of accesses that miss times the penalty for each miss. Each term can be attacked separately. A larger cache lowers the miss rate but may raise the hit time. A larger block brings in more neighbouring data on each miss, exploiting spatial locality, but raises the miss penalty and can waste space. Higher associativity, which allows a block to sit in more than one place, reduces misses caused by collisions but makes each lookup slower.

A helpful classification sorts misses into three kinds, often called the three Cs. Compulsory misses happen the first time a block is touched and cannot be avoided by caching alone. Capacity misses happen because the cache is too small to hold everything the program needs. Conflict misses happen because too many blocks map to the same place. Each kind responds to different remedies, so knowing which kind dominates tells the designer where to spend.

The book also treats virtual memory as part of the same hierarchy. Virtual memory lets each program act as if it had a large private address space, while the operating system and hardware map its pages onto physical memory and disk. The translation is itself cached in a small structure called the translation lookaside buffer. Seen this way, virtual memory and caches are two answers to one problem, differing mainly in the size of the blocks and the cost of a miss.

A good analogy is a workshop. The tools on the bench are the cache, the cabinet on the wall is main memory, and the warehouse across town is disk. A good craftsman keeps on the bench what he is using now and what he will need next. If he has to drive to the warehouse often, nothing else about his skill matters much.

For programmers this idea has direct practical value. Code that walks through memory in order runs much faster than code that jumps about, even if both do the same arithmetic. Many software optimisations, from arranging arrays to blocking loops in matrix code, are simply ways of improving locality. The book makes clear why.

Idea eight: cost, power and dependability are part of performance

A design that is fast but cannot be built cheaply, cooled, or trusted is not a good design. From the beginning the book treated cost as a first-class quantity. It explains how the cost of a chip depends on the area of the die, how many dies fit on a wafer, and the yield, the fraction of dies that work. Because defects are scattered randomly across a wafer, the yield falls quickly as die area grows, so a chip twice as large may cost much more than twice as much. This simple model explains why designers fight for every square millimetre.

Later editions give power the same weight. For many years each new generation of transistors was smaller and used less power per transistor, a trend known as Dennard scaling, so designers could add transistors and raise clock rates without melting the chip. Around the middle of the 2000s that trend broke down. Power density reached the limits of practical cooling, and clock rates stopped rising. The book's later editions describe this as a turning point, sometimes called the power wall, and treat energy per operation as a central design metric, especially for mobile devices and data centres.

Dependability is the third partner. As systems grow larger, failures become routine rather than rare. A warehouse of tens of thousands of servers will see disks and machines fail every day. The book discusses how to measure dependability, using quantities such as mean time to failure, and how to design systems that keep working when parts fail, through redundancy and error-correcting codes. Patterson's own work on RAID belongs to this line of thought.

The common thread is that performance cannot be judged in isolation. The right question is always performance per something: per dollar, per watt, per square millimetre, or per hour of downtime. Each market weights these differently. A phone values energy above all, a supercomputer values raw speed, a cloud provider values total cost of ownership. The quantitative method handles them all, because it asks the designer to state the objective and then measure against it.

Storage, input and output

Early editions gave a full chapter to storage and input and output, a subject many architecture books treated as an afterthought. The authors argued that this neglect was a mistake. By Amdahl's law, as processors grow faster, the share of time spent waiting for disks and networks grows, and the system as a whole is held back by its slowest part. A processor that is ten times faster attached to the same disk does not make a database ten times faster.

The book's treatment of storage brings in a different kind of performance measure. For a processor, the natural measure is the time to finish one program. For a storage system, two measures matter: throughput, the number of requests served per second, and response time, how long one request waits. These pull against each other. A disk kept constantly busy serves many requests, but each one waits longer in the queue. The book introduces simple queueing theory to reason about this trade, showing how waiting time rises steeply as a server approaches full use.

An everyday example makes the point. A ticket counter that is idle half the time serves each customer at once. The same counter busy nine tenths of the time builds long queues, even though it is serving only a little more than before. Designers of storage systems, like managers of ticket counters, must decide how much idle capacity to pay for in exchange for short waits. The mathematics is the same.

Storage also brings dependability to the front. Disks fail, and a system that stores important data must survive their failure. RAID, the scheme Patterson helped to propose, spreads data and redundant check information across several disks so that the loss of one does not lose data. The book uses it as a model of how to measure reliability, how to calculate the chance of data loss, and how to weigh the cost of redundancy against the cost of failure. Since the book was first written, flash memory has largely replaced spinning disks in many uses, changing the numbers but not the method.

The lasting idea here is that a computer is a system, not a processor. Its speed is the speed of the whole path from a user's request to the answer. Later editions moved much of the storage material online to make room for parallelism, but the principle remains in the warehouse-scale chapter, where networks, disks and power supplies are treated as carefully as the processors.

Idea nine: when one processor is not enough

When single processors stopped getting much faster, the industry turned to putting several processors, or cores, on one chip. This shifted the burden of finding parallelism from the hardware to the programmer. The later editions of the book follow this shift and distinguish three broad kinds of parallelism beyond the single instruction stream.

The first is thread-level parallelism, in which several independent streams of instructions run at once and share memory. This raises the problem of coherence: when two cores cache the same piece of memory and one writes to it, the other must not keep using a stale copy. The book explains the protocols that keep caches consistent, and the subtle question of memory consistency, which defines what values a program may legally observe when several threads read and write the same locations.

The second is data-level parallelism, in which one operation is applied to many data items at once. Vector processors, the short vector instructions added to ordinary processors, and graphics processing units all exploit this. Graphics processors in particular grew from specialised hardware for drawing pictures into general engines for scientific computing and machine learning. The book explains their organisation in terms continuous with the rest of the text, so that a reader sees them as another answer to the same quantitative questions rather than as a separate world.

The third is request-level parallelism, the kind exploited by warehouse-scale computers that serve many independent users at once. Here the unit of design is a building, its power supply and cooling, and its network. The fifth edition added a chapter on these systems, drawing on the authors' contacts with large internet companies. The same principles appear at enormous scale: measure the workload, find the common case, count the cost including electricity, and plan for failure.

The sixth edition, published in 2017, adds domain-specific architectures, processors designed for one class of problem, such as neural network inference. The authors argue that with general-purpose improvements slowing, the largest gains now come from specialisation: hardware that does one thing very efficiently. Their Turing Award lecture, delivered in 2018, called this a new golden age for computer architecture. The argument is the old one carried forward: when the common case is a matrix multiplication, build a machine that makes matrix multiplication fast.

Idea ten: fallacies, pitfalls and the habit of doubt

One of the book's most distinctive features is easy to overlook. Each chapter ends with a list of fallacies, which are beliefs that sound true but are false, and pitfalls, which are mistakes that are easy to make. Each is stated, then examined against evidence. The tone is not mocking. Many of the fallacies were believed by excellent engineers, sometimes including the authors.

The value of these sections is that they train a habit of mind. They teach the reader to be suspicious of claims that are not backed by measurement, to ask what a number actually measures, and to look for the hidden assumption in a confident statement. Typical targets include treating a single metric as complete, assuming that a technique that worked at one scale will work at another, and ignoring the part of a system that did not change.

The historical perspectives play a similar role from a different direction. By showing how ideas arose, were forgotten and were rediscovered, they warn against the belief that the current design is final. Caches, pipelines, vector processors, and even the idea of reduced instruction sets all had ancestors decades older than their fame. A reader who knows this history is less likely to mistake fashion for progress.

This habit of doubt is the deepest lesson of the book, more lasting than any particular technique. Techniques age. The discipline of asking for evidence, and of revising one's beliefs when the evidence changes, does not.

The tradition around it

The book stands at the end of a long line of thought about how machines should be organised. Charles Babbage, whose Passages from the Life of a Philosopher sits in this bay, already separated the store, where numbers are kept, from the mill, where they are worked on. That separation of memory from processing is still the basic shape of every machine the book describes. John von Neumann's lectures, published as The Computer and the Brain, reflect the same stored-program design that bears his name, and his concern with speed, reliability and the cost of components anticipates the book's quantitative temper.

Before Hennessy and Patterson, architecture was often taught by surveying machines. Books by Gordon Bell and Allen Newell in the early 1970s collected and classified computer structures, and the IBM System/360 papers of the 1960s introduced the idea of an architecture as a contract separate from any implementation. The 1980s added the RISC research at Berkeley, Stanford and IBM, where John Cocke's 801 project reached similar conclusions. The book drew these strands together and gave them a common method.

Within this bay, several books make good partners. Code by Charles Petzold builds a simple computer from relays and gates, and so provides the ground floor on which this book stands; a reader who finds the opening chapters here too dense can start there. The C Programming Language by Kernighan and Ritchie describes the language in which most of the benchmark programs of the era were written, and its plain model of memory and pointers maps closely onto the machines described here. Compilers: Principles, Techniques, and Tools by Aho, Sethi and Ullman covers the other half of the hardware and software partnership, since the book repeatedly insists that processor and compiler must be designed together.

The Mythical Man-Month by Frederick Brooks offers a useful contrast. Brooks managed the operating system for the IBM System/360, the same family whose architecture shaped this field, and his book is about the people side of large systems. Reading the two together shows the same lesson from two angles: estimates must rest on evidence, and adding resources does not scale linearly. Turing's Cathedral by George Dyson tells the story of von Neumann's machine at Princeton, giving the human background to the design principles this book takes for granted.

Later work has extended the book in many directions. The open RISC-V instruction set, which Patterson helped to launch, has made it possible for anyone to design and study processors without licence fees. Research on specialised accelerators for machine learning, which connects this book to Deep Learning by Goodfellow, Bengio and Courville in the same bay, applies the quantitative method to a new workload. And the theory books in the bay, such as Sipser's Introduction to the Theory of Computation, describe what can be computed at all; this book describes what it costs to compute it quickly.

Questions and criticisms

The most common criticism of the early editions was partisanship. The authors had a stake in RISC, and some readers felt the comparisons with complex instruction sets were framed to favour it. The criticism has some force. The x86 architecture, which the RISC camp regarded as obsolete, went on to dominate desktops and servers for decades by translating complex instructions into simple internal ones. The authors acknowledged this in later editions, and the lasting point, that the internal engine should be simple and pipelined, survived the commercial outcome.

A second criticism is that the book's emphasis on single-processor performance in the first editions aged quickly once the industry turned to multicore designs. Much material on ever wider and deeper pipelines describes techniques that reached their limits. Later editions responded by moving older material to appendices and online supplements and adding chapters on parallel and specialised systems. A reader using an older edition should know that its picture of the frontier is dated, though its method is not.

A third concern is accessibility. The book is dense, assumes a good deal of background, and its exercises demand time. Students coming without a course in computer organisation often find it hard. This is a matter of audience rather than a flaw, and the authors' other book exists for that reason. But it means that the book is best read with a pencil and patience, not skimmed.

Some readers argue that the quantitative approach can narrow vision. Benchmarks measure today's programs, and a design tuned for them may miss tomorrow's workloads. Several important architectural ideas, such as graphics processors becoming general compute engines, arose from markets the standard benchmarks did not cover. The authors would answer that the method is to measure the workload you care about, and that choosing the right workload is itself part of good judgement. Still, the warning stands: measurement tells you how well you answer a question, not whether you chose the right question.

What has held up is substantial. The performance equation, Amdahl's law, the principle of locality, the analysis of the memory hierarchy, the treatment of benchmarks, and the habit of examining fallacies remain as useful as they were in 1990. Every modern processor still pipelines, caches, predicts branches and executes out of order. The vocabulary the book established is the vocabulary of the field.

Why it is on this shelf

This shelf gathers books on Vedanta, Jyotish, science, economics and technology. Its reader is someone who wants to understand how things actually work, from the self to the stars to the market to the machine. This book earns its place because it is the clearest account we know of how a modern computer is designed and why it performs as it does.

It also earns its place for its method. The book teaches a way of thinking that is useful far beyond processors: define the goal precisely, measure where the time and money actually go, attack the largest cost first, and expect the bottleneck to move. An economist will recognise in Amdahl's law a version of diminishing returns. A student of Jyotish will recognise the discipline of exact calculation applied to a complex system. A reader of Vedanta will recognise the value of looking beneath appearances, here the appearance of a single number on a box, to the many causes that produce it.

We keep it next to the theory books and the histories because it fills the space between them. The theory books tell us what can be computed. The histories tell us who first built machines to do it. This book tells us how such machines are actually built today, under real constraints of cost, power and time. Without it, the bay would describe computing in principle but not in practice.

There is a further reason. Almost every reader of this shelf now does serious work on a computer, whether running astronomical calculations, analysing economic data, or training a model. Knowing what happens beneath the program changes how one works. A calculation that walks through memory in the wrong order may run ten times slower than it needs to. A purchase decision based on a clock rate may buy the wrong machine. A claim that some new chip is many times faster can be weighed against the fraction of the work it actually accelerates. This book gives the reader the means to make these judgements calmly.

Finally, it is a model of how to write a technical book. It is honest about its own past errors, generous in crediting earlier work, and careful to separate measurement from opinion. Those virtues are worth having close at hand whatever one is studying.

How to read it

Begin with the first chapter on fundamentals and read it slowly, twice if needed. Work every example in it with pencil and paper: the performance equation, Amdahl's law, the comparison of benchmark summaries, the cost of a die. These calculations are the alphabet of the rest of the book. Allow a week for this chapter if you are reading in the evenings.

Next, read the material on pipelining, which in most editions sits in an appendix devoted to basic and intermediate concepts. Draw the pipeline diagrams yourself, cycle by cycle, for a short sequence of instructions, marking where each hazard causes a stall and where forwarding removes it. Do not move on until you can predict the number of cycles a small loop will take.

Then read the chapter on the memory hierarchy. This is the part of the book with the most direct value for programmers. Work the average memory access time examples and, if you can, write a small program that walks through an array in different orders and time it on your own machine. Seeing locality in your own measurements fixes the idea for good.

On a first pass, skim the chapters on instruction-level parallelism, reading the overviews and the fallacies and pitfalls but not every detail of Tomasulo's algorithm or speculation. Return to them on a second pass when the basics are secure. Skip the case studies of specific commercial processors at first; they are rewarding later, once you know what to look for.

If you have a recent edition, read the chapters on data-level parallelism, warehouse-scale computers and domain-specific architectures after the core. They show the method at work on today's frontier and are easier than the middle chapters. Read every historical perspective section; they are short, well written and give the field its proper depth.

Pace yourself at about one chapter every two weeks, with exercises. The whole book, done well, is a few months of steady work. If you have less time, the first chapter, pipelining and the memory hierarchy together give most of the lasting value.

From this shelf, read Petzold's Code first if the hardware basics are unfamiliar. Read Kernighan and Ritchie alongside it to connect the hardware to the code you write. Follow it with Compilers by Aho, Sethi and Ullman to see the software half of the partnership, and with Brooks's The Mythical Man-Month for the human side of building large systems.

Questions to carry

  • When someone quotes a single performance number, which of the three factors of execution time does it describe, and which does it hide?
  • In your own work, what is the common case, and have you measured it or only assumed it?
  • After you make the slowest part of a system faster, what will become the new bottleneck?
  • Why does a benchmark suite of real programs resist gaming better than a single small test?
  • What does a geometric mean of performance ratios tell you, and what does it not tell you?
  • Where should the boundary between hardware and software lie, and who should decide?
  • Why did the RISC argument win inside processors even where complex instruction sets survived at the boundary?
  • How much of the parallelism in a program is visible to the compiler, and how much only at run time?
  • Why does locality exist in programs at all, and could a program be written to have none?
  • How does the cost of a chip grow as its area grows, and what does that imply for design?
  • What changed when Dennard scaling ended, and which old design habits did it make obsolete?
  • When is specialisation worth more than generality, in hardware and elsewhere?
  • Which of your own beliefs about computers would belong in a list of fallacies?
  • How do you choose the workload to measure, and what might that choice cause you to miss?

Words to know

  • Instruction set architecture: The contract between hardware and software that defines the instructions, registers, data types and memory addressing a processor offers.
  • CPI: Cycles per instruction, the average number of clock cycles each executed instruction takes; one of the three factors of execution time.
  • Clock cycle: The basic time step of a processor; its inverse is the clock rate.
  • Execution time: The time a program takes to complete; the measure of performance the book treats as fundamental.
  • Amdahl's law: The rule that the overall speedup from an improvement is limited by the fraction of time the improved part is used.
  • Benchmark: A program or set of programs used to measure and compare performance.
  • Geometric mean: A way of averaging ratios that gives consistent rankings regardless of which machine is taken as the reference.
  • RISC: Reduced instruction set computer, a design style with simple, regular instructions, many registers and memory access only through loads and stores.
  • Load-store architecture: An instruction set in which only load and store instructions access memory and all arithmetic works on registers.
  • Pipelining: Overlapping the execution steps of consecutive instructions so that a new instruction can start every cycle.
  • Hazard: A situation that prevents the next instruction in a pipeline from proceeding in its planned cycle; structural, data or control.
  • Forwarding: Passing a result directly from the stage that produces it to the stage that needs it, avoiding a stall.
  • Branch prediction: Guessing the outcome of a branch before it is known so that the pipeline can keep fetching instructions.
  • Speculation: Executing instructions before it is certain they are needed, and discarding their results if the guess was wrong.
  • Instruction-level parallelism: The degree to which instructions in one program can be executed at the same time.
  • Tomasulo's algorithm: A method of dynamic scheduling that renames registers so instructions can execute out of order without false conflicts.
  • Locality: The tendency of programs to reuse recent data (temporal) and to use data near recent data (spatial).
  • Cache: A small, fast memory that holds copies of recently used data close to the processor.
  • Miss rate: The fraction of memory accesses that do not find their data in a given cache.
  • Virtual memory: A system that gives each program its own large address space, mapped by hardware and the operating system onto physical memory and disk.
  • Yield: The fraction of manufactured chips that work; it falls quickly as chip area grows.
  • Dennard scaling: The historical trend by which smaller transistors used proportionally less power, which ended around the mid-2000s.
  • Cache coherence: The guarantee that all processors see a consistent value for shared memory despite each keeping its own cached copies.
  • Domain-specific architecture: A processor designed to run one class of problem very efficiently rather than all programs adequately.

A note on this edition

This is a study edition written for this shelf in our own words. It describes and explains Computer Architecture: A Quantitative Approach by John L. Hennessy and David A. Patterson, but it does not reproduce the book's text, figures, tables or exercises. The book itself is in copyright and has been revised through several editions; it is worth getting from a library or bookshop and working through with a pencil. Any errors in this companion are ours, not the authors'.

More from “Foundations of computing”

The whole section →