# CSCI 3410 - Systems Programming

Posted on January 8, 2022 by Gabriel Parmer

## Instructional Team Contact info

• Professor: Gabriel Parmer

• Teaching Assistants:

• Sreya Nalla
• Graham Schock
• Bite Ye
• Learning Assistants:

• Lauren Hahn
• Jonathan Lee

## Fall 2021 Class Time/Location:

• Class: Tuesdays/Thursdays @ 11:10-12:25 ET in SEH 1st floor (1300, 1400, 1450). If we have to move class online, we’ll use zoom.

• Labs: Monday @ 10:00-11:15 If we have to move class online, we’ll use zoom for labs.

• Office hours, SEH, 4th floor common area:

• Tuesday: 12:30-3:30 (Lauren Hahn)
• Wednesday: 3:30-5:30 (Jonathan Lee)
• Thursday: 10:30-11, 12:30-2 (Gabe), 2:30-4:30 (Sreya Nalla)
• Friday: 9:45-11:45 (Graham Schock)

Make sure you’re properly preparing and presenting yourself at Office Hours.

1. Sign up for the class’ Piazza – link in an email you should have received on 1/9/22. On Piazza, you’ll find links to the rest of the TODO items.
2. Complete the “getting to know you” survey now. We cannot grade your work without this information.
3. Find the Discord invite to our server, and join.
4. Find a link to the first homework (HW0) via github classroom.

## Course Overview

### Learning Outcomes

Objectives - In completing this class, students will…

• Design and implement C programs and use the associated development tools.
• Understand the basic means of constructing applications from libraries and communication with services.
• Demonstrate an understanding of composition as a fundamental design concept for advanced functionalities.
• Understand representations of programs and processes.
• Apply UNIX abstractions for processes, process control, IPC, and file systems.

Fundamentally, students will understand that processes are manipulable data, that processes control and manage other processes, and that applications are composed out of libraries and processes.

Structure - This class is broken into two main activities: lectures and lab.

• Lectures will discuss the main concepts in systems with many references to implementation details. A series of homeworks (all in C) will test student’s ability to apply the courses concepts in a set of projects. Quizzes throughout the class, and the final exam test student’s understanding of the lecture’s concepts.
• Labs will help you jump into the details, learn details about homeworks, and practice key mechanisms.

### Direct Instruction and Independent Learning

Each semester, you’re expected to spend at least:

• 70 hours in class, and in lab for direct instruction, and
• 150 hours out of class watching lectures, and working on your class assignments.

### Covid Policy and Actions

This class will run in accordance to GWU’s policies around Covid. Please attend to your regular tests, the mask requirements, and actions should you be exposed or symptomatic. Please notify Gabe immediately if you are concerned about your well-being.

### Course Prerequisites and Student Responsibilities

Prerequisites:

• Computer Architecture I, Software Engineering
• Assignments for this class will be done in C, and we assume basic C expertise. If you are not comfortable with C, at least go through Essential C and the exercises in the Course Material Section.

Responsibilities - Students must

• Conduct your online behavior in accordance with the class’ Online Social Contract.
• Attend all classes and labs unless you are sick or there is an emergency in which cases you must contact the professor via email before class.
• Interact, ask questions, and generally participate in class discussions.
• Do group exercises assigned in lectures and labs.
• Be respectful when working in a group, and make sure that everyone’s ideas are heard and taken seriously.
• Complete all work in accordance with the academic honesty rules for the university and for the class.
• Work to digest and process all provided material including Piazza and Discord discussions (you cannot ignore Piazza).
• Contact the Professor if you are worried about completing any responsibilities. We’ll work with you to come up with a plan to be successful in the class.

I also need your feedback for parts of the class that aren’t working for you. We do our best in running the class, but certainly make mistakes, or overlook different aspects. Class evaluations are of limited use since they only are given at the end of the class. Please provide feedback using the linked feedback form on Piazza.

### Professor and Instructional Staff Responsibilities

You should depend on the instructional staff (including Gabe) for the class to

• be clear about student’s responsibilities in the class,
• convey the course’s materials on this webpage, on Piazza, in class, and in lab in a manner that is approachable and understandable to every single student,
• provide an environment in which everyone feels open to ask questions, and seek to remedy any misunderstandings or confusions, and
• provide additional material on demand if anyone is curious about knowledge beyond the scope of the class.

These can be remembered as “we’re here to make it clear what you should do, what you should know, and what to do if you don’t feel like you know what you’re supposed to do or know”. If at any point, you have concerns about any of these, of if we’re dropping the ball on any of them, please let us know and we’ll do better. There are trade-offs made in the class (for example, homeworks are not formally specified as I don’t want them to be 50 pages each), but you always encouraged to ask questions and clarify.

