CptS 360: Systems Programming

WSU Tri-Cities
Spring, 2022

Document Update History

Date Update
4/4 rescheduled and annotated guest presentation on cybersecurity
3/22 added guest talk on 4/21
3/7 extended due date for PA3
1/27 rescheduled labs to allow for Crimson Code Hackathon; corrected lecture start/end times
1/13 renamed Unit 3; moved a lecture from Unit 4 to Unit 3
1/10 first draft

Instructor

Bob Lewis
Associate Professor of Computer Science
School of Engineering and Applied Sciences

Email: bobl@wsu.edu
(For fastest response, please include "cpts360" in the header of all class-related email to the instructor.)
Personal Zoom Link: https://wsu.zoom.us/j/5635500668
(Use this for office hours.)
Office: Floyd 134D
Office Hours: W 3-5pm or by appointment
Office Phone: (509) 372-7178 (on campus: 2-7178)
Cell Phone: (509) 374-7520 (prefer this one)
Web Page: http://www.tricity.wsu.edu/~bobl

System Administrator

WSUTC Information Technology
CIC 225
(509) 372-7334 (on campus: 2-7334)
tchelp@tricity.wsu.edu

Lecture

TuTh 2:55-4:10pm, Floyd 133

Lab

F 2:10-5pm, Floyd 145

Catalog Description

360 Systems Programming C/C++ 4 (3-3) Course Prerequisite: CPT S 223 with a C or better; CPT S 260 with a C or better or E E 234 with a C or better; admitted to the major or minor in Computer Science, Computer Engineering, Electrical Engineering, Software Engineering, or Data Analytics. Implementation of systems programs, concepts of computer operating systems; laboratory experience in using operating system facilities taught in C/C++ programming language. Typically offered Fall and Spring.

Note: At WSU Tri-Cities, this class is offered only in the Spring.

Recommended Additional Preparation

In addition to the official prerequisites listed above, it is also highly recommended that students have either taken CptS 224 (Programming Tools) or had considerable experience with a command line interface prior to this class. The class will involve considerable programming in C, so facility in that language is expected, along with a familiarity with data structures.

Goals

System programmers are "hackers" in the good sense of the word: Programmers who understand computer and software systems on a variety of levels. They are the people managers and other programmers turn to when they need to implement, maintain, or improve critically-important systems or solve especially tricky software problems.

This course is intended to develop the skills system programmers need to write both system software and applications that make use of system capabilities. It also provides experience in the construction of small-to-medium scale, single-developer software systems.

Outcomes

This class contributes to the following ABET Student Outcomes:

Expectations of Student Effort

Students are expected to put in eight hours of work outside class studying and completing assignments.

Resources

Required Text

W. Richard Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment (3rd. ed.), (Addison-Wesley, 2013)

This is a classic text. You will want to hang on to it after the course ends. If you see it on an interviewer's or colleague's bookshelf, you are in the presence of a system programmer!

References

K. C. Wang Systems Programming in Unix/Linux, (Springer, 2018)

This is the book (WSU EECS) Prof. Wang uses to teach this course in Pullman.

