Jump to ratings and reviews
Rate this book

The Elements of Computing Systems: Building a Modern Computer from First Principles

Rate this book
The best way to understand how computers work is to build one from scratch, and this textbook leads learners through twelve chapters and projects that gradually build the hardware platform and software hierarchy for a simple but powerful computer system. In the process, learners gain hands-on knowledge of hardware, architecture, operating systems, programming languages, compilers, software engineering, and relevant algorithms and data structures. Using this constructive approach, the book introduces readers to a significant body of computer science knowledge and synthesizes key theoretical and applied techniques into one constructive framework. The outcome is known as Nand to Tetris. A journey that starts with the most elementary logic gate, called Nand, and ends, twelve projects later, with a general-purpose computer system capable of running Tetris and any other program that comes to your mind.

The first edition of this popular textbook inspired Nand to Tetris courses in many universities, coding boot camps, hacker clubs, and online course platforms. This second edition has been extensively revised. It has been restructured into two distinct parts. Part I, Hardware, and Part II, Software, with six projects in each part. All chapters and projects have been rewritten, with an emphasis on separating abstraction from implementation, and many new sections, figures, and examples have been added. Substantial new appendixes offer focused presentation on technical and theoretical topics.

324 pages, Kindle Edition

First published April 1, 2005

Loading interface...
Loading interface...

About the author

Noam Nisan

6 books23 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
548 (65%)
4 stars
227 (26%)
3 stars
53 (6%)
2 stars
10 (1%)
1 star
4 (<1%)
Displaying 1 - 30 of 65 reviews
Profile Image for Eric.
131 reviews29 followers
April 9, 2012
A good experience overall. This isn't a book you read, but one that you do. Worth looking into especially if you teach computing, or if you feel you need some refreshing as a practitioner. Basically, you build a simple computer practically from scratch, going from Nand to Tetris so to speak.

The most important thing to know about the book is how approachable it is, in other words, that you can do it!. You can start working on this with no background knowledge beyond programming (use whatever your favourite language is). The authors place an emphasis, I think on (1) simplicity, (2) hands-on experience (learn by doing projects, not reading texts), and (3) incrementality [bite-sized projects you can build up on one weekend at a time]. This book would have been great for me at Uni, something much more compatible with my learning style.

OK, so a bit more about the book. You get NAND gates (and DFFs which in principle can be derived from them) and build your way up up up: first some simple logic gates, and there adders and a simple ALU, then memory, and a proper CPU (all of this using a simple hardware description language and a Java simulator). Having built yourself a computer, you then write an assembler for your hard-earned machine language, and top of that a simple stack based virtual machine; and up up, a compiler for a higher level language targeting your VM and finally an “operating system”/standard library (providing simple services like drawing circles on screen).

Why would you do something like this? Why, especially, if you've already been there and done that with chips, compilers, operating systems? Think a minute about your experience as university computer science student. You've done the bits and pieces. You've taken the hardware design course (CSE 371) and stared confused at the latches on the board. You've written crashy bits and pieces of an operating systems (CSE 380); and you've put together many of the parts that make a compiler (CSE 340). These were great (if sometimes frustrating), but isolated and individual experiences. You got many parts of a good CS education, but you spent so much energy trying to wrap your head around individual concepts and ideas that you failed to make it all gell, get a sense of how it all fits together.

I'm very grateful for the education I got, but I always felt like I needed a bit more help understanding things. I feel now that having this Nand to Tetris course as a precursor would have helped me a lot because it would have provided a skeletal framework, and very concrete hard-won big picture, upon which I could build deeper understandings of the individual topics. This book won't replace your compilers or operating systems course — it's not the point — but will complement it either by giving you a map before your begin your CS journey, or a good chance to reflect on what you've learned, if by rights you're supposed to have learned the stuff already.

I haven't figured out all the secrets to this book (the things it gets right). Some of the ingredients, are, in my opinion:

* integration: mental image of fitting jigsaw puzzle pieces together
* hands-on: very much chop-wood and carry water
* simplicity: your ALU only does addition, negation, some simple booleans; your compiler only has to parse an LL(0) language -- depth is not the point; we just do the bare minimum of everything that could be useful
* modularity: you build up one layer of abstraction and can throw it away and use the reference implementation instead
* small pieces - each chapter can be done in one weekend each. That's 3 months if you're willing to dedicate a weekend a month to the book. It may take you a lot less than that (I was particularly slow)
* scaffolding - the book provides all the infrastructure you need to get going: all the emulators, compilers, automated unit tests. One key thing: you even get skeleton files for each module you're supposed to write (fill in the functions). This is important. You don't want minor obstacles. You want to be able to make progress quickly.
* rigidity - all the assignments have a clear success condition; you know exactly what you're aiming for
* linearity - there's a constant sense of moving up, up, up the ladder of abstraction. The sense of “progress” is important
* solo friendliness - group projects are great, but this is a book that works best when done as a solo activity (you need to see the whole picture; it's not enough to write pieces of systems). Good thing it emphasises the bite-sized!

Some frustrations or things that could be better:

* the VM emulator is a bit flaky (null pointer exceptions, sigh) {at the time of this writing; 2012-04]; this made testing a bit harder than it needed to be
* chapter 9 (learning the Jack language), in contrast with the rest of the chapters, was too open-ended for me (eh, find something you want to write and write it). Frankly, not interested in writing programs in that silly little language.
* chapter 12 (the OS/stdlib) was a bit of a slog (by the end of the book you just want to be done and get that damned Pong game working already). I wonder if this can be addressed by replacing the overly-open ch9 assignment with some standard library functions. This way ch9 feels like working towards something, and ch12 is not as long. It doesn't even to be presented as part of the operating system in ch9. Just sort of randomly “let's implement multiplication!”
* [this is me being way excessively demanding]: the test suite supplied for the later chapter could have been more extensive, used more incremental stages. I dunno. Making the suites would have a high cost, so I'm really just being demanding here, and on the other hand, the important part of this book was making very concrete mistakes and confronting details the hard way. So maybe the sparsity of suites was not so bad, forces you to re-evaluate things.

Overall the book gives you a solid framework, a safe place to make lots of mistakes, and a way to find out you made them. It forces you to confront nitty gritty details in a very structured and simple way. If you tend to understand things in abstract, but be a little shaky when it comes down to it, well this book may be for you. All the off-by-one errors you make have got to teach you some appreciation for your craft.

Profile Image for Andrew Obrigewitsch.
938 reviews126 followers
March 17, 2017
One of the best books out there on computer architecture, and it provides everything most Computer Scientists will need.

A great place to start your exploration of the nuts and bolts of how computers operate.
Profile Image for Roy Klein.
91 reviews10 followers
June 23, 2012
In this book you build a virtual computer, starting from a single component (NAND gate), and ending with an OS written in a custom high level language you implement.

This construction process is separated to layers where each chapter is dedicated to a single layer, and almost everything you need in order to implement it yourself (more about the almost later).

I've always had an interest in how the lowest levels of the computer works, and have tried reading more than a few books about the subject, but none of them come close to the "aha!" feeling this book gives. I absolutely recommend it above all other books for people with an itch to understand inner workings of a computer, as this is the only book I know that will scratch it.

My only problem with the book was that the authors do not always provide everything you need in order to succeed, and they don't trust you with the solution for the exercises, not in the book, not in the official site and not in the forums. I had a frustrating experience, where I didn't realize that in the hardware level you may connect your output to more than one pins, something which is absolutely essential to know. Since there are no solutions in the book, I could've remained stuck there forever, but fortunately I found a solution online.

The software projects will be frustrating for non experienced programmers as they are definitely not trivial. Again, I would've liked it better if the authors trusted the readers to know when they can tackle the problem themselves and when they'd benefit from a peek at the solution.
Profile Image for Adam Zerner.
60 reviews114 followers
January 18, 2017
Note: I'm evaluating this more as a course than as a book.

The big idea behind this course is, "CS students often miss the forest for the trees. We want to zoom out and show them the forest." I really really like this idea, and I think the authors did a fantastic job showing us the forest. a) It's useful to see the forest. b) It's useful for an app developer who doesn't want to spend 4 years in a CS program to get a full overview of how computers work in a more reasonable length of time.