Further, it is our intent that students from all diverse backgrounds and perspectives be well-served by this course, that students’ learning needs be addressed both in and out of class, and that the diversity that the students bring to this class be viewed as a resource, strength and benefit. It is my intent to present materials and activities that are respectful of: gender identity, sexuality, disability, age, socioeconomic status, ethnicity, race, nationality, religion, and culture. Your suggestions are encouraged and appreciated. Please let me know ways to improve the effectiveness of the course for you personally, or for other students or student groups.

Above all, it is important that this class provides an environment for learning and self improvement. Gabe takes this very seriously, so if it is not adequately serving that purpose, don’t hesitate to let him know why.

Provide feedback. Many aspects of the class are new and experimental, thus they might require modifications throughout the course of the class. Because of this, all students must take the contents of the section below on “Professor and Instructional Staff Responsibilities” seriously: if something isn’t working for you, assume that the class needs a tweak, and contact the professor, or provide anonymous feedback. Gabe will take this feedback seriously.

Community and online social contract. As an increased part of the class is online, it is necessary that everyone conduct themselves respectfully and productively online. Please see the class’ Online Social Contract. The class will have a zero-tolerance approach toward disrespectful conduct, or harassment.

Take responsibility for your own education. Much of the work for this class will be more group-oriented than in normal instances of the class. If you burden your partner with most of the work, you are setting yourself up for failure. If you take on your partner’s responsibilities, you are setting them up for failure. The homeworks build on each other. The benefit of this is that by the end of the class you’ll laugh at how easy some of the earlier homeworks are as you’ve massively leveled up. The challenge is that if you don’t put in a genuine effort on each homework, you will find later homeworks increasingly intractable. If you don’t put effort in for each homework, you’ll create dis-proportionally more work for yourself in later homeworks. If you cannot carry your own weight, you will not be able to achieve the learning objectives for the class.

Also remember that your team members will change throughout the semester, and they happen to be the network you’ll use to help get a job. Not impressing them hurts your future opportunities.

### Class Technologies

How you comport yourself online in the class just adhere to our online social contract. For the class we’ll use the following technologies for the specified purposes:

• Github - Assignments are retrieved from github classroom using a link provided on Piazza. They are submitted via pushes to github. Class information and lectures are provided in the class’ org. See the details on submission and on how to use github below.

• Discord - Find the link to the class’ Discord server on Piazza. Office hours, informal discussion, and other online help will use various rooms associated with the OS Discord. The discussion on Discord is, by default, synchronous and transient. Synchronous means that you might get an immediate response (if anyone is online), and can have a discussion. Transient means that the conversation will be lost to the brutality of the scroll-bar. This means that no-one in the class (including the instructional staff) are expected to see Discord discussion, in general.

Note: we cannot guarantee super-fast responses. In general, we will guarantee that we will reply in a batch, once per day. Additionally, we reserve the right to not answer homework questions the day before it is due – procrastination is not encouraged.

• Piazza - This includes class discussions and questions that are longer-form than Discord. Class notifications (homeworks, etc…) will be posted here.

Please see the discussion about Academic Integrity below. A rule of thumb is that you should not post code on any discussion medium with reach beyond your group. We do not use blackboard.

### Absences

If you need to be absent, please send me an email to let me know that you can’t make it, and please let me know why. If you know you’re going to be absent (e.g. religious holiday), try and let me know in advance, otherwise, let me know as soon as you can. If you’re sick, keep me updated on how you’re feeling if you can.

## Course Schedule

Homeworks for the class are generally due every week. Each homework is broken into a number of milestones. In the following, HW = homework; M or MS = milestone.

Date Week Topic Homework Due
C Programming
1/10 1 C Review HW0, HW1
1/17 2 (No Lab) C Memory Model HW2 HW0.M0
POSIX Abstractions
1/24 3 Processes HW1.M0
1/31 4 Descriptors, Pipes, and Signals HW3 HW2.M0
2/7 5 I/O: Filesystem I/O HW2.M1
2/14 6 I/O: IPC and Event Multiplexing
2/21 7 (No Lab) Exercises and Event Notification HW3.M0
Software and System Structure
2/28 8 Libraries - Static and Dynamic HW3.M1
3/7 9 Programming libraries and System Calls HW4 (week of 3/14) HW3.M2
3/21 10 Malloc and Memory Management HW3.M3
Security
3/28 11 Memory/Injection Vulnerabilities
4/4 12 System APIs and FS HW5
Modern UNIX
4/11 13 Android
4/18 14 Containers: Namespaces, APIs, and FS HW4.M0, HW4.M1 (Extra credit)
4/25 15 (Two Mondays ☹ ) HW5.M0

