CS 214 Systems Programming Fall 2014

Instructor:

Brian Russell morbius@cs.rutgers.edu    Office Hours: Wednesdays 8:00-9:00 pm, Hill 403.

 
TAs:

Mengsong Zou mz228@cs.rutgers.edu    Office Hours: Thursdays, 5:00-6:00 pm, Hill 488

Hai Pham hxp1@cs.rutgers.edu    Office Hours: Tuesdays 2:00-3:00 pm, Hill 405

Konstantinos Nikolakakis nikolakakis.konstantinos@gmail.com    Office Hours: Mondays 9:00-10:00 am Hill 402

Dong Yang dy131@cs.rutgers.edu    Office Hours: Wednesdays 10:30-11:30 am, Hill 408

Lezi Wang lw462@cs.rutgers.edu    Office Hours: Tuesdays 2:00-3:00 pm, Hill 492

Samani Gikandi sgg45@cs.rutgers.edu    Office Hours: TBA

 

Objective

The aim of CS214 is to introduce the student to the process of writing low-level programs that interact directly with a computer's operating system and hardware, as well as to develop the student's ability to build large applications in a team environment. Upon completion of this course, the successful student should be able to design, write, test, and analyze moderately complicated programs using the C programming language and UNIX/Linux operating systems.

Prerequisite Knowledge

Textbook

The following text is used in this course:

Computer Systems - A Programmer's Perspective Second 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 CS214

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

  1. Programming in C


  2. Programming under UNIX

  3. Large-scale development

  4. Concurrent programming

  5. (optional) Embedded systems programming

Lecture Schedule

Sep 02 Into to C, object files, linking and processes

Sep 04 C program structure, C functions

Sep 09 C preprocessor, formatted I/O

Sep 11 Dynamic memory management

Sep 16 Data Structure design

Sep 18 File I/O

Sep 23 multi-file projects, makefiles, directory I/O

Sep 25 gdb -- Bryant and O'Halloran pp 254-256

Sep 30 libraries (system-provided, static, dynamic) -- Bryant and O'Halloran pp 681-683

Oct 02 Signals and event-based programming -- Bryant and O'Halloran pp 736-758

Oct 07 Signals and processes

Oct 09 valgrind and memory-related bugs

Oct 14 caching (should be Linux commands earlier)

Oct 16 Multiprogramming -- Bryant and O'Halloran pp 718-736

Oct 21 Threads -- Bryant and O'Halloran pp 947-989

Oct 23 Thread synchronization (mutex locks, semaphores)

Oct 28 Thread synchronization (condition variables), thread patterns

Oct 30 Thread patterns (producer-consumer, etc)

Nov 04 Signals and threads

Nov 06 midterm

Nov 11 UNIX/Linux commands, BASH shell

Nov 13 shared memory

Nov 18 shared memory

Nov 20 malloc() internals -- Bryant and O'Halloran pp 814-836

Nov 25 malloc() internals

Nov 27 Thanksgiving. Eat. Study.

Dec 02 Bash shell scripting

Dec 04 more shell scripting

Dec 09 Final exam

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.

Here are some producer/consumer programs prod_consum.c and prod_consum2.c and even one with semaphores and better dynamic memory management prod_consum3.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, Tuesday December 09, instead of the officially 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 three 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 iLab Linux machines. We will be grading your assignments on those machines 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 TAs 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 TAs do 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:

    40% Correctness

    - Percent based on number of test cases

    40% Code Quality

    - 20% Algorithmic

    - 10% Reusability/Modularity

    - 10% Decomposition

    20% Documentation

    - 10% Test Cases from Students

    - 5% Comments

    - 5% 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.