CS31: Introduction to Computer Systems
Spring 2016

Class Info | Schedule | Lab Sessions | Ninjas | Tips for Success
Grading | Academic Integrity | Academic Accommodations | Links


  • We'll have a final exam Q&A review session on Wednesday, May 11 at 11:00 AM. Location TBA.

  • Our final exam has been scheduled for Thursday, May 12 at 2:00 PM in SCI 199.

Class Info

Class: TuTh 1:15–2:30, Science Center 199
Professor: Kevin Webb
Piazza: Q&A Forum
GitHub: Swarthmore GitHub Enterprise
Gradesource: Grade listing
Office: Sci 255
Office hours: Mo 1:00–2:30, Tu 2:30–4:00, or by appointment

This course is a broad introduction to computer science that focuses on how a computer works and how programs run on computers. We examine the hardware and software components required to go from a program expressed in a high-level programming language like C or Python to the computer actually running the program. This course takes a bottom-up approach to discovering how a computer works, and introduces parallel and distributed computing with a specific focus on parallelism for multicore and other shared memory systems. Topics include theoretical models of computation, data representation, machine organization, assembly and machine code, memory, I/O, the stack, the operating system, compilers and interpreters, processes and threads, and synchronization. In addition to parallel programming, we will discuss parallel computers and system-level support for parallel computing. Prerequisite: Completion of CS21 or its equivalent.

The course is composed of the following:

Required Textbook:

Rather than requiring a textbook, we're going to try something a little different this semester and use readings from the web as our introduction to new material. The textbook we've used in the past for this course is: Computer Systems: A Programmer's Perspective by Bryant and O'Hallaron (Second edition: 2/E CS:APP2e). It's a great reference, and I recommend it as a supplemental source of information, if you're interested. I will list corresponding sections for this book, when applicable.

Goals for the course:

By the end of the course, we hope that you will have developed the skills to:


This is a tentative schedule; it may change as we go. You should read the assigned sections before class to prepare for the reading quiz. All section numbers refer to the Bryant and O'Hallaron textbook unless otherwise indicated.


Jan 19

  Course Introduction
No reading

Jan 20

  Lab, Week 1 Lab 1

Jan 21

  Data Representation
Reading: This page
Textbook (supplemental): 2.1 - 2.1.3, 2.2 - 2.2.3

Jan 26

  Binary Arithmetic
Reading: This page
Textbook (supplemental): 2.1.8, 2.1.10, 2.2.3, 2.3 - 2.3.1

Jan 27

  Lab, Week 2 Lab 2

Jan 28

Lab 1 Due

Drop/Add Deadline (Feb 01)

Introduction to C Programming
Reading: C for Python Programmers (Sections 1.5-2.5)

Feb 02

Lab 2 Due

Digital Circuits
Reading: Page 1 and Page 2
Textbook (supplemental): 1.4.1, 4.2 - 4.2.4

Feb 03

  Lab, Week 3 Lab 3

Feb 04

  Digital Circuits, Continued
Reading: This page and the sections titled "Arithmetic logic unit", "Signals", and "Circuit operation" of this page.
Textbook (supplemental): 4.2.5

Feb 09

Lab 3 Checkpoint Due

ISAs and Assembly
Reading: From this PDF, The introduction (first page) and sections 2.2, 2.3 - 2.3.3, 2.5.0
Textbook (supplemental): 3.0, 3.2

Feb 10

  Lab, Week 4

Feb 11

  ISAs and Assembly, Continued
Reading: X86 Assembly (Intro through "Registers" section), Addressing modes (Just the intro here / stuff above table of contents), and Branching
Textbook (supplemental): : 3.4 - 3.4.2, 3.6 - 3.6.4

Feb 16

Lab 3 Due

Pointers and Memory
Reading: The 5-minute guide to C pointers
Then, watch this short, silly pointer video.

Feb 17

  Lab, Week 5 Lab 4

Feb 18

  Pointers and Memory, Continued
