Announcements

Class announcements will be posted here and/or sent as email. You are expected to check your email frequently for class announcements. Questions and answers about labs, and copies of lecture slides will be posted on Piazza. All assignments are posted to the class Schedule.

Class Info

  • Lecture: Tuesday/Thursday, 11:45-1:00, class meets on Zoom (meeting link posted in piazza)

  • Labs:

    Section A

    Wednesday 2:00pm (Danner)

    Section B

    Wednesday 2:00pm (Sinclair)

    Section C

    Wednesday 3:45pm (Newhall)

    Section D

    Wednesday 3:45pm (Sinclair)

    Section E

    Thursday 8:00am (Sinclair)

    Section F

    Thursday 9:45am (Sinclair)

    Lab starts on Zoom, and moves to CS31 Slack individual help (use your #lab_X channel for your lab section):

  • Ninjas: Asha, Elvis, Nana, Rebecca, Sojin, Tillie, Youssef, Sally, William, See CS31 Ninja Sessions.

    Ninja Sessions are on Slack: CS31 Slack use the #ninja_session channel

  • Office Hours: Office hours are on Slack: CS31 Slack use the #office_hours channel

    • Mondays 9:30am - 10:30am (Danner)

    • Mondays 10:30am-11:30am (Sinclair)

    • Tuesdays 3:30pm - 4:30pm (Newhall)

    • Thursdays 8:00pm - 9:00pm (Danner)

    • Thursdays 9:00pm - 10:00pm (Newhall)

    • Fridays 1:00pm-2:00pm (Sinclair)

  • Text Book: Dive into Systems

  • Piazza: Q&A Forum

  • GitHub: Swarthmore GitHub Enterprise

Course Overview, Goals, and Structure

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:

  • To understand how a sequential or parallel program goes from being expressed in a high-level programming language to being run on the underlying system.

  • To understand and analyze the systems costs associated with application performance.

  • To understand the role of the operating system and some of the abstractions it implements to support efficiently running programs.

  • To understand shared memory parallel computing and to be able to "think in parallel" algorithmically.

  • To become proficient in using gdb and valgrind to debug and examine program execution state.

  • To design and implement solutions to large problems using the C programming language.

  • To design and implement parallel solutions to programming problems that require synchronization using pthreads.

Class Structure

  • Readings: Shorter readings serve as a first exposure to new topics, where students learn the basics of the material. These should be read prior to the class meeting for which they are assigned. The reading quizes are primarly based on these readings. Full required weekly readings complement lecture content. See tips for reading textooks for how to read these.

  • Class meetings: The classroom material will cover the course concepts in depth, and include activites to practice applying concepts learned, and to facilitate student discussion.

  • Exams: There is a midterm exam and a final exam (both closed-book) covering the material in the class meetings (and to a lesser extent on some labs). Some reference materials will be provided with the exams.

  • Labs: There are several lab programming assignments (mostly in C) that will explore various aspects of computer systems.

  • Reading Quizes: Most class meetings there will be a short quiz primarily based on the shorter assigned readings.

  • Written Homeworks: There are several written homework assignments. Written homeworks are on based on class material and provide good practice for exams.

Schedule

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. Read tips for reading CS textbooks to help you determine what to focus on and how to get the most out of required readings.

WEEK DAY ANNOUNCEMENTS TOPIC & READING LABS/HOMEWORKS
1

Feb 08

 

Topics

  • Introduction to Systems
  • Program Execution
  • Intro to C Programming

Required Reading

Lab 0 Assn: unix, vim, github, piazza

Weekly Lab Exercise: Unix and C basics, git

Lab 1 Assn: intro to C

2

Feb 15

 

Topics

  • C Programming
  • Binary Represenation

Required Reading

Read: About HW and Study Grps

Written HW: HW 1: C

Weekly Lab: C arrays, gdb, readfile

Lab 2 Assn: C arrays

3

Feb 22

 

Topics

  • Binary Representation
  • Von Neumann Architecture
  • Computer Architecture, gates, circuits

Required Reading

Written HW: HW 2: binary

Weekly Lab: Logisim Setup

Lab 3: Logisim

4

Mar 01

 

Topics

  • Computer Architecture, CPU
  • Program Exectuion
  • Program Memory, C pointers intro

Required Reading

Written HW: HW 3: arch

Weekly Lab: Logisim ALU flags

Lab 3 cont: Logisim

Exam 1: logistics and rules

5

Mar 08

Exam 1 (Mar 11)

Topics

  • C pointers
  • Machine Level Programming
  • Assembly Programming (IA32)

Required Reading

Exam 1: logistics and rules

Written HW: HW 4: pointers

Weekly Lab: gdb & valgrind

Lab 4: C pointers

6

Mar 15

 

Topics

  • Assembly Programming
  • Assembly Functions, Stack

Required Reading

Written HW: HW 5: assembly

Weekly Lab: IA32 programming

Lab 4 cont: Cpointers, IA32 assembly

7

Mar 22

Spring Break (Mar 24)

Topics

  • Assembly Functions, Stack
  • 2D Arrays, Array Memory Layout
  • structs

Required Reading

Written HW: HW 6: more assembly

8

Mar 29

 

Topics

  • C structs
  • Memory Heirarchy
  • Storage and Locality
  • Caching

Required Reading

Written HW: HW 7: DM caching

Weekly Lab: 2D arrays

Lab 5: gol

9

Apr 05

 

Topics

  • Caching
  • intro to OS

Required Reading

Written HW: HW 8: Set Associative Caching


Weekly Lab: man, globals, valgrind


Lab 5 cont: gol

Exam 2: logistics, rules, tips

10

Apr 12

Exam 2 (Apr 15)

Drop deadline (Apr 16)

Topics

  • recap: C strings and string library
  • OS: Processes

Required Reading

Exam 2: logistics, rules, tips

Some handy references for during the exam

Written HW: HW 9: processes

Weekly Lab: signals, circular arrays

Lab 6 part 1: shell

Lab 6 part 2: parsecmd

11

Apr 19

 

Topics

  • OS: VM

Required Reading

Written HW: HW 10: VM

Weekly Lab: C libraries, strings, 2D arrays

Lab 6 part 2: parsecmd

12

Apr 26

 

Topics

  • Parallel Comptuting
  • Threads

Required Reading

Weekly Lab: pthreads

Inclass Exercise: pthread max

Lab 7: Parallel GOL

13

May 03

 

Topics

  • pthreads

Required Reading

Weekly Lab: pthreads

Inclass Exercise: producer consumer

Lab 7: Parallel GOL

Final Exam: logistics, rules, tips

 

May 14

Final

Grading

Grades will be weighted as follows:

35%

Labs

5%

Homeworks

50%

Exams (2 midterms, 1 final)

10%

Class Participation and Reading Quizes

CS31 Labs

Weekly Lab Sessions

The weekly lab meetings, on Wednesdays and Thursdays, are structured with 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. Weekly lab meeting attendance is mandatory and it is expected that you attend the entire lab and that you work on CS31 content during lab.

All lab assignments , with the exception of Lab 1, will be done with a partner. For the first part of the semester you will be assigned a different partner for each lab assignment. Later, we will let you choose your own partner for some of the course lab assignments.

About the CS Labs

You should work on your labs on CS lab machines, using zoom to meet together and with one of you ssh-ing into a machine and sharing your screen as you work together on the lab assignment. You should alternate taking turns "driving" (being the one to ssh in and edit your code) your joint session.

CS lab machines are for CS course work only. There are other computer labs on campus that are for general-purpose computer use. Please review the CS Lab Rules about appropriate use of CS labs.

Accessing the CS labs after hours

This applies only to students who are on campus this semseter and for any lab spaces that we have open for use. Currently they are not physically accessible, but it is possible that later in the semester they will be.

You can use your ID to gain access to the computer labs at nights and on the weekends. Just wave your ID over the onecard 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 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 SCI 238, 240, 256, and the Clothier basement.

CS31 Lab assignments

Lab assignments will typically be posted on Tuesday and will be due the on Monday evening. You are strongly encouraged to start early, attend the ninja session, and ask questions early if you get stuck (piazza, office hours, ninja sessions). For some assignments you will work individually. For others you must work with a partner.

We will use Swarthmore’s GitHub Enterprise for managing each lab assignment. You will submit your 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 may push your assignment multiple times, and a history of previous submissions will be saved. You are encouraged to push your work regularly. You do not need to already know how to use git. We provide instruction on using git for CS31 with the first lab assignment.

Working with Partners

For partnered lab assignments, you should follow these guidelines:

  • The expectation is that you and your partner are working together side by side in the lab for most, if not all, of the time you work on partnered lab assignments. Use zoom, and ssh into lab machine sharing your screen. You can make use of other resources for sharing, like googledocs, to keep notes or sketch out ideas as you work together.

  • You and your partner should work on all aspects of the project together: initial top-down design, incremental testing and debugging, and final testing and code review.

  • If you are pair programming, where one of you types and one of you watches and assists, then you should swap roles periodically, taking turns doing each part.

  • There may be short periods of time where you each go off and implement some small part independently. However, you should frequently come back together, talk through your changes, push and pull each other’s code from the git repository, and test your merged code together.

  • You should not delete or significantly alter code written by your partner when he or she is not present. If there is a problem in the code, then meet together to resolve it.

  • If there is any issue with the partnership, contact the professor.

Taking time to design a plan for your solution together and to doing incremental implementation and testing together may seem like it is a waste of time, but in the long run it will save you a lot of time by making it less likely that you have design or logic errors in your solution, and by having a partner to help track down bugs and to help come up with solutions to problems.

Partnerships where partners work mostly independently rarely work out well and rarely result in complete, correct and robust solutions. Partnerships where partners work side-by-side for all or most of the time tend to work out very well.

You and your partner are both equally responsible for initiating scheduling times when you can meet to work together, and for making time available in your schedule for working together.

CS31 Ninja Sessions

The CS31 Ninjas are student mentors who will assist students in class and lab, and who run evening study sessions each week. 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: Fridays 7-10pm, Sundays 3-5pm and 7-10pm, on slack

  • The CS31 Ninjas: Asha, Elvis, Nana, Rebecca, Sojin, Tillie, Youssef, Sally, William

  • Ninja Coordinator: Lauri Courtenay

Absence / Assignment Extension Policy

To help with cases of minor illnesses, athletic conflicts, or other short-term time limitations, we will drop your 4 lowest reading quizzes and participation grades. You are still responsible for the material, and you should review any missed materials via the class recordings as soon as you can.

All students start the course with 5 "late assignment" days to be used on lab assignments at your discretion, with no questions asked. No more than 2 late days can be used on a single lab assignment.

To use your extra time, you must email your professor after you have completed the lab and pushed to your repository. You do not need to inform anyone ahead of time. When you use late time, you should still expect to work on the newly-released lab during the following lab section meeting. The professor will always prioritize answering questions related to the current lab assignment.

Your late days will be counted at the granularity of full days and will be tracked on a per-student (NOT per-partnership) basis. That is, if you turn in an assignment five minutes after the deadline, it counts as using one day. For partnered labs, using a late day counts towards the late days for each partner. In the rare cases in which only one partner has unused late days, that partner’s late days may be used, barring a consistent pattern of abuse.

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 other emergency, you must contact the dean’s office and your instructors. Faculty will coordinate with the deans to determine and provide the appropriate accommodations. Note that for illnesses, the College’s medical excuse policy, states that you must be seen and diagnosed by the Worth Health Center if you would like them to contact your class dean with corroborating medical information.

Late days cannot be used for any written or in-class assignments that are not associated with a lab assignment.

Academic Accommodations

If you believe you need accommodations for a disability or a chronic medical condition, please contact Student Disability Services via email at studentdisabilityservices@swarthmore.edu to arrange an appointment to discuss your needs. As appropriate, the office will issue students with documented disabilities or medical conditions a formal Accommodations Letter. Since accommodations require early planning and are not retroactive, please contact Student Disability Services as soon as possible.

For details about the accommodations process, visit the Student Disability website.

You are also welcome to contact Professor Andrew Danner or Professor Tia Newhall privately to discuss your academic needs. However, all disability-related accommodations must be arranged, in advance, through Student Disability Services. To receive an accommodation for a course activity you must have an official Accommodations Letter* and you need to meet with Professor Andrew Danner or Professor Tia Newhall to work out the details of your accommodation at least two weeks prior to any activity requiring accommodations.

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 or make them publicly available anywhere (e.g. public GitHub repository).

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."

The spirit of this policy applies to all course work, including code, homework solutions (e.g., proofs, analysis, written reports), and exams. Please contact me if you have any questions about what is permissible in this course.

Exam Integrity

TBD

How to Succeed in CS31

  • Attend class and actively participate in class. The primary introduction to course material is through class lecture. Additionally, we often do exercises during class. Showing up is necessary, but not sufficient to success in the course: ask questions, participate in class discussions and in class activities, and take notes.

  • Read the material before you come to class. Don’t worry about total comprehension, but at least get a feel for what we will be covering that week. If you have some understanding of the material coming into class, it will be easier for you to follow the lecture and to ask questions during class. See my tips for reading CS textbooks for guidelines on getting the most out of assigned readings.

  • Start the lab assignments early. I realize this one is not always easy to do, but if you can get in the habit of doing this, you will be much better off. As the labs get longer and more difficult, starting early will give you plenty of time to mull over the lab problems even when you aren’t actively writing your solution.

  • Practice, practice, practice. The only effective way to learn the material and pass the exams is to consistently do the labs and written assignments, and to practice example problems presented in class and in the book. Forming study groups to go over practice problems and to review lecture and reading notes is a great way to prepare for exams.

  • Seek help early and often. Because course material builds on previous material, it is essential to your success in this class that you keep up with the course material. There are a lot of sources of help: ask questions during lecture; ask your classmates (make sure you have read the "Academic Integrity" section below first); get help during lab sessions; come to office hours; use the class piazza page for lab Q and A, and attend ninja study sessions.

  • Attend Study Sessions. The student Ninjas hold evening sessions each week. You are encouraged to participate in these sessions. The Ninjas will provide friendly assistance on your lab assignments and can also help answer questions about in-class exercises.

  • Take hand written lecture notes. In lecture the professor often draws diagrams on the board, some of which you will need to reproduce. Taking notes with paper and pen (vs. on the computer) will allow you to copy these diagrams.

Handy Resources