Readings for COMP 40: Machine Structure and Assembly-Language Programming

Required texts

In principle, you are required to buy three books: If you're the sort of person who doesn't buy textbooks, or if you can't afford all the textbooks your instructor thinks you should have, there are guidelines on the course home page about which books to buy and why.
In brief, without a copy of Hanson's book you will find it difficult to complete the homework assignments. If you can find good information on C online, you may be able to dispense with a C book. Bryant and O'Hallaron is expensive, but some students find it very useful. I can't predict if you will be one of them.

David R. Hanson, C Interfaces and Implementations, Addison Wesley, 1997.

This book is a model of how to design, implement, and present abstractions for C programmers. Many of the abstractions provide basic algorithms and data structures that are inexplicably missing from the standard C library; in this sense, the book is something of a substitute for the C++ Standard Template Library. Unfortunately, reusable C code cannot provide the same type-safety guarantees that C++ templates provide. The last four chapters, on arithmetic and threads, simply show a virtuoso programmer at work. I hope that Tufts Computer Science will standardize on this book for all classes that require programming in C.

We will both use abstractions from this book and create additional abstractions in the style of this book.

Brian Kernighan and Dennis Ritchie, The C Programming Language, second edition (ANSI C), Prentice Hall, 1988.
The best language manual ever written? You be the judge. This book provides a narrative introduction with plenty of useful, pithy examples. Its only defect is that it does not cover any of the new language features introduced in C99. (There will not be a third edition covering C99, which should tell you something about Professor Kernighan's opinion of C99.) You can get information about C99 from the Dinkumware C library overview.

Kernighan and Ritchie is a book to be read over and over. In my opinion, if you own only one book on C, this should be it.

Sam Harbison and Guy L. Steele Jr, C: A Reference Manual, fifth edition, Prentice Hall, 2002.

This is not a book to be read cover to cover, but if you want a reference book in which to look things up, this is it. An advantage is that it covers all the new features added to C in 1999.

Randy Bryant and David O'Hallaron, Computer Systems: A Programmer's Perspective, second edition, Prentice Hall, 2011.

This text gives a broad, shallow coverage of systems programming. Because COMP 40 is a narrow, deep course in machine-level programming, we will use only selections from this text. However, certain chapters, such as the chapters on cache memory and on machine instructions, will be quite valuable.

You can probably make do with a used copy of the first edition, although to get information about the 64-bit architecture we are using, you'll have to go online.

Supplemental Readings

Peter van der Linden, Expert C Programming: Deep C Secrets, Prentice Hall, 1994.
A quirky, lighthearted explanation of some of C's dark corners. Although it is a bit biased toward explaining ANSI C (which is now old hat), it's an excellent book for a C programmer with medium experience to deepen his or her understanding of how to write good C programs. If you want to own just two books on C, this is a good one. It should be on reserve in the library.
Norman Ramsey, Literate programming simplified, IEEE Software, 11(5):97-105, Sep 1994.
A discussion of literate programming with noweb.

Brian W. Kernighan and Rob Pike, The UNIX Programming Environment, Prentice-Hall, Englewood Cliffs/NJ, 1984.

The classic guide to Unix hacking.

Brian W. Kernighan and Rob Pike, The Practice of Programming, Addison Wesley, 1999.

I don't know how to characterize this book except to say that Kernighan and Pike know as much as anyone about programming with C and Unix, and they have carefully identified the most important (and most entertaining) aspects of their programming practice and set them down concisely in a wonderful little volume of under 300 pages. Check out the excerpts on the web site and decide if you want to borrow the book from the library.

Brian W. Kernighan, The Elements of Programming Style, McGraw-Hill, New York, 1978.

This classic guide shows good programming style by example—often by bad example! If the instructor or grader has cited you for poor programming style, you should read this book.

Kent Beck, Extreme Programming Explained.

An interesting book overall, and has the best detailed description of pair programming (why and how) that I have read. On reserve in the library.

David Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, ACM Computing Surveys, 1(23):5--48, 1991.

In which you can learn, among other things, why your instructor hates the floating-point unit.