Systems Programming

Instructor: Prof. Sibin Mohan, The George Washington University

CSCI 3410 | Spring 2023 | TR 03:45PM - 05:00PM ET | 1957 E B12

This course will focus on teaching the fundamentals of systems programming, using C.

A Sample Hello World Program in C

On completion of this class, students will,

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 labs:

In addition,

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.


Course Staff

Course Details

[* Note: Please message ahead of time and set up alternate slot in case of conflicts for office hours.] Note: Make sure that you're properly preparing and presenting yourself at office hours!

Communication

We will use Blackboard for all course related communications.

Target Audience

Undergraduate students who wish to learn about the design and development of systems as well as the C programming language.

Covid

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.

If you suspect you have been exposed to someone with Covid, or are feeling sick yourself, please let me know and I will provide a Zoom link for you to attend remotely. And get some rest!

Grading Criteria

In-class participation 10 %
Homework Assignments 70 %
Tests and Quizzes 20 %

Note: ONLY talk about your grade with Sibin. None of the other instructional staff have access to grades or the ability to modify them.

In Class Participation

I encourage you to ask questions and ask often. Participate in discussions as well. Take notes since that helps with the learning.

Course Materials

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.

Textbook and Other Resources

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:

A few additional resources:


Schedule

Week Date Topic Links
1 Jan 17, 2023
Intro, course syllabus, policies.

Basic types in C.
Slides

Lecture Notes
Jan 19, 2023
Compound types (structs, unions).
Pointers.
Lecture Notes
Lecture Notes
2 Jan 23, 2023
Homework 0 assigned.
Due Date: Jan 30, 2023 [11:59 PM PT]
Jan 23, 2023
Homework 1 assigned.
Due Date: Feb 06, 2023 [11:59 PM PT]
Jan 24, 2023
Pointers, function pointers.
Key value stores, class exercise.
Lecture Notes
Lecture Notes
Jan 26, 2023
C Memory model and Allocation.
Lecture Notes
3 Jan 31, 2023
Strings in C.

In-class exercise: stack growth direction.
Slides
Lecture Notes
Feb 02, 2023
API Design:
Return values, errors

In-class exercise: String duplication example.
Slides
Lecture Notes
4 Feb 07, 2023
Quiz!
Feb 07, 2023
Errors, errno, memory ownership

limits.h
Slides
Lecture Notes
Feb 09, 2023
Processes in C.
fork(), wait()
Slides
Lecture Notes
5 Feb 14, 2023
Quiz!
Feb 14, 2023
Processes (contd.)
exit(), atexit(), on_exit()
Command line args
Slides
Lecture Notes
Feb 16, 2023
Variadic Functions in C.

References: 1, 2.
6 Feb 21, 2023
Quiz!
Feb 21, 2023
Variadic Functions in C (contd.)
simple_printf() example.

Code: simple_printf.c
Feb 23, 2023
Variadic Functions in C (contd.)
Completing the simple_printf() example.

Code: simple_printf.c
7 Feb 28, 2023
Quiz!
Feb 28, 2023
HW 3 Review.
8 Mar 02, 2023
Quiz!
Mar 02, 2023
Executing Other Processes
exec(), execve()
Slides
Lecture Notes
Code: my_exec.c,
exec_sub1.c,
exec_sub2.c.

Policies

Expectations and Responsibilites

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

Student Responsibilites: Students must,

We will work with you to come up with a plan to be successful in the class.

We 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:

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 our 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 us know ways to improve the effectiveness of the course for you personally, or for other students or student groups.

Late Policies

Submission/due dates are announced along with the Homeworks descriptions.

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

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:

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.

Please note that in terms of academic honesty, you cannot share your code with your peers even after it is due.

Testing your implementation

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.

Collaboration and the Honor Code

You are encouraged to work together. You may discuss the MPs with other people to understand the problem and reach a solution. However, each student/group must write down the solution independently, without referring to written notes from others. Hence, you must understand the solution well enough to discuss it yourself. In addition, each student/group must explicitly mention the names of the people with whom they collaborated. If I suspect cheating, I might have the student(s) come and answer questions in my office. If my suspicions are confirmed, I will refer the student to the disciplinary committee.