Reading: Pointer Arithmetic (skip "Two dimensional arrays" and "Pointer subtraction") and malloc & free
Textbook (supplemental): 3.5.1, 3.8.2, 9.9.1 - 9.9.2, 9.11 - 9.11.2, 9.11.7 - 9.11.10

Feb 23

Lab 4 Due

Functions and the Stack
Reading: From this page, the intro through the "Structure" sections.
Textbook (supplemental): 3.7 - 3.7.3
Note: The textbook draws memory upside down as compared to how we draw it in class!

Feb 24

  Lab, Week 6 Lab 5

Feb 25

  Functions and the Stack, Continued
Reading: From this page, read about the call and ret instructions and the subsequent "Calling Convention" section (scroll down a little).

Mar 01

  Arrays, Structs, and Pointers
Reading: page 1, page 2, and the intro of page 3.

Mar 02

  Midterm Q&A / Work on Maze

Mar 03

  (In-Class Midterm)
Midterm Info Slides

Mar 08

Spring Break

Mar 09

Mar 10


Mar 15

Lab 5 Due

Arrays, Structs, and Pointers, Continued
No reading quiz. Review the previous readings.

Mar 16

  Lab, Week 8 Lab 6

Mar 17

  Storage and the Memory Hierarchy
Reading: The introduction of these two documents: page 1, (stuff before 6.1), page 2 (stuff before "operation")

Mar 22

Lab 6 Due

Reading: From this page, the sections:
Intro through "Hit or Miss", "Cache Tagging", and "Cache Misses"
Textbook (supplemental): 6.3 - 6.4.4

Mar 23

  Lab, Week 9 Lab 7

Mar 24

CR/NC/W Deadline (Mar 25)

Caching, Continued
Reading: Look over this cache associativity handout and the intro through "least recently used (LRU)" of this page

Mar 29

Lab 7 Due

Operating Systems
Reading: page 1 (Intro and "Representation"), page 2 (Intro), and page 3 (Intro)

Mar 30

  Lab, Week 10 (Same page as week 8) Lab 8

Mar 31

Reading: page 1 (Intro and Scheduler), page 2 (Intro and Overview)

Apr 05

  Virtual Memory
Reading: An Introduction to Virtual Memory
Textbook (supplemental): 9.0 - 9.2, 9.5, 9.6.0

Apr 06

  Lab, Week 11

Apr 07

  Virtual Memory, Continued
Reading: This page, Intro and Page faults

Apr 12

Lab 8 Due

Parallel Applications and Threading
Reading: The Concurrency Revolution (Note: this article is from 2005)

Apr 13

  Lab, Week 12 (No special lab link.) Lab 9

Apr 14

  Race Conditions and Synchronization
Reading: this page, Intro through "multithreading" and this page, Intro
Textbook (supplemental): 12.4 - 12.5.3

Apr 19

  Race Conditions and Synchronization, Continued
Reading: this page, Intro through "necessary conditions"
Textbook (supplemental): 12.7.4 - 12.7.5

Apr 20

  Lab, Week 13

Apr 21


Apr 26

  Parallel Programming with pthreads
Buffer Overflows

Apr 27

  Lab, Week 14

Apr 28

Lab 9 Due (Apr 29)

Course recap and
Networked Hangman

May 12

Final Exam, 2:00 - 5:00 PM (Science Center 199)

Lab Policy

This course features regular lab assignments that account for the largest component of your course grade. Lab attendance is required by all students, unless you have already completed and submitted the lab assignment for the week. Additionally, the cs labs are open 24 hours a day, 7 days a week for you to use for CS31 lab assignments. While you must attend the lab session for which you are registered, you may optionally attend additional lab sessions, provided space is available. In case of space constraints, students registered for the lab will have seating priority.

Lab assignments will typically be assigned during the lab sections on Wednesday will generally be due by midnight on Tuesday, one week later. You are strongly encouraged to start early!

Even if you do not fully complete an assignment, you should submit what you have done to receive partial credit.

