CS360 -- Systems Programming

James S. Plank --- Spring, 2017

General Information

Professor: James S. Plank Teaching Assistants: John Reynolds (jreyno40), Aaron Young (ayoung48), and Caleb Mennen (cmennen).

Class TT 2:10-3:25 in Min Kao 524.


Grading is roughly 50% labs, 50% exams.

Lab grading policy will be set by the TA's. See their web page for information.

Lab questions should be directed to the TA's first, and then me.

Lecture Notes

There will be lecture notes for each lecture. These will be put on the web with a pointer hanging off the class home page. The point of lecture notes is to give you a hard reference for the things that we talk about in class, since we don't have a textbook.

All programs that I go over in class will also be online in a directory for that class (~plank/cs360/notes/name). The point here is that you don't have to try to copy them down in class, as that's a waste of your time.


Besides the first week, whose lab will probably take the entire session, lab attendance is mandatory in the beginning, during which time the TA's will go over general things that you need to know. After that, you may leave or stay as you see fit. This is a very good time, however, to get an early start on the lab, and use the TA's to answer questions.

The homeworks are where you are going to learn the most in this class. They are going to require far more than 3 hours per week. Thus, you will have to use evenings or weekends to get machine time. Work this out.


Your TA's will tell you how to submit the labs.

You may talk with the TA's, other students, or me about your homeworks, but do the programming on your own. Copying other students' code is considered plagiarism.

The Textbook, and Its Code

The nominal textbook for this class is "Advanced Programming for the Unix Environment," by Richard Stevens (updated by Stephen A. Rago). However, this is not required. It is a wonderful reference book for Unix hacking, and it contains much valuable information. My only complaint with it is that it goes so much into issues of portability and Unix standards, that sometimes you get lost in the overload of information. This happens --- after a while, you'll figure it out. Reading the textbook is kind of like reading man pages: It takes a while to figure out how to get information from it, but once you do, it becomes an extremely valuable reference.

All of the code in the textbook is available online in the directory ~plank/cs360/book_examples. This code was ported by a student a few years back, and I don't know if anyone made use of it. I never looked at it. However, if you are reading the book and would like to try its programs, that is the place to look.

Unix Man Pages

Another valuable resource in this class are the Unix man pages. These can be viewed online, by typing ``man xxx,'' where you want to learn about xxx. For example, try ``man cat'' to learn about all the things you can do with the program cat You will find that there are Unix tools for doing many things you'd like to do. The routines sprintf, sscanf, strcmp, strdup, atoi, and of course malloc will all be of great use to you throughout the semester. Read up on them. If you'd like to know if there is a man page on a certain topic, try ``man -k topic.'' Or read the man page for man....


The point of Piazza is two-fold: So, make a Piazza account and sign in to the class if you are not already signed up (I cut and pasted emails in their enrollment box). Do not post code to Piazza, please.

TA's and Help

The primary place for you to receive help with your labs is during lab time and during the TA's office hours. The TA's have office hours every day from monday through friday -- use them!

Over the weekend, you're back on your own, and again you should solicit help and support from your classmates. You may try to email the TA's, but again, they may not respond. They have lives too.

Also, feel free to use piazza to communicate with your fellow students.

I shouldn't have to write this, but history requires me to. While I love you, and the TA's love you, this class is not our only responsibility during the semester. Similarly, you are taking other classes, so this class is probably not your only responsibility. Think about that when you do things. For example, a few years ago, a student resubmitted a late lab whose score was obviously going to be lower than his first submission. He submitted it because he was proud of finishing it, and wanted the TA to know. The TA, who was swamped with other classes, simply regraded the submission and gave the student the lower score. The student was outraged -- all he wanted was a pat on the back!! Who was at fault? Everybody had good intentions. However, the student should have used the proper channels -- if he wanted an "attaboy," he should have emailed the TA seperately or gone through office hours. This may seem picky, but a matter like this cost everyone time and emotional drama. Including me. The bottom line is to think about your actions before you do them.

Help Each Other!

You are all brothers and sisters in this class. While I'm not the biggest fan of interpersonal interaction and conversation, even I will admit that you learn many unexpected and valuable things through interaction. This is both when you are soliciting help and providing it. I encourage you to try to help each other.

My Pet Peeves

I go over these on the first day of class, but I figure it's time to write them down so that you have reference material. Every teacher has his/her own style, and after 20+ years of teaching, I know mine pretty well. This list doesn't apply to all teachers -- just me.

My Non-Pet Peeves

Commenting Your Code

You will be graded on commenting. Something like 15%. You should comment your code by blocks of comments at the beginning of your files, and before subroutines. Variables should be commented inline. You may also want to comment large blocks of code. You should not comment with a ``running commentary'' to the right of your code, because that is often useless, hard to maintain, and disconcerting. I have seen comments like the following:
  if (i == 0) {               /* If i equals zero */
    return;                   /* then return */
  } else {                    /* otherwise */
    exit(1);                  /* exit with a value of one */
The above is an extreme example, but don't let it happen to you.

Here's an example of what I would consider a well documented program:

#include <stdio.h>

/* sumnsquared.c
   Jim Plank
   August 23, 1998

   This program prompts for and reads a value n from standard
   input, and then calculates and prints the sum of squares
   from one to n.  It uses a for loop instead of using the 
   closed form expression.

  int n;                   /* The value */
  int sum;                 /* The running sum of squares */
  int i;                   /* An induction variable */

  /* Prompt for and read in a value of n */

  printf("Enter a value n: ");
  if (scanf("%d", &n) != 1) {
  /* Calculate sum for each value of i from one to n */

  sum = 0;
  for (i = 1; i <= n; i++) sum += (i*i);

  /* Print the final summation */

  printf("%d\n", sum);

Here's a guide on indentation that you may want to follow.