The purpose of problem sets in this class is to help you think about the material, not just give us the right answers. You are encouraged to use online resources for learning more about the material covered in class; however, you should not look for or use found solutions to questions in the problem sets. Specifically, you must not look at any code that has been created to solve the assignment, including solutions found on the internet to questions in the problem sets, code created by a student in a previous class or code created by a current classmate. (Though frankly, I seriously doubt you'll find anything, I regularly change the assignments).

Academic Integrity

Academic Integrity is an integral part of the educational process, and GW takes these matters very seriously. Violations of academic integrity occur when students fail to cite research sources properly, engage in unauthorized collaboration, falsify data, and in other ways outlined in the Code of Academic Integrity. Students accused of academic integrity violations should contact the Office of Academic Integrity to learn more about their rights and options in the process. Outcomes can range from failure of assignment to expulsion from the University, including a transcript notation. The Office of Academic Integrity maintains a permanent record of the violation.

Familiarize yourself with the standards set forth in the GWU Code of Student Conduct and specifically the University’s “Guide of Academic Integrity in Online Learning Environments". If there is any question about whether an act constitutes academic misconduct, it is your responsibility to seek clarification and approval from the instructor prior to acting. When in doubt, ask, or don't do it.

Contact information:

Absence Policy

If you miss a class, for whatever reason, you are still responsible for that class' material. Go through the lectures, consult the scribe notes, come to office hours (in that order), and talk to your fellow students, to learn the material.

Grade Review Policy

You have one week after a grade is released to ask me questions about it and seek a correction. After the week has passed, the grade is finalized.

In case you are seeking a correction to the grade, you need a specific reason: e.g., your implementation on HW1 was essentially correct but some errors in our test cases resulted in a lower grade. I cannot accommodate general requests that are a variation on "I think my grade was too low". Why do you think that? Based on our discussion, I might increase the grade, decrease it, or leave it as is.

Of course, you can stop by anytime during the term to ask questions about any part of the material. The one-week deadline applies to grade-specific questions.

Use of Electronic Course Materials and Class Recordings

Students are encouraged to use electronic course materials, including recorded class sessions, for private personal use in connection with their academic program of study. Electronic course materials and recorded class sessions must not be shared and must not be used for non-course related purposes unless express permission has been granted by the instructor. Students who impermissibly share any electronic course materials are subject to discipline under the Student Code of Conduct. Please contact the instructor if you have questions regarding what constitutes permissible or impermissible use of electronic course materials and/or recorded class sessions. Please contact Disability Support Services if you have questions or need assistance in accessing electronic course materials.

Academic support

Writing Center

GW’s Writing Center cultivates confident writers in the University community by facilitating collaborative, critical, and inclusive conversations at all stages of the writing process. Working alongside peer mentors, writers develop strategies to write independently in academic and public settings.  Appointments can be booked online at: gwu.mywconline.

Academic Commons

Academic Commons provides tutoring and other academic support resources to students in many courses. Students can schedule virtual one-on-one appointments or attend virtual drop-in sessions. Students may schedule an appointment, review the tutoring schedule, access other academic support resources, or obtain assistance at academiccommons.gwu.ed.

COVID-Related Topics

The university's COVID-19 Safety and Success website serves as the primary communication channel for the GWU regarding COVID-19 logistics and classroom guidelines.

Face Coverings

The university has a requirement to use a face covering when in indoor spaces in order to contribute to the health and safety of the GWU community during the ongoing COVID-19 pandemic. Accordingly, you are expected to use a face covering when attending class, including when you speak. I will do the same.

Acceptable face coverings include:

If you don't have your own, face coverings are available at various campus locations.

Requests for exemption from wearing a face covering in indoor spaces require prior approval. Please follow this link for more information.

Students with Disabiities [202-994-8250]

Accommodations for students with disabilities are determined and approved by Disability Support Services(DSS). If you, as a student, feel that you need accommodations but have not obtained approval please contact DSS immediately at 202-994-8250 or at https://disabilitysupport.gwu.edu. DSS notifies students and faculty members of approved academic accommodations and coordinates implementation of those accommodations. While not required, students and faculty members are encouraged to discuss details of the implementation of individual accommodations.

Ethical and Respectful Behavior

We expect all students to act in an respectful and ethical way, both with respect to the treatment of their peers in the classroom during discussion but also in the design and execution of their course projects. Actions should meet the expectations of ethical research and follow the norms and proper behavior of the George Washington University community. We strive for an inclusive classroom, which includes but is not limited to anti-racism, anti-sexism, accessibility, LGBTQ+ inclusivity. If you feel like you are unable to use inclusive language and behave in a non-discriminatory way, please drop the class.

University policy on observance of religious holidays

In accordance with University policy, students should notify faculty during the first week of the semester of their intention to be absent from class on their day(s) of religious observance. For details and policy, see “Religious Holidays”.

Reach Out for Success/Wellness

University students encounter setbacks from time to time. If you encounter difficulties and need assistance, it's important to reach out. Consider discussing the situation with an instructor or academic advisor. Learn about resources that assist with wellness and academic success at Health and Wellness Center. If you or someone you know are in immediate crisis, please contact one of the following resources immediately:

Safety and Security