Why COMP 40?
COMP 40 presents the hardware foundation on which software is built.
- Machine structure shows how data is represented at the machine level.
- Assembly language is how code is represented at the machine level.
- The construction of very high-level abstractions and programming languages on top of very low-level hardware is one of the great intellectual achievements of computer science, and every computer scientist should know about it.
- The data and code model of any particular machine, called
its instruction-set architecture, represents a
contractual agreement between hardware designers and systems
programmers that allows a collection of programs to run on
any hardware which conforms to the instruction-set
architecture. The exploitation of instruction-set architecture to
enable both hardware and software to be changed independently and
reused with each other is one of the great engineering
achievements of computer science, and every computer scientist
should know about it.
(Some of the fruits of this exploitation include operating systems that will run on any x86-compliant hardware; the ability to buy new, more advanced CPUs without having to replace your software; and the ability to create and use “virtualization environments” such as VMware, QEMU, Xen, and so on.)
- A programmer may understand a high-level program's outputs and interactions by understanding only the model of computation presented by the programming language. But to understand how a program performs, one needs a working knowledge of computation at the machine level.
- When something goes wrong in a software system, diagnosing the fault often requires the ability to break the abstraction barriers presented by programming languages and to inspect the state and behavior of the machine at its own level, not the level of programs' source code.
- Much software that is critical to the world's computing infrastructure is written in the languages C and C++, and to understand how this “systems software” works, one must understand machine-level computation.
- You will be able to understand and improve the real performance of programs written in high-level languages.
- You will be able to diagnose and fix bugs that can't be explained without appealing to the underlying machine model. Many important bugs in C and C++ programs fall into this class.
- You will have started learning how to exploit the underlying hardware in ways that are not possible using high-level languages alone.
On all COMP 40 design and coding assignments you will work in pairs with your fellow students. Working in pairs allows you to tackle more complex challenges, you benefit from the expertise and differing perspectives of your partners, and you have an opportunity to make friendships that will enrich the rest of your time in the CS department at Tufts. Although pair programming is a new experience for most COMP 40 students many COMP 40 graduates report that it was a particularly enjoyable and rewarding aspect of the course.
Details of the COMP 40 pair programming policies are available on the course administration page.
PrerequisitesYou must grasp basic algorithms, data structures, and good programming practice. Moderate proficiency in either C or C++ is required. In particular,
- You should have experience with implementation and use of binary search trees, hash tables, and linked lists.
- You should be comfortable working with stacks and queues.
- You should be able to write a recursive function (or procedure or method) and explain why it terminates.
- You should have mastered the ability to write, organize, and document a 250-line program in C or C++.
- You should have some practice writing, organizing, and documenting a 500-line program in C or C++.
- You should have written programs that use
You need some Unix experience.
You must understand the basics of files, directories, creating and
editing files, printing, and compiling programs.
You will be much, much happier if you also can write a simple shell
bash) and use Awk and
Kernighan and Pike cover these
topics at the appropriate level
This course uses the 64-bit x86-64/AMD-64 instruction-set architecture, which may be the most complicated architecture money can buy. To avoid spending many, many hours thrashing out written assignments, you must have or develop the ability to identify relevant information buried in a sea of irrelevant detail. Your course staff will help as we are able.
You must be able to write clear, straightforward technical documentation in English. Properly documenting a program can be as important as correctly coding it, particularly in cases where you expect your program to be used or maintained by others. Furthermore, preparing good documentation is an excellent way to be sure you have thought carefully about the design choices you are making. For all of these reasons, you will be judged on the quality of your technical writing as well as on the quality of your program code.
The Programmer's Mindset
To do well in this or any other systems course, develop these habits:
- Think carefully about a problem before you begin to write code.
- When having difficulty writing code, stand up, walk away from your computer, and think about the difficulty.
- Never be satisfied with a ``working program,'' but strive for the simplest, clearest, most elegant implementation.