Introduction to Computer Systems

CS31: Fall 2015

Schedule | Overview/Goals | Grading | Lab Policies | CS31 Ninjas |
Integrity | Accommodations | Tips for Success | Resources/Links |


Class Information

Professor: Tia Newhall
Office: Science Center 249
Phone: (610) 690-5637
Office hours: Wed 9-12 and by appointment

Class: 1:15 TR, Sci Cntr 183
Lab A (Newhall): 1:15 Wednesdays, Sci Cntr 256
Lab B (Wiedenbeck): 3:00 Wednesdays, Sci Cntr 256

Required Text:

This semester there is no required textbook. Instead, we are going to try using on-line resources for the required weekly readings.

Recommended (optional) Text: Additionally, each week there will be optional readings from the recommended textbook:
        Computer Systems: A Programmer's Perspective, 2nd Edition
        Bryant and O'Hallaron, Prentice Hall, 2011, ISBN: 0-13-610804-0

Copies of the textbook are on reserve at Cornell Library. You are not required to purchase this textbook, but if you do, make sure to purchace the second edition not the third. I also recommend that you keep the textbook after taking CS31; it will be a useful reference for many upper-level CS courses.

Link to course piazza page

Course Overview:

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.

Goals for the Course:


(This is tentative. It will be updated as we go.)

The required weekly readings are from on-line sources. Supplemental (optional) weekly readings are listed as section numbers from the textbook. The textbook covers much material in more depth than we will in this class. Take a look at tips for reading CS textbooks to help you determine what to focus on and how to get the most out of both the on-line required and supplemental textbook readings.


Sep 01

Using Unix Session:
time TBA Sci 240

Required Reading: Computer Systems, Binary Data Representation, Binary Add, Sub, 2's Complement

Textbook Supplimental (Optional) Reading: 1 (skim), 2.1-2.2

  • Introduction to Computer Systems
  • Data Representation and Program Execution
Lecture notes:


Sep 03


Sep 08

  Required: Intro to C programming for CS31: Part 1
Supplimental: C for Python Programmers
Wed lab

Sep 10

Drop/Add ends (Sep 11)

Lab 2

