CS 240: Introduction to Computer Systems, Fall 2016

(a.k.a. Machine Organization, Computer Organization)

The website is your CS 240 source: https://cs.wellesley.edu/~cs240/fall16/. The Google Group carries timely announcements. Check your email.

Class Meetings: SCI 364, one of:

  • Monday/Thursday 9:50am - 11:00am
  • Monday/Thursday 11:10am - 12:20pm

Lab Meetings: SCI microfocus, one of:

  • Tuesday 9:20am - 12:20pm
  • Tuesday 1:30pm - 4:30pm
  • Wednesday 2:15pm - 5:15pm
  • Wednesday 5:30pm - 8:30pm
Name Contact Locale Drop-in Hours (Google Calendar, iCal)
Instructor Ben Wood benjamin.wood SCI E128, Microfocus Monday 2-4, Wednesday 4:30-5:30, Thursday 3-5, and by appointment. Ben is off campus for research on Fridays and on many Tuesday/Wednesday mornings.
Lab Instructor Jean Herbst jherbst SCI E129, Microfocus Monday 3-5, Tuesday 5-6, Wednesday 12:30-1:30, Thursday 2-4, and by appointment
Tutors Amy, Ella, Kim, Madeleine Google Group SCI Microfocus, or S173 during labs Sunday 7-9, Monday 7-9, Tuesday 8-10, Wednesday 3-5 and 7-9, Thursday 7-10
Classmates CS 240 Fall 2016 Google Group SCI Microfocus, around campus by appointment

Syllabus Contents:


CS 240 examines how modern computer systems run programs, introducing key software and hardware abstractions between high-level programming languages and hardware circuits. The course traces themes of data representation and program translation, focusing on how each level of abstraction (and its implementation) in a computer system impacts the execution of high-level programs. Course goals include:

  • To understand how programs are executed by computers.
  • To understand key software and hardware abstractions, implementations, and representations that comprise modern computers.
  • To understand when and how computer system implementation impacts correctness or performance of arbitrary high-level programs.
  • To understand the role of operating system abstractions.
  • To design and implement small tools and systems at the C programming language level of abstraction.
  • To become proficient at reasoning about program execution by employing assertions and inspecting execution state with debugging tools.
  • To develop critical thinking skills.
  • To develop foundations for further study of compilers, security, computer architecture, operating systems, or other systems/implementation topics in computer science.

Prerequisite: One of CS 111, CS 112, or permission of the instructor. Taking CS 230 before CS 240 offers a gentler transition into core CS, but CS 240 is accessible to motivated CS 111/112 alumnae without CS 230.

Challenge: CS 240 is a challenging course that demands more independence than CS 111 or CS 230. We find that the best way to help you grow to be a strong, independent computer scientist is to treat you like one from the start. We will pose challenging (and fun) assignments and push you to think critically about hows and whys of solutions yourself. We often answer your questions by asking you more questions to help you arrive at answers yourself. CS 240 will push you to accomplish a lot and know that you did so under your own power.


CS 240 is a 3-stage sprint surveying computer systems from transistors to operating systems. The course home page hosts the working schedule. Expect minor adjustments.

Computer hardware implementation (4-5 weeks): from transistors to a simple computer processor

  • Transistors, digital logic gates
  • Data representation with bits
  • Combinational logic, logic for arithmetic
  • Sequential (stateful) logic, memory implementation
  • A simple computer processor and instruction set architecture

Hardware-software interface (4-5 weeks): from C to instruction set architecture

  • Memory addressing, C language, pointers
  • Assertions, debugging
  • Machine code, assembly language, program translation, x86
  • Control flow
  • Procedures, stacks
  • Data layout, security, linking and loading

Abstractions for practical systems (4 weeks): from memory hierarchy to operating systems and beyond

  • Memory hierarchy, caches
  • Operating system support, processes
  • Virtual memory, memory management
  • Compilers, run-time systems, Java