Somehow, despite it being a 12 week course, it managed to be very thorough. I really appreciated this. You really do build a full computer from scratch. There aren't any gaps where they say, "Oh, just treat this part as magic and move on". Personally, I'm the kind of person who likes to know how everything works. If someone explains 99% but tells me to treat the remaining 1% as magic, I feel unsatisfied. "But... but... how can that magic possibly happen?" After taking this course, nothing about computers seems magical to me, and that leaves me feeling a sense of closure.

Another core idea behind this course is that you develop a deeper understanding when you discover things for yourself. I think that philosophy was very apparent throughout the whole course. In the book, lecture slides, and lecture videos, the authors provide you with the prerequisite background info you need to understand the chapter, explain the ideas in the chapter at a high level, but they don't tell you exactly how to build it. They give you a specification for the thing you're building, and they do offer some guidance, but ultimately, you have to figure it out.

I think there's a delicate balance between explaining things and letting the student discover them. I like that the authors encouraged discovery, but I also think they should have given more guidance than they did. At least as an option. "First read this. Then try to do the project. If you get stuck, here's hint #1. If you get stuck again, here's hint #2. Etc." Perhaps they don't trust students to resist the temptation, but given that the majority of the audience are people with the initiative to take a MOOC, I think it'd be better to treat them like adults.

My biggest critique is that the book needs wayyyyy more visuals. I always think books need more visuals, but this one in particular needed way more. However, this is largely mitigated by the fact that you use the lecture slides as visuals. But still, it isn't like they acknowledge, "We know there needs to be a visual here. See slide #12 from lecture 4 for that visual."
Profile Image for Seneda .
72 reviews
February 12, 2021
Read it as a companion to the two part course on Coursera. The courses, website and book are very well structured. Highly recommend.
June 20, 2015
Only finished the hardware part but must admit that the book built the foundation for me to understand how the actual internal computer works. The book starts from guiding to build the smallest unit of a computer, which is a gate logic, to RAM and CPU. This definitely makes further studying about OS easier. The software part would need knowledge about some high-level languages. If your purpose of studying is to know how things work rather than actually build a OS, then I recommend read another book like the "Operating Systems Internals and Design Principles".
October 11, 2013
Reading this book as a self-taught programmer gave me a good introduction to computer engineering. I am well aware of that the computer architecture in the book is really simplified, but it was perfect to give a good understanding of how the different layers of abstraction actually work.
Profile Image for Christina Bögh.
11 reviews1 follower
June 2, 2017
This book is just wonderful. It guides you through the whole process of designing a computer until you can write assembler programs; step by step. Not too hard, not too fast - no, just right. This was an excellent read and I've learned so incredibly much.
November 28, 2019
This book helps develop one's understanding of the relationship between the architecture of the machine and the software that runs on it. A must-read book for all programmers out there.
18 reviews1 follower
November 23, 2021
We shall not cease from exploration, and at the end we will arrive where we started, and know the place for the first time. -TS Elliot
11 reviews5 followers
January 11, 2020
This book is so good, it makes me want to downrank all other books in comparison, so they can all fit on the same 5-star scale.

I read this book some time around 9th grade, and it laid the foundations for all my later CS education. I would not be where I am today without this book.

If you already know how computers work from transistor to browsers, this book won’t teach you anything new.

If you know some programming and want to know “why?”, this book will tell you, and in doing so give you a framework to insert future detailed learning into. This book takes you top-to-bottom in the simplest possible working system, so you can see the whole thing all at once. When you understand how it all fits together, diving into a particular subsystem is much more powerful; you understand why it’s there, what constraints its neighboring systems put on it, and so forth.

Highly recommend.
7 reviews
October 31, 2018
This book is a fantastic hands-on introduction to the entire computing stack, starting with individual logic gates, building up adders, registers/RAM and more, through building a simple ALU, CPU and computer, and then implementing assemblers and compilers for the computer you've built.

The exercises for each chapter are really well thought out, and the authors are still maintaining a web site for the book 13 years later. Even though I was already familiar with a lot of the material, I really enjoyed going through all the exercises and I ended up learning a lot. The exercises definitely assume some prior programming experience.
166 reviews3 followers
January 18, 2014
I never finished this, but I thought it was amazing. You get to build an ALU and CPU out of the most basic logic gates, learn about virtual machines and write interpreters/compilers for a high-level language -> virtual machine language (stacks/push/pop) -> assembly -> machine code.