The schedule for homeworks follows:

Week Day Homework Activity
$$X$$ Thursday Homework Assigned
$$X+Y+1$$ Thursday @ 11:59pm Milestone $$Y$$ extra-credit deadline ($$+10\%$$)
$$X+Y+2$$ Monday @ 11:59pm Milestone $$Y$$ deadline

The “Deadline”s in the weekly schedule above are for the final deadline, not the extra-credit deadline. Each homework will have at least one milestone. A milestone is a concrete set of objectives that progress toward completing the overall homework. Each milestone has a set of requirements/tests that must be satisfied for credits.

Generally, homeworks are assigned (in the “Homework” column) on week $$X$$’s Thursday, and milestone $$Y$$ is due on week $$X+Y+2$$’s Monday at 11:59pm (in the “Deadline” column). Submissions of a milestone by Thursday at 11:59pm on week $$X+Y+1$$ will result in $$+10\%$$ extra-credit. Milestones will be graded separately, but often a milestone $$Y$$ can only be satisfied if you finish $$Y-1$$.

## Homeworks

HW MS Description
HW0 M0 questionnaire, honesty, convetions, github
HW1 M0 key-value store w/ libc functions
HW2 M0 prefix trie w/ lexographic autocompletion
M1 prefix trie w/ history-based autocompletion
HW3 M0 shell: string processing of commands
M1 shell command execution and job control
M2 shell job control
M3 shell I/O redirection - FS & pipes
HW4 M0 IPC (w/ poll), routing, and server program activation
M1 Server reboot - Extra Credit
HW5 M0 Simple Valgrind

## Course Material

Required reading. You must read through the material at the repo for class resources. This includes some intuition as to how to develop C, how to think about debugging and testing, and how to think about generating good code.

Lecture material. Lectures for the class are code-heavy. You might find the source for the lectures (or a pdf of the material) useful.

Textbooks. The required text book is Computer Systems: A Programmer’s Perspective, by Randal E. Bryant and David R. O’Hallaron. Though other editions should be OK, we’ll reference chapters in the 3rd edition.

Optional, but strongly encouraged resources:

• If you’re having trouble understanding what a specific declaration is in C, use the cdecl command, or, if it isn’t installed, you can use the cdecl webpage.
• For those of you who know C, but want to learn how to write better C, one source is the Composite Style Guide.

## Assignment Submission

All of your homeworks for this class will be submitted via github. The last commit must be done with the final_commit.sh script that should be available in your homework repo in the util directory. This must be executed from the class server. You must then push to your github classroom repo in the main branch. Please do not make pushes to your repo after the version you want graded.

There are a huge number of errors that one can make, so I highly suggest that you do the following procedure. The final_commit.sh script reminds you of many of these, but, when you submit an assignment, I suggest that you follow this procedure:

1. git status to make sure that you have git added all of the intended files.
2. git diff and git diff --stat to make sure that you’re committing what you think you are. Of note, check to see if you’re committing any printfs that are intended for debugging, not for program output.
3. git commit and git push to upload your code to github.
4. Go to the associated webpage for the repository, and make sure that the most recent commit is present in your repository.
5. Use git clone ... to get a fresh version of the repository, build it, and run your tests. Students who omit this step get bad grades for very avoidable reasons. Always make sure that your submission matches what you think you’re submitting.

Category Percentage
Homeworks 70%
Tests/Quizzes 20%
Participation 10%
• Homeworks will be graded as separate Milestones, and homeworks will consistent of a number of modules.
• Tests/Quizzes include both (mostly) weekly quizzes, and a final.
• Participation includes attendance and interactivity and involvement during class and lab. If you cannot make it to any aspect of the class, or cannot meet any deadline, please let Gabe know as soon as possible.

The milestone for which you receive the lowest grade will be counted as extra credit. This is to allow for sickness and other events beyond your control.

The following modifiers apply to your grade on all homework milestones. These all assume that a homework is out of 100 points.

• +10% credit: Submission by the Thursday before deadline (i.e. 4 days early).
• -50 points: not removing debugging/logging/informational prints from your code (in industry, you cannot commit code with printouts).
• -50 points: not following the naming requirements, or not structuring code into specific files as required in the specification. If you rename functions, and that causes your code to not compile with our test code, see the next bullet.
• 0 points (i.e., no credit): code does not compile as submitted. You must ensure it compiles with no warnings with -Wall -Wextra -Werror. Forgetting to git add files is not an excuse; see the pre-submission procedure above. “A small change makes it compile” means “it does not compile as submitted”. You should always do a fresh git clone of your submitted repo, to make sure that it compiles and your tests work. If you don’t test on the class’ server, your code will likely fail compilation.

