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, Lieb 120

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

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:
  • 4 homework assignment, worth 20 points each
  • 1 midterm project, worth 100 points
  • 1 group project, worth 200 points
  • 1 final assignment, worth 100 points
  • no curve
Letter grades will be given as follows:
  • 432 - 480 points => A
  • 384 - 431 points => B
  • 336 - 383 points => C
  • 0 - 335 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.


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
2014-08-25 No Class
2014-09-01 Labor Day Holiday
2014-09-08 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
2014-09-15 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)
2014-09-22 Files and Directories Stevens: Chapter 4 Lecture Slides
 
access.c
chmod.c
size.c
still-simple-ls.c
umask.c
Midterm Project Assignment
2014-09-29 Filesystems, System Data Files, Time & Date Stevens: Chapter 4, 6 Lecture Slides
 
wait-unlink.c
cd.c
2014-10-06 Process Environment, Process Control Stevens: Chapters 7, 8 Lecture Slides
 
testcp.sh
entry.c
exit-handlers.c
forkflush.c
hw.c
zombies.c
2014-10-13 Fall Recess
2014-10-14 Process Groups, Sessions, Signals Stevens: Chapter 9, 10 Lecture Slides
Note: Tuesday class!
FreeBSD Process Management (from "The Design and Implementation of the FreeBSD Operating System")
 
eintr.c
pending.c
reentrant.c
sigusr.c
2014-10-20 Interprocess Communication Stevens: Chapter 14 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
2014-10-27 Advanced I/O: Nonblocking I/O, Polling, and Record Locking Stevens: Chapter 14 Lecture Slides

nonblock.c
flock.c

Final Project Assignment
HW#3
2014-11-03 Dæmon Processes, Shared Libraries Stevens: Chapter 13 Lecture Slides
How to read an Executable
The Executable and Linkable Format (ELF)

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

2014-11-10 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

2014-11-17 Code Reading / HTTP Server Implementations bozohottpd
lighttpd
mini_httpd
nginx
tinyhttpd
Lecture Slides
HW#4
2014-11-24 Encryption in a Nutshell   Lecture Slides
2014-12-01 Review