At least one copy of each text is available in the microfocus for use within the CS department area. Please do not remove them from the lab areas. Return them to the shelf when you are done.

We use one primary textbook that you should acquire:

  • CSAPP 3e: key text, need 3rd edition, microfocus has 2 copies
    Computer Systems: A Programmer’s Perspective, 3/E. (3rd edition, significant changes since 2nd)
    Bryant and O’Hallaron, Pearson, 2016. ISBN-13: 9780134092669.
    You need the 3rd edition. See the errata.
    “Global” 3rd editions mostly work, but have some additional errors (not listed on that page).

We provide and use other textbooks mainly during the first 1/3 of the course:

We recommend a good reference on the C programming language. There are many online resources of various quality. One classic book is:

Course Work

topic lab ex code exam

Course work for CS 240 consists of reading and class exercises, laboratory exercises, assignments, and exams.

Reading and class exercises: Each class topic includes reading to be completed before class, posted on the course schedule. Regular reading quizzes on basic concepts or mechanics help motivate you to be prepared and participate. [Update: Quizzes will be posted online with the relevant reading list at least 24 hours ahead of class. Not every class or topic will have a quiz. Quizzes are due by the class for which the reading is assigned, unless otherwise indicated.] We will drop the lowest 20% of your reading quiz grades. CS 240 moves quickly and covers a lot of ground.

To make class time effective, class meetings and group exercises will assume cursory familiarity with basic ideas from assigned readings. Reading before class to learn basic mechanics frees up more time in class to apply or debug your understanding of these mechanics and to consider their deeper implications. Effective technical reading is an acquired skill. Your first reading assignment will include some tips on how to read.

Lab: Weekly 3-hour lab meetings apply concepts in the course. Attendance is required at all lab meetings. The lab experience is key to the course. Many labs focus on tools, concepts, and strategies that are key to larger assignments. Lab work includes:

  • Short pre-lab assignments to prepare for each lab meeting are posted on the lab web page 1 or 2 days before lab.
  • Lab reports built as you work through exercises in lab.

Assignments: The heart of CS 240 is a set of challenging assignments that apply computer systems concepts to design and implement hardware and software.

  • ex Moderate written exercises explore concepts in the small or in the abstract.
  • code Large applied assignments run 1-3 weeks and involve significant effort on programming, reverse engineering, and debugging.


  1. 2-hour take-home exam: self-scheduled during Wednesday-Friday, 12-14 October, covering data representation, digital logic, and microarchitecture.
  2. 24-hour take-home exam: self-scheduled during Tuesday 29 November - Thursday 1 December, covering instruction set architecture, machine programming, memory hierarchy.
Percentage Letter
> 93.3 A
≥ 90.0 ≥ A-
> 86.6 ≥ B+
> 83.3 ≥ B
≥ 80.0 ≥ B-
> 76.6 ≥ C+
> 73.3 ≥ C
≥ 70.0 ≥ C-
≥ 60.0 ≥ D
< 60.0 F

Grading: The overall grade weights course work as follows:

  •   2% topic reading exercises/quizzes
  • 15% lab
  • 50% ex + code assignments
  • 33% exam + exam

Grades are converted from percentages to letters as shown in the accompanying table. The minimum percentage required to achieve a given letter grade may be adjusted downward (to students’ benefit), but never upward. If your percentage grade satisfies the constraint in the left column, then your letter grade will satisfy the constraint in the right column of the same row.