Robert Love Linux System Programming (2nd. ed.), (O'Reilly, 2013)

Also an excellent reference.

Web Page

http://www.tricity.wsu.edu/~bobl/cpts360

Computers

The course will be taught using the Linux operating system running a version of the Ubuntu release. The primary way to access this system is via a virtual machine running Apache Guacamole at https://remote.tricities.wsu.edu . This is accessible from any browser, including those in Floyd 145, where the labs will take place.

We also have a number of Ubuntu Linux workstations in CSLab (East 118). The lab is open during normal University business hours (when not otherwise scheduled).

A compute server (elec.tricity.wsu.edu), also running Ubuntu Linux, is available for remote use via ssh. This requires less network bandwidth than Apache Guacamole. See https://www.tricity.wsu.edu/cs/cslab.html for additional information on remote login, including from non-Linux platforms.

If you are unable to log in to any of these systems, contact the System Administrator (above). (This will get a faster response than contacting the instructor.)

It is also possible that assignments may be completed on WSL (Windows Subsystem for Linux) on a Windows platform. However, they will be graded on a Linux platform similar to cslab or elec, so testing on either of those is recommended as a final step before submission.

To facilitate getting help from the instructor, it is recommended that students using their own computers maintain a working copy of Zoom to allow screen sharing.

Outline

These are the topics the course will cover in the order they will be covered.

  1. Introduction to Systems Programming (1 lecture)
  2. UNIX/Linux Overview (1 lecture)
  3. Basic System Programming in C (2 lectures)
  4. Debugging (1 lectures)
  5. Low-Level I/O (1 lecture)
  6. Files and Directories (2 lectures)
  7. The Standard I/O Library (1 lecture)
  8. System Data Files (1 lecture)
  9. Process Environment (2 lectures)
  10. Process Control (2 lectures)
  11. Process Relationships (1 lecture)
  12. Signals (1 lecture)
  13. Threads (2 lectures)
  14. Daemon Processes (1 lecture)
  15. Interprocess Communication (2 lectures)
  16. Network IPC: Sockets (1 lecture)
  17. Regular Expressions
  18. Selected Topics in Systems Programming (as available)

The exact contents of the last unit will be selected from an assortment of systems programming-related topics, some after student input. In the past, these have included:

Schedule

"--" indicates lectures carried over from the previous session. Readings in Stevens and Rago are indicated. This schedule will be revised as the course progresses.

Week Tues Lecture Thur Lecture Fri Lab
1 1. Introduction to Systems Programming 2. UNIX/Linux Overview
Ch. 1 & 2
Lab 1: Comparing Files
2 3. Basic System Programming in C -- Lab 2: Refactoring
3 4. Debugging
5. Low-Level I/O
Ch. 3
Lab 3: Experiments with Low-Level I/O
4 6. Files and Directories
Ch. 4
PA1 (finddups) assigned (due )
-- Lab 4: The rational Package
5 7. The Standard I/O Library
Ch. 5
-- Lab 5: Finite State Machines
6 8. System Data Files
Ch. 6
PA2 (whocan) assigned (due )
-- CrimsonCode Hackathon
(in Pullman, 2/19-2/20)
(no lab today)
7 9. Process Environment
Ch. 7
10. Process Control
Ch. 8
Lab 6: Testing whocan
8 -- 11. Signals
Ch. 10
Lab 7: Exceptions
9 --
Brian Kernighan on "Elements of Programming Style"
PA3 (snapshot) assigned (due )
12. Process Relationships
Ch. 9
Lab 8: Signals
10 - Spring vacation
11 13. Threads
Ch. 11
-- Lab 9: Arrays
12 14. Daemon Processes
Ch. 13
PA4 (tattle) assigned (due )
15. Local Interprocess Communication
Ch. 15
Lab 10: Threads (Note: Counts as two labs. Due date/time is end of lab on .)
13 -- 16. Network IPC: Sockets
Ch. 16
Lab 10: Threads (continued)
14 -- 17: Regular Expressions Lab 11: Command Line Processing with getopt(3)
15 18a: C Preprocessor Tricks
PA5 (checklinks) assigned (due at 5pm on Friday, -- NO LATE OR RESUBMITTED ASSIGNMENTS PERMITTED)
intentionally invalid link for testing checklinks
Guest Talk: "A Career in Computers"
(Guest Speaker: Rick Lindsley, IBM Linux Kernel Group)
Lab 12: Iterators
16 18b. Cybersecurity for Systems Programmers
Guest Speaker: Dr. Will Hutton, NRECA and WSUTC
(will include discussion of nation state (i.e. Russia) cybersecurity threats)
18c. Curses (no lab today)
17 - Finals Week (no final for this class)

Grading

The grade will break down as follows:

80% programming assignments
15% labs
5% class participation

This is primarily a programming course: there are no plans initially to give examinations. However, there is a lot of reading, and in the event of lack of student participation or other indications that the reading is not being done, those motivations may be introduced in the form of quizzes and the grading table revised accordingly.

Programming Assignments

Most of your grade in this course is based on programming assignments (PAs). PAs usually require 2-3 weeks to complete. In keeping with the spirit of systems programming, all PAs will be completed in the C (not C++) language.

If extra credit is possible and you are attempting it, the extra credit feature(s) you're attempting should be listed in a README.txt file that is part of the submission.

In this class, all assignments requiring code are turned in as follows:

  1. Create a compressed tar(1) file (a “tarball”) containing all necessary source code, a Makefile, and (optionally) a README.txt file. It may be compressed with either gzip(1) or bzip(1). (Remember not to include compiled or other extraneous files!) The name of the file should include “cpts260”, the prefix and number of of the assignment, and your login. As with most tarballs, it should have a “.tgz” or “.tar.gz” extension. For example, the user “ghopper” submitting Programming Assignment 3 would submit a tarball named “cpts360_pa03_ghopper.tgz”.
  2. Submit the tarball to the instructor via Canvas.

To compile your program, the instructor will do the following:

  1. Un-tar (with decompression) the attachment into a clean directory.
  2. Run make.

This should be all that is necessary to produce an executable program. Anything that requires more effort than this will cause points to be taken off. It is strongly recommended that you follow these same steps as a test to assure that problems don't arise with your submission.

Be sure your program does not produce "extraneous" (i.e., not specified in the assignment) output. Points will be deducted for this.

Late Programming Assignments

Unless otherwise noted in the schedule, programming assignments are due at the start of class on the indicated date.

Late penalty is a flat 10% point deduction. Unless otherwise noted on the schedule, late assignments may be turned in before the start of class up to one week after the original due date.

Resubmitting Programming Assignments

If a programming assignment is turned in on time and receives a score of 50% or less, the student has a one-week period from the day the homework is returned to resubmit (i.e. "redo") it before the start of class on that date. It will then be graded with a 20% point deduction.

Grades below 50% typically result either when you submit non-working (or even non-compilable) code or when you don't understand the assignment in the first place. It should go without saying that if either of these is the case, you should ask the instructor for help before you submit anything.

Labs

Except where otherwise noted, labs take place during the scheduled 2h50m lab periods and should be completed within that time, including submission of tarballs to Canvas following the same procedure as for PAs.

If the lab is not completed within the specified time, the student has 24 hours from the end of the lab period to submit the completed lab via Canvas. It will receive a 10% point deduction. No labs will be accepted after that time.

Percentage-to-Letter Grade Mapping

The numerical grade is mapped to a final letter grade based on the instructor's subjective evaluation of the overall difficulty of the course, with the following constraints:

A numerical grade
in this range...
... guarantees a
letter grade which
is at least...
90 ≤ grade ≤ 100 A-
80 ≤ grade < 90 B-
70 ≤ grade < 80 C
60 ≤ grade < 70 D

As the course progresses, the instructor is free to revise these criteria downwards so that, for example, 87% might still result in an A-, but these ranges will not be raised.

Class Participation

The class will be more participatory than the usual lecture form. The instructor expects everyone to come to class having done the reading. Each class will begin by dealing with any questions students have. Once those are resolved, the instructor may ask questions of the class to test their comprehension of the material. The instructor may also pose problems for them to work in class, either individually or as a group.

Questions will be asked in a "round robin" fashion, cycling through all students present. Students who attempt an answer will have it tallied and it will count towards their class participation grade. Students who are absent or say "I don't know" or "pass" will not be tallied.

Attendance

Class attendance is neither kept nor required. Non-attendance does have an effect on grades, however, in that students who do not attend class are unable to respond to questions given out as part of class participation.

COVID-19 Policy

Students are expected to abide by all current COVID-19 related university policies and public health directives. These directives may be adjusted to respond to the evolving COVID-19 pandemic. Directives may include, but are not limited to, compliance with WSU’s COVID-19 vaccination policy, wearing a cloth face covering, physically distancing, and sanitizing common use spaces. All current COVID-19 related university policies and public health directives are located at https://wsu.edu/covid-19. Students who do not comply with these directives may be required to leave the classroom; in egregious or repetitive cases, student non-compliance may be referred to the Center for Community Standards for action under the Standards of Conduct for Students.

Policy on Academic Integrity

Campus-Wide Statement (required statement)

All members of the university community share responsibility for maintaining and promoting the principles of integrity in all activities, including academic integrity and honest scholarship. Students are responsible for understanding the full Academic Integrity Statement. Students who violate WSU’s Academic Integrity Policy (identified in WAC 504-26-010(3) and -404) will, at a minimum, fail the assignment with no resumission permitted. They will also not have the option to withdraw from the course pending an appeal, and will be reported to the Center for Community Standards. If you have any questions about what is and is not allowed in this course, ask the instructor.

Course-Specific Information

The fundamental requirement for all student work in this class is:

Unless otherwise explicitly permitted by the instructor, all work you turn in must be your own.

Any instance of academic dishonesty, as defined in the WSU Student Handbook, in this class will be dealt with severely (typically by failing the class) and reported to the WSU Office of Student Conduct.

Note in particular that it is dishonest not only to submit another individual's work, but to permit another individual to submit yours. This includes both downloading and uploading code to a code-sharing website.

Nevertheless, realizing that students can assist each other in understanding general course material, there are limited ways in which student collaboration is permitted:

  1. You may communicate verbally with another student, as long as you do not communicate the answer or the other content of what you are going to turn in, whether code, mathematics, and/or text. A good way to work in this regard is for the student providing help to ask leading questions of the student needing help, letting them arrive at the answer themselves.
  2. You may draw diagrams and such on a whiteboard, chalkboard, or piece of blank paper to illustrate the verbal points made in (1), as long as you do not write what you are going to turn in. This record may not be scanned, photographed, or otherwise retained.

It will be up to the discretions of the grader (if applicable) and instructor to determine if any assignment shows evidence of collaboration beyond these limits. Any attempt to circumvent the spirit of these rules will be treated as a violation of the fundamental requirement. If you are in doubt, do not give help to or request it from another student: That's what office hours are for.

Students with Disabilities

Reasonable accommodations are available for students with documented disabilities or chronic medical or psychological conditions. If you have such a condition and need accommodations to fully participate in this class, please visit your campus’ Access Center/Services website to follow published procedures to request accommodations. Students may also contact their campus offices to schedule an appointment with a Disability Specialist. All disability related accommodations are to be approved through the Access Center/Services on your campus. It is a university expectation that students connect with instructors (via email, Zoom, or in person) to discuss logistics within two weeks after they have officially requested their accommodations.

For more information, contact Tri-Cities Access Services or email g.hormel@wsu.edu .

Accomodation for Religious Observances or Activities

Washington State University reasonably accommodates absences allowing for students to take holidays for reasons of faith or conscience or organized activities conducted under the auspices of a religious denomination, church, or religious organization. Reasonable accommodation requires the student to coordinate with the instructor on scheduling examinations or other activities necessary for course completion. Students requesting accommodation must provide written notification within the first two weeks of the beginning of the course and include specific dates for absences. Approved accommodations for absences will not adversely impact student grades. Absence from classes or examinations for religious reasons does not relieve students from responsibility for any part of the course work required during the period of absence. Students who feel they have been treated unfairly in terms of this accommodation may refer to Academic Regulation 104 – Academic Complaint Procedures.

Safety and Emergency Notifications

Classroom and campus safety are of paramount importance at Washington State University, and are the shared responsibility of the entire campus population. WSU urges students to follow the “Alert, Assess, Act,” protocol for all types of emergencies and the “Run, Hide, Fight” response for an active shooter incident. Remain ALERT (through direct observation or emergency notification), ASSESS your specific situation, and ACT in the most appropriate way to assure your own safety (and the safety of others if you are able).

Please sign up for emergency alerts on your account at MyWSU. For more information on this subject, campus safety, and related topics, please view the FBI’s "Run, Hide, Fight" video and visit the WSU safety portal.

Full details can be found at https://provost.wsu.edu/classroom-safety/