Advanced Programming in the UNIX Environment

CS631 - APUE


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. All coursework will be done exclusively on linux-lab.cs.stevens.edu from the command-line. This is not an introduction to using Unix!

This class overlaps significantly with CS392 ``Systems Programming'' -- if you have taken this class, please talk to me in person before trying to register for CS631.


Time, Date & Place:

Mondays, 18:15 - 20:45, Babbio Center 304

Instructor:

Jan Schaumann [jschauma@stevens.edu]

Resources:


Source Code

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:


Textbooks:

The textbook used in this class is:

The third edition, released in May 2013, is also acceptable.

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, etc. usually sell these books for cheaper than the Stevens bookstore.

Systems Used

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

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:
  • 5 homework assignment, worth 20 points each
  • 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
Within each letter grade, there are +/- grades given at the discretion of the instructor. (Exception: there is no A+)

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.

Homework Assignments:


Midterm Project:

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


Final Project:

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


Final Exam:

Details to be announced.


Syllabus:

Homework assignments, slides, and other material listed below is from the previous semester. We will update the content as the semester progresses.
Date Topic Reading Material Notes
2013-08-26 Introduction, UNIX history, UNIX Programming Basics Stevens: Chapters 1, 2 Lecture slides
 
simple-cat.c
simple-ls.c
simple-shell.c
simple-shell2.c

Intro
HW#1
2013-09-02 Labor Day Holiday
2013-09-09 File I/O, File Sharing Stevens: Chapter 3 Lecture Slides
 
argv.c
hole.c
lseek.c
openex.c
openmax.c
rwex.c
sync-cat.c
HW2: tcp(1),tcpm(1)
2013-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
2013-09-23 Filesystems, System Data Files, Time & Date Stevens: Chapter 4, 6 Lecture Slides
 
wait-unlink.c
cd.c
2013-09-30 Process Environment, Process Control Stevens: Chapters 7, 8 Lecture Slides
 
testcp.sh
entry.c
exit-handlers.c
forkflush.c
hw.c
zombies.c
2013-10-07 Process Groups, Sessions, Signals Stevens: Chapter 9, 10 Lecture Slides
FreeBSD Process Management (from "The Design and Implementation of the FreeBSD Operating System")
 
eintr.c
pending.c
reentrant.c
sigusr.c
2013-10-15 Interprocess Communication Stevens: Chapter 14 Note: Tuesday class!

Lecture Slides

BSD IPC Tutorial
BSD IPC

pipe1.c
pipe2.c
popen.c
semdemo.c
shmdemo.c
memory-layout.c
msgsend.c
msgrecv.c
socketpair.c
udgramread.c
udgramsend.c
dgramread.c
dgramsend.c
streamread.c
streamwrite.c
strchkread.c
2013-10-21 Advanced I/O: Nonblocking I/O, Polling, and Record Locking Stevens: Chapter 14 Lecture Slides

nonblock.c
flock.c

Final Project Assignment
HW#3
2013-10-28 Dæmon Processes, Shared Libraries Stevens: Chapter 13  Lecture Slides

dlopenex.c
evil.c
ldtest1.2.c
ldtest1.c
ldtest2.c
main.c
setget.c

2013-11-04 UNIX tools: make(1), revision control, diff(1), patch(1), gdb(1) CVS Documentation Debugging with GDB
Guide to Faster, Less Frustrating Debugging
gdb Tutorial
Git
Lecture Slides

compile chain examples
make examples
gdb examples

2013-11-11 Code Reading / HTTP Server Implementations bozohottpd
lighttpd
mini_httpd
nginx
tinyhttpd
Lecture Slides
HW#4
2013-11-18 Encryption in a Nutshell   Lecture Slides
HW#5
2013-11-25 Review All materials covered. Lecture Slides
2013-12-02 Final Exam   Final Exam