This course complies with the Wellesley College grading policy (http://www.wellesley.edu/registrar/grading/gradingpolicyfaq). While that policy asks faculty to hold each 100- and 200-level course with 10 or more students to an average of no higher than 3.33 (B+), it does not require faculty to grade on a “curve.” There is no arbitrary limit on the number of A’s, B’s, C’s etc., and every student will be assigned the grade they earn and deserve according to the grading standards of the college. In past semesters, the challenge of this course has naturally yielded grades meeting this standard.

Late Policy: Deadlines are necessary to keep the course moving, but sometimes your schedule requires some flexibility. Each student is allotted 4 × 24-hour late passes to use during the semester. Each pass may be redeemed to delay one assignment deadline by exactly 24 hours for one student. (e.g., turning in an assignment 1 hour late or 23.5 hours late both cost exactly one 24-hour pass.) Partners must both redeem a late pass to delay a pair assignment deadline. A severe grade penalty is assessed for late work without passes. Any number of available passes may be applied to any assignment deadline up to the end of final exam period, after which no work is accepted. Passes are non-transferable and may not be applied to exams. Consult your instructor and class dean for alternative arrangements in case of severe extenuating circumstances.

Honor Code

The section describes how the Honor Code applies to CS 240 course work, defining standard acceptable resources, assistance, and collaboration. Specific assignments may explicitly override these rules or definitions. Violations of the guidelines below are considered violations of the Honor Code and handled accordingly. If in doubt, ask (permission, not forgiveness)!

Reading and class topic exercises allow unrestricted use of resources, assistance, and collaboration. Reading quizzes must be completed individually with no assistance and explicitly indicate allowed resources, if any.

Assignments lab ex code are subject to these rules:

  • Your submitted work must be your own, written by you alone.
  • You must cite all assistance, collaboration, and external resources (who and what) used to develop work you submit.
  • You may not view, share, or accept solutions or code even if you do not use the material in your own submitted work.

Resources: You may consult course material from this semester and external documentation of hardware or software tools or libraries required for the assignment. You may consult external reference material for general concepts and techniques. You may not consult solutions to the assignment or any similar assignment.

Collaboration: You are welcome and encouraged to discuss concepts, ideas, and strategies for assignments at a general level with other CS 240 students, subject to definitions below.

Pre-lab lab and written ex assignments: You are welcome to work through problems on pre-lab lab and written ex assignments with a small number of other CS 240 students, if collaborators contribute in similar measure. If you find notable imbalance of contributions, adjust your participation or seek different collaborators. You may not divide the assignment, have individuals complete separate parts, then combine the work. You may not write solutions together. You may not copy or photograph collaboratively developed solutions. Do take general notes on the approach, structure, or key steps of your collaborative solution. Then, later, write solutions on your own, referring to your notes only if needed. A good rule of thumb is to wait at least 30 minutes after collaborative work before writing your solutions. Then you know whether you actually understand the solutions (and their derivation) yourself. If this process is mainly copying your notes, your notes are too specific.

Applied code assignments: You are welcome to discuss concepts, ideas, and strategies for applied code assignments at a general level with other CS 240 students, but you may not develop detailed designs, algorithms, or code collaboratively. You may accept help from course staff to locate errors, interpret error messages, and correct errors of syntax. You may accept help from CS 240 students to interpret error messages. You may not, under any circumstances, examine other students’ code or show them your own. You may not accept assistance designing, implementing, or correcting errors of logic. You may reuse provided starter code in your solution without restriction. You may reuse code from other course materials only with prior written approval from the instructor and explicit attribution of the source. You may not reuse or adapt any other code.

Pair-programming assignments: Explicitly designated pair-programming assignments allow or require a pair of students to complete and submit one solution together. Partners must contribute in similar measure to the submitted work and complete at least 90% by working on each problem together in real time on one computer. Partners should take shifts at the keyboard. You may not divide the assignment into parts, have partners complete separate parts individually, then combine the work into a single solution. You may consider design or debugging separate from your partner. Implementation must be done together. If needed, you may consult course staff for assistance alone, without your partner. If it becomes necessary to split a pair, the partners must consult with the instructor and document what work was completed together.

Electronic Devices

While we learn about the internals of your favorite computing devices (phone, laptop, tablet), please silence and stow them during class meetings. During class meetings, this helps you (and your peers) focus without distraction. Taking physical, handwritten notes also tends to help students distill the key ideas and remember them better. If you really prefer (or need) to use a laptop/tablet for taking notes, please speak to me to arrange an exception. In lab meetings, Jean may suggest using your laptop for extra screen space during lab meetings – feel free to do that in lab.

Accommodations and Feedback

Please share suggestions and comments about the course at any time. Feel free to speak with me about concerns or suggestions about how I can make the course more accessible to you. I will do my best to help. An anonymous feedback form is available if you would prefer.

Students with disabilities who are taking this course and who need disability-related accommodations are encouraged to work with Jim Wice (781.283.2434 or jwice@wellesley.edu), the Director of Disability Services. Jim’s office is located in the Pforzheimer Learning & Teaching Center on the third floor of Clapp Library. If you have a physical disability or a learning disability, Jim is the person to see to arrange for accommodations. If your learning disability is undocumented or if you are uncertain as to whether you have a disability, Jim can arrange for you to be tested.

Students whose religious observances conflict with scheduled course events (e.g., labs, exams, etc.) may contact the instructors in advance to discuss alternative arrangements.


Parts of this course draw on material developed by the CSAPP authors at Carnegie Mellon University, adaptations of this material used in CSE 351 at the University of Washington, and material on digital logic and microarchitecture from earlier CS 240 iterations at Wellesley. Some parts of the Honor Code guidelines are adapted from the Williams College Computer Science Department Honor Code Guidelines.


A compilation of tips from CS 240 staff and students. Have more? Let me know.

  • Read before class. It’s fine if you do not understand all of the reading, but seeing it early lets you ask better questions in class and hit the ground running in class exercises.
  • Do not worry about being wrong in class. Students are often uncomfortable offering answers or suggestions in class for fear of peer judgment if they are wrong. First of all, there are fewer binary right/wrong questions in this course than students expect. Second, we are learning! Being wrong is normal and often more useful in class than being right. The best answer is a thoughtful answer. We have more opportunity to learn if I ask questions you cannot necessarily answer easily. Better to share a wrong answer and fix it together than to keep that wrong answer to yourself for use on an exam. I will make mistakes at least a few times in class (only occasionally on purpose). Join me – it’s fun! (Third, I do not tolerate students criticizing other students for being wrong in class.)
  • Take notes in class. The slides can be useful, but they are just a prop. The most useful and interesting insights happen in exercises and other discussion. Writing down your solutions (and your approach!) is great reference for review later.
  • Ask questions in class, in office hours, in tutor hours, in lab, of your classmates or on the Google Group (but first, read the Honor Code definitions). The knowledge will not come to you. Go get it. We will often answer your questions with more questions.
  • Read the instructions on assignments and understand the specifications. There is often good advice about how to approach the problem most effectively.
  • Work incrementally. As you work through an assignment (after you understand it), think and plan before you ever write any code or build any circuit. Writing code before planning and writing one big pile of code before testing are two sure routes to disaster. Plan carefully before you ever touch the keyboard. Write pseudocode. Draw diagrams. When you are ready to write code, do it incrementally. Write a small piece. Write assertions to document your assumptions. Test it. Does it work? No? Repeat until it does. Now, commit it so you can get back to this point if things go wrong later. Then, write the next small piece, and so on. Step back occasionally and consider if you are still on track for your plan. Does it need adjustment?
  • Start assignments early and meet the checkpoints. (Really, early! Really early. Ask any CS 240 alum.) Before you can “just finish” the assignment, you will need time to absorb the task, understand how to approach it, plan, take a break when you get stuck (time away from a problem almost always helps me), debug, ask questions, and more. Some of the assignments are big or complicated. The checkpoints will help you keep on pace to finish comfortably.
  • Come to class and lab. One or the other leads directly into the next assignment. We do useful and fun things. If you do not think so, then let me know! Oh, and, it counts toward your grade.
  • Work in the microfocus. Tackling challenging assignments next to your classmates builds camaraderie, eases sharing of tips and techniques, and affords opportunities for silliness.
  • General tips from PLTC Academic Peer Tutoring