CS 211 C and Systems Programming Spring 2019

Instructor:

Brian Russell morbius@cs.rutgers.edu    Office Hours: Tuesdays and Wednesdays 4:00-5:00 pm. BSB 427.

 
TA:

Rulong Ma # rulong.ma.jlu@gmail.com    Office Hours: TBA

Objective

Introduction to programming in the C language with an emphasis on its use in writing low-level systems programs. Topics will include coverage of standard C programming idioms, especially with macros and memory management; introduction to programming with the Unix shell and POSIX system calls; and experience with testing and code maintenance using standard tools like debuggers and code revisioning systems.

Prerequisite Knowledge

Textbook

The following text is used in this course:

Computer Systems - A Programmer's Perspective Third Edition
Randal Bryant and David O"Halloran

The following texts are available online, free of charge.

The textbooks do not cover all material discussed in class, and are not a substitute for attending lectures.

Topics Covered in CS211

The following list is organized by topic, not by chronological order of coverage in the course.

  1. Programming in C


  2. Programming under Linux

  3. Large-scale development

  4. Concurrent programming

  5. (optional) Embedded systems programming

Lecture Schedule

Jan 22 Into to C, object files, linking and processes, builtin scalar types

Jan 24 C types, arrays, structs

Jan 29 C pointer types, pointer arithmetic, C program structure, C functions, formatted I/O

Jan 31 Dynamic memory management: malloc(), realloc(), free()

Feb 05 Library Funcitons, formatted I/O, string functions

Feb 07 Linux Commands

Feb 12 Pointers to functions, typedefs, comparator functions

Feb 14 multi-file projects, makefiles, directory I/O

Feb 19 memcmp(), memcpy(), ctype.h

Feb 21 Information Hiding

Feb 26 system calls, errno, file I/O

Feb 28 Multithreading: create, yield, join, exit, detach

Mar 05 Passing args to POSIX threads, memory covenant

Mar 07 mutual exclusion and mutex locks

Mar 12 Thread synchronization (mutex locks, semaphores)

Mar 14 Thread synchronization (condition variables), thread patterns

Mar 19 Spring Break

Mar 21 Spring Break

Mar 26 midterm

Mar 28 Thread patterns (producer-consumer, etc)

Apr 02 server side setup

Apr 04 client side setup

Apr 09 malloc() internals

Apr 11 malloc internals

Apr 16 Bash shell scripting

Apr 18 Bash shell scripting

Apr 23 Sockets

Apr 25 Sockets - client/server

Apr 30 TBA

May 02 TBA

This schedule may change as needed.

Interesting Programs

Here's the signal0.c file.

Here's the signal1.c file that prints blocked signals.

Here's the signal2.c file that responds to changes in window size.

Here's the timer1.c file that implements a timer.

Here's the thread1.c file that implements a (really) simple multithreaded application.

Here's the thread3.c file that implements some mutex protection in a multithreaded application.

Here are some dining philosophers programs diners1.c and diners2.c.

Some Notes

Here are the notes for POSIX multithreading primitives.

And the notes for POSIX mutual exclusion locks.

And the notes for POSIX condition variables.

Expected Work

Students are expected to attend all lectures and perform all reading assignments prior to lecture. Students are also expected to attend all recitation section meetings. Students will be evaluated according to their performance on a semester long programming project, a mid-term examination, and a final examination.

Final Exam

The final exam will be given in the last lecture, Thursday December 10, instead of the offically scheduled exam time. Please plan accordingly.

Project

WARNING: This is a project course, which means that this course should give you more than a passing knowledge of what writing working programs entails. The project will be a major undertaking. If you complete the projects, you will have learned a lot. However, assess your commitment to this course realistically. If you don't have the time or the inclination to work hard on the project, you would be better off not taking the course. You will have to learn how to build and debug reasonably sized C programs and make them robust to outside errors. You will also have to describe how your program work in a written document.

This one large project will be assigned, as multiple sub-projects. Up to 2 students can work as a group for each sub-project and you can change group members for each project . Students are required to complete the parts by the scheduled deadlines. Failure to turn in the project by the deadline using the electronic handin website will result in a zero for all team members. No exceptions!

There are many different operating systems and variants of C out there and we cannot test your program on all of them. So all program assignments must run on the local clamshell Linux machine (clamshell.rutges.edu). We will be grading your assignments on that machine as well.

Working Together and Academic Honesty

Cheating on projects and exams will not be tolerated. We want to protect the fairness and integrity of the class, so we run code similarity detectors on the projects and scrutinize exams for copying. Both parties in the exchange are liable; e.g. if you give away solutions to friends, you're putting yourself at risk too. If you get caught, it's a nasty process--- just don't go there! You're better off asking for help, or at worst, dropping the course and trying it again. The department academic integrity policy can be found at http://www.cs.rutgers.edu/policies/academicintegrity/. You now need to click explicitly on a link when first login to our computing facilities, use handin, etc., that says you acknowledge being aware of the policy (which you can read through the login screen). If you fail to do the click-through by the end of September, your access to our facilities will cease October 1.

Grading

  • Midterm: 20 %

  • Final: 30 %

  • Project: 50%

    The programming part of the projects are typically graded on how close they are to the functional requirements. The written portion is graded on how well the TA can figure out how your project is constructed only from the written description. Exams are typically graded on a curve. As a rule of thumb, the mean is a "C'" and each standard deviation is one letter grade. This rule can be altered, however, if the class does exceptionally well or poorly.

    I felt we should do our best to clarify up front how we grade your programming assignments. The TA does the grading, but have all agreed to the same criteria for grading each programming assignment. Each programming assignment is worth 100 points. here are our grading criteria:

    80% Correctness

    - Percent based on number of test cases

    10% Code Quality

    - Based on algorithmic efficiency, modularity and decomposition

    10% Documentation

    - Based on test cases and documentation (Analysis, readme files, etc...)

    The Gilligan's Island Rule

    We do encourage you to talk to your classmates, provided you follow the Gilligan's Island Rule. After a joint discussion of an assignment or problem, each student should discard all written material and then go do something mind-numbing for half an hour. For example, go watch an episode of Gilligan's Island (or jersey Shore in modern terms), and then recreate the solutions. The idea of this policy is to ensure that you fully understand the solutions or ideas that the group came up with. If you follow the Gilligan's island rule, often best route to follow to get a question answered is to ask, in order: 1. A classmate smarter than you. 2. Your TA. 3. The professor.