I felt like a total bad-ass after every completed exercise, and learned a lot about how computers work in the process.
Profile Image for Dang Pham.
8 reviews4 followers
July 3, 2013
Excellent book . It talks about the computational structure from the ground up with elegance. The concepts this book presents make things we don't usually appreciate, like the SIM card, seem like engineering wonders.
Profile Image for Adamas.
14 reviews24 followers
November 29, 2011
i think they could have done a better job on explaining the virtual machine.
Profile Image for Stephen.
12 reviews3 followers
September 9, 2014
If you want to get a better idea what is happening under the hood of your computer, get this book. This is one of the best investments I have made.
Profile Image for zhixin.
281 reviews9 followers
May 24, 2020
This is a solid read that lucidly breaks down into layers the marvel that is a computer. It manages to distill what would ordinarily be an intimidating scope to the essentials, and is so clear in laying out how the current chapter ties to the previous and the next every step of the way, that you finish the book with that satisfying click in your mind as the patches of your knowledge latch together.

It starts off with boolean logic, defining some basic boolean functions (and, or, not) and illustrating the gates that implement them. The satisfying part of logic: given basic gates, construct other gates with these building blocks, like Xor or a demultiplexor. Increase the bits, so we get N-bit outputs from N-bit inputs, and other combinations depending on the intention. Now that we have a few gates to work with, we move on to addition, and the representation of negative numbers in bits. Put them together into an Arithmetic Logic Unit (ALU), which defines a list of basic functions that we’ll have fun with in machine language.

Then: add the concept of time! Stateless functions are great but we need states and memory, so here’s where flip-flops come into play — take your usual inputs but throw in a clock input too, and output the previous tick’s input. Registers: buckets to keep your numbers in, which can be built from a data flip-flop (DFF) by continuously feeding the DFF’s output back into its input so it’ll spit it out again. (Here’s where I philosophise that memory is a construct built upon eating your own vomit and regurgitating it.) Many registers make a Random Access Memory (RAM), which now requires addresses so it can retrieve the value from the correct register.

From here on we deal with a series of translations, that ultimately lets us program in higher level programming languages. With machine language, some familiar concepts surface, like pointers and conditionals. The assembler translates these instructions into bits through specific formats that codify that the i-th to j-bit are reserved for the function or src/dest address.

Everyone’s favourite module in college — compilers! (Not mine because I er didn’t take it, which I obviously deeply regret.) These things translate high-level languages into machine language, and because computing is all about the abstractions, this step is broken into two, so now we have high level language -> intermediate language -> machine language. The platform that runs the intermediate code is called a Virtual Machine (VM). Over here we learn about the stack machine model, so that programs have a way to return to function A that calls function B after processing function B’s output.

To translate a high level language into VM language, there are two steps: syntax analysis and code generation. In the first, we tokenize the input characters into language atoms before parsing it; this is a recursive step resembling how we interpret grammar, where based on syntax we decide what part of language (expression, symbol, statement) the characters are. Finally at the OS level, we deal with a series of common libraries, including outputting pixels to screen, interpreting keyboard and mouse presses, allocating and deallocating memory, and the main system loop.

The book is meant to be hands-on where the reader implements the entire flow from gates to the OS, but I haven’t done that. Nevertheless, I enjoyed the perspective the book gives, which I never quite got from university modules that dived directly into the specific parts of computing.
September 2, 2021
I loved the book. Each chapter progresses nicely, and the problems and exercises were fun! You start from NAND gates, then learn to make other gates with it, then learn how arithmetic is done is computers, then machine language, and so on - slowly progressing through layers of abstraction. The book is self contained, and a high school level math knowledge is enough. If one is unable to solve the problems, there are solutions online, so no worries. Everything is presented clearly and but don't reveal everything so the exercises are not boring. I would've given 5 stars, but I gave 4 because I wish the book was a bit more technical.

For anyone wanting to learn computers from the ground up (or say, build a computer in Minecraft or make a computer IRL), this book is 10/10.
Profile Image for David.
1,065 reviews42 followers
November 27, 2019
5 stars, a great read. Even if you've been exposed to all these topics, it's nice to see them so closely tied together.

