Advanced Programming in the UNIX Environment

CS810 D - APUE

This class has been cancelled for the Fall of 2009.
If you are interested in this or my other class to be offered, please contact Daniel Duchamp.


Course Outline

In this course, students will learn to develop complex system-level software in the C programming language while gaining an intimate understanding of the UNIX operating system (and all OS that belong to this family, such as Linux, the BSDs, and even Mac OS X) and its programming environment.

Topics covered will include the user/kernel interface, fundamental concepts of UNIX, user authentication, basic and advanced I/O, fileystems, signals, process relationships, and interprocess communication. Fundamental concepts of software development and maintenance on UNIX systems (development and debugging tools such as "make" and "gdb") will also be covered.

While there are no prerequisite courses, students are expected to have a good working knowledge of the C programming language and to be able to competently use a UNIX system with a command-line shell interface.

You will be writing a lot of code in this class. You may also find the need to read a lot of code not written by you as well as the manual pages accompanying the sources. On lab.cs.stevens-tech.edu, you can find the complete source tree of NetBSD in /usr/src -- feel free to snoop around in there.


Time, Date & Place:

Fall 2009: This class has been cancelled.

Resources:


Textbooks:

The textbook used in this class is:

The first edition is also acceptable, even though we will be teaching from the second edition.

The following books are recommended purely for your own personal reference. They're not used in the class as a text, but are related and very useful books to have:

  • ``The C Programming Language'' -- important: make sure you get the 2nd Edition covering ANSI C.
    by Brian W. Kernighan and Dennis M. Ritchie.
    Prentice Hall, Inc., 1988.
    ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback).
  • ``The Practice of Programming''
    by Brian W. Kernighan and Rob Pike.
    Addison-Wesley, Inc., 1999.
    ISBN 0-201-61586-X.
Online vendors such as Amazon.com, bn.com, bookpool.com etc. usually sell these books for cheaper than the Stevens bookstore.

Instructor:

Jan Schaumann [jschauma@cs.stevens.edu]

Systems Used

All software development will be done on the linux-lab.cs.stevens-tech.edu and lab.cs.stevens-tech.edu systems. It is your responsibility to get an account on these systems.

All grading will be done on these systems. While you may choose to develop on your own personal host, you should make sure that your code compiles and runs flawlessly on these systems.


Grading:

There will most likely be:
  • 2 homework assignment, worth 20 points
  • 4 Quizzes, worth 20 points each. The quiz with the lowest grade will be dropped.
  • 1 midterm project, worth 100 points.
  • 1 final project, worth 200 points.
  • 1 final exam, worth 100 points.
  • no curve
Letter grades will be given as follows:
  • 450 - 500 points => A
  • 400 - 449 points => B
  • 350 - 399 points => C
  • 0 - 349 points => F

Plagiarism, Cheating and other ways to get an F

This really should not be necessary, but just to preempt any complains that I did not make myself clear:
Students are responsible for their own work. It is unethical (and in some cases illegal) to present as one's work the ideas, words or representations of another without the proper indication of the source. Therefore, it is the student's responsibility to give credit for any quotation, idea or data (such as statistical data or source code) borrowed from an outside source.

Failure to do so constitutes plagiarism, may imply copyright infringement and license violations and is viewed as cheating in this class.

Midterm Project:

The midterm assignment may vary each semester the class is taught. In the past, midterm assignments have included writing ls(1) or something like the following:

Implement the "snap(1)" command as decribed in the manual page provided to you. See the full midterm project description for details.


Final Project:

The final assignment may vary each semester the class is taught. In the past, final assignments have included writing an IRC client and -server, a simple rsync-variation or something like the following:

Implement the "sws(1)" command as decribed in the manual page provided to you. See the full final project description for details.


Syllabus:

Notes, slides, etc. below are from previous semesters for your reference. They will be updated as the semester progresses.  
Date Topic Reading Material Notes
2008-09-02 Introduction, UNIX history, UNIX Programming Basics Stevens: Chapters 1, 2 Lecture Slides  
simple-cat.c
simple-ls.c
simple-shell.c
simple-shell2.c
2008-09-09 File I/O, File Sharing Stevens: Chapter 3 Lecture Slides
 
hole.c
lseek.c
openmax.c
sync-cat.c
HW1: tcp(1),tcpm(1)
2008-09-16 Files and Directories Stevens: Chapter 4 Lecture Slides
 
access.c
chmod.c
size.c
still-simple-ls.c
umask.c
Midterm Project Assignment
2008-09-23 Filesystems, System Data Files, Time & Date Stevens: Chapter 4, 6 Lecture Slides
 
wait-unlink.c
cd.c
script to test HW1
Quiz1 w/ solutions
2008-09-30 Process Environment, Process Control Stevens: Chapters 7, 8 Lecture Slides
 
const.c
exit-handlers.c
forkflush.c
hw.c
setjmp1.c
setjmp2.c
setjmp3.c
2008-10-07 Signals Stevens: Chapter 10 Lecture Slides
 
getpwnam.c
pending.c
sigusr.c
Quiz2 w/ solutions
2008-10-14 No Class (Monday Class Schedule) -- Midterm due
2008-10-21 Interprocess Communication Stevens: Chapter 14 Lecture Slides

BSD IPC Tutorial
BSD IPC

pipe1.c
pipe2.c
socketpair.c
udgramread.c
udgramsend.c
dgramread.c
dgramsend.c
streamread.c
streamwrite.c
strchkread.c

Final Project Assignment
sws(1)
2008-10-28 Advanced I/O: Nonblocking I/O, Polling, and Record Locking Stevens: Chapter 14 Lecture Slides

nonblock.c
Quiz #3 with solutions
2008-11-04 Go Vote!
Daemon Processes, final project discussion
Stevens: Chapter 13 Lecture Slides

2008-11-11 UNIX tools: make(1), cvs(1), diff(1), patch(1), gdb(1) CVS Documentation Debugging with GDB
Guide to Faster, Less Frustrating Debugging
gdb Tutorial
Lecture Slides

compile chain examples
make examples
gdb examples

Homework #2 (sample solution)
2008-11-18 Encryption in a Nutshell
Final Project Discussion
  Lecture Slides
Quiz #4 with solutions
2008-11-25 Review All covered chapters and materials Lecture Slides
Extra Credit Quiz #5 with solutions
2008-12-02 Final Exam - exam given at standard class time/place all covered chapters and materials Open Book
2008-12-20, 10:59:59 Final Project due ----- -----