Weekly Lab Sessions
Section A Wednesdays 8:50—10:20 Science Center 240
Section B Wednesdays 1:15—2:45 Science Center 240
Section C Wednesdays 3:00—4:30 Science Center 240

Accessing the CS labs after hours

You can use your ID to gain access to the computer labs at nights and on the weekends. Just wave your ID over the microprox reader next to the lab doors. When the green light goes on, just push on the door handle to get in (the door knob will not turn). If the green light doesn't go on, then we need to enter your microprox number into the system. If you have issues with the door locks, send an email to local-staff@cs.swarthmore.edu. If the building is locked, you can use your ID to enter the door between Martin and Cornell library. For this class, your ID will give you access to the labs in rooms 238, 240, and 256.


The CS 31 Ninjas are student mentors who will assist in class/labs and run evening study sessions. You are encouraged to participate in Ninja evening study sessions to get friendly assistance on lab assignments and help with preparing for exams.

Weekly Evening Ninja Session: Sundays, 7:00 PM - 11:00 PM

The CS 31 Ninjas:   Amy, Charlie, Douglass, Jack, Martina, and Zoe
Ninja Coordinator:   Lauri Courtenay (SCI 257)


Grades will be weighted as follows:
35%Lab assignments
30%Final Exam
25%Midterm Exam
  5%Reading Quizzes (I will drop your three lowest quizzes.)
  5%Class Participation

Absence / Assignment Extension Policy

For CS 31, we will drop your three lowest reading quizzes and participation grades. Dropping these scores is intended to help when you need to miss a class due to a minor illness or to travel for an interview. You are still responsible for the material, and you should review any missed materials via the class recordings as soon as you can.

If you feel that you need an extension on an assignment or that you are unable to attend class for two or more meetings due to a medical condition (e.g., extended illness, concussion, hospitalization) or family emergency, you must provide your instructors with official documentation from the dean's office or student health center. Their documentation will help us to provide the appropriate accommodations.

How to Succeed in CS 31

Academic Integrity

Academic honesty is required in all your work. Under no circumstances may you hand in work done with (or by) someone else under your own name. Your code should never be shared with anyone; you may not examine or use code belonging to someone else, nor may you let anyone else look at or make a copy of your code. This includes, but is not limited to, obtaining solutions from students who previously took the course or code that can be found online. You may not share solutions after the due date of the assignment.

Discussing ideas and approaches to problems with others on a general level is fine (in fact, we encourage you to discuss general strategies with each other), but you should never read anyone else's code or let anyone else read your code. All code you submit must be your own with the following permissible exceptions: code distributed in class, code found in the course text book, and code worked on with an assigned partner. In these cases, you should always include detailed comments that indicates on which parts of the assignment you received help, and what your sources were.

Failure to abide by these rules constitutes academic dishonesty and will lead to a hearing of the College Judiciary Committee. According to the Faculty Handbook: "Because plagiarism is considered to be so serious a transgression, it is the opinion of the faculty that for the first offense, failure in the course and, as appropriate, suspension for a semester or deprivation of the degree in that year is suitable; for a second offense, the penalty should normally be expulsion."

Please contact me if you have any questions about what is permissible in this course.

Academic Accommodations

If you believe that you need accommodations for a disability, please contact Leslie Hempling in the Office of Student Disability Services (Parrish 113) or email lhempli1 to arrange an appointment to discuss your needs. As appropriate, she will issue students with documented disabilities a formal Accommodations Letter. Since accommodations require early planning and are not retroactive, please contact her as soon as possible. For details about the accommodations process, visit the Student Disability Service website.

To receive an accommodation for a course activity, you must have an Accomodation Authorization letter from Leslie Hempling and you need to meet with me to work out the details of your accommodation at least one week prior to the activity.

You are also welcome to contact me privately to discuss your academic needs. However, all disability-related accommodations must be arranged through Leslie Hempling in the Office Of Student Disability Services.

Links that are related to the course may be posted here. If you have suggestions for links, let me know.