I think the path from NAND to Tetris might have been more engaging had the authors dropped the virtual machine layer. It's pitched as a solution to targeting alternative hardware platforms (which is not further explored), and that struct me as a wrong emphasis for an end-to-end tutorial. I think it was included merely to compensate for a machine language that's not expressive enough on its own (e.g. the stack gets introduced at the VM level, it's not present at the ML level; perhaps they wanted to minimize the amount of HDL in the book).
3 reviews
August 6, 2020
Excellent walk-through of computing systems. I just got the book and worked through it without doing the Nand2Tetris Coursera course - but I felt that this book alone was enough. The chapters are easy enough to follow. The included software is fantastic (I recommend working through the exercises in VS Code and using the nand2tetris vs code extension: https://marketplace.visualstudio.com/...). Also, the writer does not hold your hand too much, so you have to think, re-read and think again to complete the exercises, which facilitates better learning in my experience
July 21, 2018
This book provides an awesome introduction to the basics of computer hardware, providing the tools to let you build each part as you read the relevant chapters. Twenty years ago, I fought my way through Patterson & Hennessy's "Computer Organization & Design" as part of my Computer Science studies, and I can honestly say, that I wish we had used Nisan & Schocken's book instead.

Reading this book, and doing the exercises, has given me an interest and a love for a subject I honestly hated when I had to do it as part of my education.
Profile Image for Bishop Adler.
13 reviews
July 30, 2019
Amazing book, reading actively will allow you to understand how a computer works logically (although in terms of the actual physics/electrical engineering, this book doesn't touch on it. In fact, it barely mentions transistors). With that in mind, this book takes the reader from basic logic gates to an OS. It's able to do this without being abstract, as each chapter requires the reader to build every chip described /every piece of software abstracted.

In other words, the book lives up to its name.
Profile Image for Mike.
101 reviews2 followers
November 13, 2019
Only half way through and I give this book full marks for just the first six chapters alone. It isn’t so much how it is written but more what isn’t there. The book is written around the projects and the answers aren’t given, only the test cases that need to be passed. This forces the student through “the joy of discovery�� process (their words). For that I am grateful, I learned much having been forced to walk the path.

If you struggle, stick with it. The book hints and website support have everything you need to make it work.
Profile Image for Amade.
28 reviews
September 27, 2017
In conjunction with Nand2Tetris courses at Coursera (part I and part II), this book belongs to the ones having the biggest positive influence on my life. It's hard to work through all the problems, took me months, but at the end of it, you feel it's worth so much. I recommended it people interested in technology, who don't have a degree in computer science. Fills a lot of the gaps in your understanding of computer systems.
82 reviews6 followers
September 21, 2019
I worked carefully through the hardware half of the book. I finally understand the elements of digital logic, the design of an ALU, instruction decoding, the design of a CPU. I skimmed the second half, on software, because I'm already familiar with those topics. It seemed equally clear but I'm not the target audience for the software topics so I cannot say if they succeeded as brilliantly as they did with the hardware half.
Profile Image for Tom.
77 reviews4 followers
May 28, 2020
This is the accompanying textbook to the course "From Nand to Tetris" and provides an overview of the software construction of a computer starting from logic gates. The real meat is found in the course projects. The overview is simplistic to keep the projects small in scope. Keeping the scope small makes sense, but it means that although completing this course will fill some gaps in knowledge, it doesn't do so in a deep way.
Profile Image for Raul Pegan.
185 reviews6 followers
December 28, 2017
Great approach to teaching computer architecture from the ground up. Starts with NAND gates, all the way through processor design, language design, OS, and Compilers. Very minimalist but touches all the bases. Only problem is that this is a stack based machine and not a load-store, which would be much more relevant. But hey I can't complain this is still incredible.
Profile Image for Alex.
116 reviews2 followers
June 11, 2020
I read this book while completing the nand2tetris course.

I cannot recommend the course enough, it is probably the best course I have ever taken and that includes my university studies.

I wish it covered more about how the OS worked and used a few real examples of like the 8080 as an example processor and CP/M as a basic OS but I guess then the book could be huge.
Displaying 1 - 30 of 65 reviews

Can't find what you're looking for?

Get help and learn more about the design.