Your grade can be minimum 0%, but your maximum grade can be higher than 100% (with the extra credit). There is one exception:

• 0% on milestone, and -200 points: If you cheat on a homework. You cannot get credit for work done by cheating, so you will get a zero on the assignment. In addition, you get this penalty which effectively puts you 200 points down in credit. Instead of cheating, please come and talk to me if you’re feeling desperate. Talk to me before you do anything rash that sets you up for failure. You cannot resubmit work that you cheated on (see “Late Policy” below).

### Late Policy

The late policy for this class is strict. This is for two reasons:

1. We aim to be fair. Once we get into the business of making exceptions, we lose the ability to be fair, and can (sometimes rightfully) get accused of bias. Uniform policies, applied to everyone is our means of ensuring fairness.
2. Falling behind in this class is a slippery slope. As deadlines fall every week in the class, missing a deadline means that you have more work in the following week, which makes it less likely that you’ll be able to do it all. To succeed in the class, the number one optimization is to not fall behind. Please talk to Gabe if you’re concerned.

As such, the only acceptable excuses for late submissions are medical and family issues. I will strongly encourage you to use your module that will be counted as extra-credit if you miss a deadline so that you don’t fall behind on the coming deadlines. Generally unacceptable excuses include:

• your computer failing (we’re using github for a reason),
• lots of midterms,
• forgetting to git add necessary files, or forgetting to git push (proper git usage is a requirement for the class), and
• you worked very hard and put a lot of time and effort in, but still aren’t quite there yet.

You get 0 credit for late work that is unexcused. However, once the grades are released, you can resubmit your code within seven days, rounded up to the closest midnight. For example, if the grades are released at 2:30pm on the 8th, resubmissions are due at midnight on the 15th (i.e. $$8 + 7 = 15$$). You will get 0 credit for submissions after this date.

We will grade the last commit before the resubmission deadline, and you will receive 50% of the credit on top of the original grade, rounded up to the nearest percent. For example, if you got a 43% on the initial deadline, and resubmit and get a 68%, your final grade ($$g$$) will be $$g = \lceil 43 + \frac{(68 - 43)}{2} \rceil = 56$$.

Do not come to rely on the resubmission process. Homeworks are due every week or every other week, so it is very harmful to get behind on them, or to add more work to your schedule. Thus, our late policy is quite strict to discourage procrastination.

You are required to test your own code. Our tests will attempt to test every edge case in the implementation. If you do not write code to test the edge-cases of the specifications, then you will lose credit. This is the largest reason why students get lower grades than they believe they deserve. If you believe that an error was made in grading, then please explicitly address why you believe your test cases are sufficient to test all cases. See the discussion about testing and debugging below.

Style and Code Craftsmanship:

You must adhere to the class’ style spelled out in the lecture notes. It is very important that you not only get your code working, but view your work as *fine code craftspersonship. If you want to understand a more complete set of style guidelines, see the Composite Style Guide.

Just as you can do a google search for code online, it is trivial for us to do the same. We have caught numerous people cheating in the past in this way. If you feel pressured about an assignment, please come see me instead of cheating.

You are not allowed to collaborate on the homeworks and the lab assignments. The group projects require collaboration within each group, but no collaboration between teams is permitted. Please refer to the academic integrity policy linked from the course web page. This policy will be strictly enforced. If you’re having significant trouble with an assignment, please contact me. If you have not signed the academic integrity statement for homework 0, you will not receive a passing grade for the class.

Summary:

• If you see the code of another student (who is not in your group), you are cheating.
• If you share your code with any other student (not in your group), you are cheating. This applies even when you are no longer taking the class.

In the past, the only way that people have failed this class is to either not try (not do homeworks), or to cheat. There is almost no reason to cheat. Come to me, and we can discuss where you’re at, and what you have to do to make it through this difficult class!

Justification: Cheating hurts your ability to compete for CS jobs. Everyone came to college to learn. You learn by doing work to reinforce class ideas. Understanding ideas from class is nowhere near as effective at learning as applying those ideas in an implementation. Thus, you need to do your own implementation to be a competitive CS student in the real-world!

Cheating hurts your peers. Courses that are graded on a curve have the side-effect that if someone inflates their grade not by hard work, but by cheating, your good grade (should the Professor not catch you) will hurt the grade of all of your colleagues that put the work in.

Cheating also hurts the quality of the OS class in the long term, thus hurts all future generations of GW CS undergrads. If you cheat, especially using previous year student’s work, to the point where the Professor believes that they must develop new assignments every year, then those assignments will not be as strong. They will not meet learning objectives in a course like this. All future CS students will be less prepared for competing for the best jobs.