Sep 15

  Required: gates, circuits, machine architecture (we will learn differnet machine code so don't focus too much on the instrution details)
Supplimental: 1.4, 4.2
Wed lab

Sep 17

  Lab 3

Sep 22

ISA (skim sections 1-3)
IA32 Assembly Programming by Kai Li (read 1-2.3, we are using gnu syntax)
IA32 Cheat Sheet by Julie Zelenski

Supplimental: 7.1-7.3, 3.1-3.5 (skip 3.5.5)

  • Compilers
  • Machine level Programing
  • Assembly Language
  • Data Movement, Arithmetic/Logic
  • Control Flow
  • motherboard fig
Wed lab

Sep 24

  Lab 3 Part 2

Written HW1


Sep 29

  Required: C Programming: Structs and Pointers
Arrays in C (1-dimensional only)
x86 Programming Guide (read Control Flow instructions)
Supplimental: 3.6-3.11, 3.15 (skip 3.6.7, 3.8.4, 3.8.5, 3.9.2) There are lots of additional IA32 references on-line that can be useful, for example: wikibooks X86 GAS Syntax
  • Pointers
  • Dynamic memory allocation
Wed lab

Oct 01

  Lab 04

Oct 06

Call Stack (Intro-Structure)
x86 Programming Guide (read calling convention)
x86 Call Stack Convention
Arrays in C (just memory layout parts)

Supplimental: 3.6-3.11, 3.15 (skip 3.6.7, 3.8.4, 3.8.5, 3.9.2)

  • Assembly Programing
  • The Stack
  • Functions
  • Arrays, Structs, Pointers
Wed lab

Oct 08

  Lab 5

Oct 13

Fall Break

Oct 15


Oct 20

x86 Programming Guide
Arrays in C (just look at the memory layout parts of static 1 and 2 D arrays)
Data Strucuture Alignment (skim)

Supplimental: 1.5-1.7

  • Operating Systems
  • Memory Heirarchy
  • Storage
Wed lab

Oct 22

  Lab 5 (cont.)

Oct 26

Midterm Exam Monday 7:30-9:30pm (SciCtr 101)

Oct 27

Memory Hierarchy
Caching (1-4: through "Hit or Miss", 8: "Cache Tagging", 11: "Cache Misses")
Cache Basics, Cache Misses,
Cache Associativity

Supplimental: 1.5-1.7

  • Memory Heirarchy
  • Storage
  • Caching
Wed lab

Oct 29

  Lab 5 (cont.)

Nov 03

Operating Systems (skim)
Arrays in C (2D arrays)

Supplimental: 1.7, 8.1-8.5

  • Memory Efficiency
  • Operating Systems
Wed lab

Nov 05

Deadline for CR/NC
or withdraw with a "W"
(Nov 07)

Lab 6

Nov 10

Processes (through 4.4)
fork,exec,wait (through 5.3)
Virtual Memory

Supplimental: 9.1-9.3, 9.9

  • Operating Systems
  • Processes
Wed lab

Nov 12

  Lab 7

Nov 17

Virtual Memory
Introduction to Virtual Memory and Paging

Supplimental: 1.7, 1.9, 12

  • Operating Systems
  • Virtual Memory
Wed lab

Nov 19

  Lab 8

Nov 24

Pthread Programming

Supplimental: 1.7, 1.9, 12

  • Parallel Systems and Programming
  • SMP and Multicore
  • Threads
In class Tues

Wed Lab

Lab 9

Written HW 2

Nov 26



Dec 01

Pthread Programming

Supplimental: 1.7, 1.9, 12

  • Parallel Systems and Programming
  • SMP and Multicore
  • Threads
Written HW 2

Dec 03

Pthread Programming

Supplimental: 12

  • Parallel Systems and Programming
  • Synchronization
  • Deadlock, Race conditions
Wed Lab

In class problem

Lab 9


Dec 08


Dec 15

Final Exam Tuesday 2-5pm (SciCtr 101)


Your overall grade in the course will be determined as follows:
30%Labs and Written Assignments
35%Final exam
30%Midterm exam (Monday Oct 26 7:30-9:30pm)
5%Class Participation and Attendance

CS 31 Ninjas

The CS31 Ninjas are student mentors who will assist me in class and lab, and who 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-11pm 240 Sci Center

The CS31 Ninjas:   Amy, Ryerson, Martina, Jack
Ninja Coordinator:   Lauri Courtenay

Weekly Lab Sessions

Weekly lab sessions will be about 1/3 presentation (typically an introduction to the weekly lab assignment and practice learning programming tools for carry out the lab), and about 2/3 for working on the lab assignment. Lab attendance is mandatory and it is expected that you attend the entire lab and that you work on CS31 content during lab.

All labs except lab 1 must be done with a partner. For the first part of the semester you will be assigned a different partner for each lab assignment. Later, I will let you choose your own partner with whom you will work for all remaining assignments.

Policy on Lab and Written Assignments

Lab assignments will typically be posted on Wednesdays and will be due the following Tuesday evening. You are strongly encouraged to start early and ask questions early if you get stuck. For some assignments you must work individually. For others you must work with a partner.

Late lab and written assignments will not normally be accepted. There are a several reasons for this, including: sometimes, an assignment and its solution will be discussed in the lecture immediately after it is due, so it’s infeasible to grade late work fairly. In addition, many assignments build on one another, so it’s best to avoid a policy that lets you slip behind. Special exceptions can be made if you contact me well in advance of the deadline (having a lot of work in other classes does not qualify for a special exception). Even if you do not fully complete an assignment, you should submit what you have done to receive partial credit.

Some labs may take a considerable amount of time, so you are strongly encouraged to begin working on assignments well before the due date.

We will be using Swarthmore's GitHub Enterprise for managing each lab assignment. You will submit lab solutions electronically using git. You must do a git add, commit, and push before the due date to submit your solution on time. You can run git commands multiple times, replacing your previous solutions with newer ones.

About the CS Labs

I encourage you to work in one of the CS labs when possible (vs. remotely logging in), particularly when working with a partner. The CS labs (rooms 240, 256 and 238) are open 24 hours a day, 7 days a week for you to use for CS course work. With the exception of during times when a class, or a class lab or ninja session is scheduled in 240 or 256, you work in one of the CS labs on your CS course work anytime. The overflow lab (238) is always available. The CS lab resources are for CS course work. Please review the CS Lab Rules and CS User Rules about appropriate use of CS labs.

Accessing the CS labs after hours: 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. It should display a green light and beep when unlocked, 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 id number into the system. email if you have problems with this. If the building is locked, you can use your ID to enter the door between Martin and Cornell library.

Tips for Success

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.

Accommodations Statement

If you believe that you need accommodations for a disability, please contact Leslie Hempling in the Office of Student Disability Services (Parrish 130) or (e-mail lhempli1 AT swarthmore DOT edu) to set up an appointment to discuss your needs. Leslie Hempling is responsible for reviewing and approving disability-related accommodation requests. As appropriate, she will issue students with documented disabilities an Accommodation Authorization Letter. Since accommodations require early planning and are not retroactive, please contact her as soon as possible. For details about the Student Disabilities Service and the accommodations process, visit the Disability Services website. 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.

Below are some resources and links that may be helpful to you.