The University of Chicago
Department of Computer Science

CSPP 51081 Course Syllabus
Winter 2013

Unix Systems Programming

Unix Systems Programming Links Home Page

Teaching staff:

Instructor:          Mark Shacklette
Office Hours:     by appointment only

email:     mark (at) cs.uchicago.edu (read hourly or so)
               mshack (at) post.harvard.edu (read hourly or so)

NOTE:   ALL non-confidential email should be addressed to the list.

Lead TA:
Maria Power
Email:
mpower (at) cs.uchicago.edu
Laboratory Hours:
Mondays:  4:15 pm - 5:30 pm in 4th floor lab.  Other times by appointment.


Assistant TA/Grader:
TBD
Email:

Office Hours (Ryerson)


Course Home Page: http://www.classes.cs.uchicago.edu/current/51081-1/
 
 
SUBJECT COURSE TITLE TIME BUILDING
324 51081 Unix Systems Programming Monday, 5:30 pm - 8:20 pm
Ryerson 251

I. TEXT AND MATERIALS
 

Texts: Required (get the latest (i.e., currently published) editions of the following)

1.  The Linux Programming Interface: A Linux and UNIX System Programming Handbook, Michael Kerrisk, No Starch Press, 2010, ISBN: 1593272200
(2 copies on Ready Reserve in Eckhart)

2.  Effective awk Programming, 3rd ed., Arnold Robbins, available online at: http://www.gnu.org/software/gawk/manual/gawk.html

AND optionally choose ONE of the following:

IF you are a total newbie to Unix and Unix C programming (i.e., a beginner with minimal hands-on experience):

3.a.  Beginning Linux Programming, 2nd Ed., Matthew & Stones, Wrox Press, ISBN:  1861002971 (2 copies on Ready Reserve in Eckhart)

ELSE, IF you already have a little hands-on experience with Unix C programming: instead of Matthew & Stones use (this should be the majority of you):

3.b  Understanding Unix/Linux Programming:  A Guide to Theory and Practice, Molay, Prentice Hall, ISBN:  0130083968 (1 copy on Ready Reserve in Eckhart)

Highly recommended:

4.  Advanced Programming in the UNIX(R) Environment , Richard Stevens, Addison-Wesley, ISBN: 0201563177 (2 copies on Ready Reserve in Eckhart)

5.  UNIX Network Programming, Volume 1: Networking APIs - Sockets and XTI (2nd Edition), Richard Stevens, Prentice Hall, ISBN: 013490012X (2 copies on Ready Reserve in Eckhart)

6.  Programming with POSIX Threads, Butenhof, Addison-Wesley, ISBN:  0201633922 (2 copies on Ready Reserve in Eckhart)
 

Texts: Recommended

C Language Instruction

If you are new to C and need a good and substantive introduction to the language, we recommend either of:

The C Programming Language, 2nd ed. Kernighan & Ritchie.  ISBN: 0131103628

C:  A Reference Manual (5th Ed.), Harbison & Steele; Prentice Hall (2002).  ISBN:  013089592X

Expert C Programming--Deep C Secrets, van der Linden, Prentice Hall (1994).  ISBN:  0131774298

Introductory C, Petersen; Morgan Kaufmann Publishers; ISBN: 0125521421 ; 2nd edition (January 15, 1997)

C Programming:  A Modern Approach, King; W.W. Norton & Company; ISBN: 0393969452 ; (April 1996)
 

General Unix C Programming:

Managing Projects with Make , Andy Oram and Steve Talbott, O'Reilly, 1991

Unix Systems Programming with SVR 4, David Curry, O'Reilly,   1996

Linux Socket Programming By Example, Warren Gay

Pthreads Programming, Nichols et. al, O'Reilly, 1996

The Unix Programming Environment, Kernighan & Pike, Prentice Hall, 1984

Advanced Unix Programming, Rochkind, Prentice Hall, 1985

Interprocess Communications in UNIX:  The Nooks & Crannies , Gray, Prentice Hall, 1988

Unix Distributed Programming, Brown, Prentice Hall, 1994

Power Programming with RPC, Bloomer, O'Reilly, 1992

Using C on the UNIX System, Curry, O'Reilly, 1989

GNU Online Documentation for make, gcc, gdb, etc.

General Unix:

Learning the UNIX Operating System , 4th Edition , Peek, et. al., Orielly, 1997

A Practical Guide to Linux , Mark Sobell, Addison-Wesley, 1997

Portable Shell Programming , Bruce Blinn, Prentice Hall, 1996

UNIX Power Tools, Peek et. al., O'Reilly, 1993

Learning the Bash Shell, 2nd. Ed., Newham & Rosenblatt, O'Reilly, 1998
 

Sed & Awk & Regular Expressions:

Unix Awk and Sed Programmer's Interactive Workbook, Peter Patsis, Prentice Hall, 1999

Mastering Regular Expressions , Jeffrey E. F. Friedl, O'Reilly, 1997

sed & awk , Dale Dougherty, O'Reilly, 1990

The AWK Programming Language , Aho, Kernighan, Weinberger, Addison-Wesley, 1988
 

General Operating Systems:

Modern Operating Systems, 2nd. Ed., Tanenbaum, Prentice Hall, 2001

Operating System Concepts, 5th Ed., Silberschatz & Galvin, Addison-Wesley, 1998

UNIX Internals:  The New Frontiers, Vahalia, Prentice Hall, 1996

UNIX Internals:  A Practical Approach, Pate, Addison-Wesley, 1996
 

Texts: Ready Reserve Reading List

The Unix Philosophy, Gancarz
 

II. PREREQUISITES:

1.  Knowledge of C Programing is required.  For those whose C is not sufficient, there is an optional C Tutoral which runs along with this course to shore up skills.

2.  All students are required to have taken the CSPP Unix Bootcamp or the MacLab Unix Course prior to the first day of class (or have the requirement waived).  Those who have not completed this requirement will need approval of the instructor, which will most likely not be granted unless you can demonstrate substantial experience using C and/or Unix.

Basic familiarity with a Unix source code editor (vi, emacs, nedit, pico, gedit, etc.) will be necessary.

III. COURSE DESCRIPTION

CSPP 51081 is systems programming course which explores topics in systems  programming on Unix. Topics to be covered in detail will include:

Unix History and Philosophy 
Awk Programming
Unix File I/O
Static and Shared Libraries
Processes and Signals (fork, exec, etc.)
Pipes (unnamed and FIFOs)
System V IPC (semaphores, message queues, shared memory)
Berkeley Socket programming
Sun RPC
POSIX pThread programming 

Various tools used in developing software in C on Unix will be covered in class, including gcc, gdb, ddd, gprof, cvs, etc.

Because this is a programming course, students will be expected to know the C programming language upon course entry.

IV. LEARNING OBJECTIVES

Upon completion of this course the student will::

A. Understand advanced UNIX operating system concepts and terminology.

B. Develop a command of the Unix Shell environment, including advanced Unix commands and utilities.

C. Learn basic AWK programming.

D. Become acquainted with the basic tools used to develop software in C on the Unix platform.

E. Become familiar with basic IPC issues and techniques in Unix programming

F.  Become familiar with socket programming using the Berkeley socket API

G.  Become familiar with both the theory and practice of making Remote Procedure Calls in Unix

H.  Become familiar with multithreaded programming in C using POSIX pThreads on Unix

V. ACADEMIC INTEGRITY

Students are expected to have read and understood the University's policy on Academic Integrity. This policy is detailed in the Student Manual of University Policies and Regulations, available online at http://www.uchicago.edu/docs/studentmanual/ .
 

VI. METHOD OF INSTRUCTION

Methods include lecture and homework assignments.
 

VII. OTHER COURSE INFORMATION

Attendance:

No formal attendance taken. There may be information presented in class that is not in the texts. You will be responsible for all information discussed in class and assigned in the required readings.

Make-up Work:

If you miss an exam or quiz, you will need to speak with the instructor ASAP.  Prepare for unhappiness.

Students are expected to read the assigned texts before class in order to be able to full participate in the discussions.
 

VIII. METHOD OF EVALUATING STUDENT PROGRESS

Assigned work evaluated as follows:

Assigned work will be evaluated as follows:
 
8 Labs (16 points each) 128 pts
1 Mid-Term 432 pts
1 Final Exam (or option below) 440 pts
Total 1000 pts

NB:  The end of the quarter is the time at which the final grade you have earned through your work in the quarter is recorded with the registrar.  It is not the time at which you begin negotiations with Professor Shacklette for extra credit opportunities.  There is no extra credit offered in this course, either at the beginning or at the end.  If you are dissatisfied with the grade you have earned at the end of the quarter, your only options will be to retake the course the next time it is offered, or accept the grade you earned.

Students may, with the prior permission of the instructor, opt to do either of the following  in lieu of the final exam:

1.    Write a 20-30 page page research paper, double spaced with 1 inch margins, including bibliography and footnotes, detailing the internal activities and interfaces of some substantial portion of the Linux kernel (process management, memory management, virtual memory, file system, scheduling, etc.)  The quality of the paper should be targeted as publishable.  You will need to demonstrate full command of the topic in detail through both the paper as well as possible oral review of its content with the instructor.  The approval process requires a 2 page detailed research topic statement including a proposed outline of contents, resources, etc.  Plagiarism, in any form, will result in an F for the course.

2.    Define a non-trivial systems programming project and implement it.  The approval process requires a 2 page statement of the project, detailing the project scope, deliverable, and tools to be used.  Delivery of the project involves a makefile that builds the software and supporting libraries, etc., and will be open to possible oral review with the instructor.  If you choose this option, you may tailor the labs to support the ongoing development of the project (where relevant) and with the approval of the instructor or TA.  Your project should include multiple topics of the course, for instance, multiple threads, thread concurrency controls, sockets, IPC, etc.  An example of a non-trivial programming project might be a multithreaded web server written in C that supports multiple simultaneous clients and basic HTML delivery and implements some subset of the HTTP protocol.  Plagiarism, in any form, will result in an F for the course and reporting to the program director.

NOTES:

1.    You must obtain the instructor's approval, via email, for either of these options by 11:59 pm, February 11th, 2013There will be no exceptions to this.

2.    Plagiarism in any form will result in a final grade of 'F' for the course and notification of the program director for disciplinary action.

3.    Both options carry the same total point availability as the final exam:  440 points out of 1000.

4.    You may not work together on either of these options.  Both options must be completed on an individual basis.
 

Delivery Process:

The due dates for labs are on the syllabus schedule below.  All labs are required.

Lab assignments, when completed, should be tarballed up into a single gzipped tarball and sent to the graders directly (NOT to the instructor or TA(s)).  The graders will post instructions on submitting labs.

For each part of the lab assignment there are detailed descriptions of what you should turn in. You should include ALL supporting files (source files, data files, etc.) as attachments to the submission email (a single message).  Please send only UNIX-readable (text) files (that is, no MS Word documents!!!).  Word documents will be considered a personal affront to the instructor and will result in ignominy and public humiliation.  All work is evaluated and graded on the LINUX CLUSTER (not solaris, hpux, irix, aix, etc.)

FAILURE TO PROVIDE AND DELIVER TO THE GRADERS ALL SCRIPTS, ALL COMMANDS, AND ALL SUPPORTING FILES, TEXT OR SOURCE, YOU USED TO DELIVER AND PRODUCE THE SOLUTION WILL RESULT IN A LOSS OF POINTS.  IF THE GRADERS, WORKING SOLELY ON THE LINUX CLUSTER, CANNOT REPRODUCE YOUR SOLUTION OR ANY PART OF YOUR SOLUTION FROM THE SET OF INFORMATION YOU PROVIDE, YOU WILL LOSE PARTIAL OR FULL CREDIT.

Note: Labs are due as scheduled below.

All assignments are due as specified on this syllabus and supporting lab pages.  Students who turn in work late, regardless of the reason, will receive 2 points off from the first day the assignment is due (calculated as the first 24 hour period following the due date and time), and continuing for 7 days.  Assignments turned in more than 7 days late from the original due date will not be accepted and the student will receive a 0 on the assignment.  The ONLY exception to this penalty will be a doctor's approved note of severe illness requiring overnight hospitilization, etc.  All late deliveries, regardless of cause, including, but not limited to, acts of God, war, riot, embargoes, acts of civil or military authority, terrorism, fire, flood, tsumami, earthquakes, hurricanes, typhoons, tropical storms or other natural disasters, fiber cuts, strikes, shortages in transportation, facilities, fuel, energy, labor or materials, failure of the telecommunications or information services infrastructure, hacking, SPAM, or any failure of a computer, server or software, including Y2K errors or omissions, the common cold, the flu, asthema, stomach flu, work, work travel, family, childcare, golf, vacation, and other life-related exigencies and necessities, while unfortunate, will still incur the penalty.  It is assumed that you will have plenty of time to work on each assignment, and that an individual penalty or two will have little overall effect on a student's final grade, unless lateness is chronic or other grades are poor, in which case, of course, the penalty will be more cumbersome.  If you are late with a delivery and therefore receive a penalty (which you will if you are late for any reason) and it's an isolated incident and the rest of your work is excellent, the penalty should be innocuous. 

The purpose of quizzes is to encourage students to do the required reading preparation BEFORE class lecture.

The instructor reserves the right to alter the course contents, dates, times or percentage of credit based on time allowed and class progress through the course material. The instructor also reserves the right to curve grades if he deems it in the best interest of the majority of students.
 

IX. COURSE SCHEDULE

NB: The Instructor reserves the right to alter the schedule as class progress dictates.

The following abbreviations reference the following works:
 
 
Abbreviation Text
LPI
Linux Programming Interface
BLP Beginning Linux Programming 
UNP1 UNIX Network Programming, Volume 1 (optional)
EAP Effective Awk Programming (online)
PPT Programming with POSIX Threads (optional)
APUE Advanced Programming in the UNIX Environment (optional)
UULP Understanding Unix/Linux Programming (optional)

NOTE:  Numbers besides the references are chapter numbers.  Odd numbers like APUE 14.1-14.5 mean sections 1 through 5 of chapter 14 of APUE.
 
 
Class 1 January 7
Introduction & syllabus review
Historical Introduction to UNIX
 
LPI, 1-2
EAP, 1-8
[BLP, 1,2,4]
[UULP 1]

Intro FAQ

Intro LAB

Due Date Jan. 14

Class 2 January 14
Introduction to Awk Programming
Review of Regular Expressions

Tools and Compilation:

C compiler, compiling & linking

LPI 41-42
[BLP 3,4,8,9]
[APUE 3,4,5]

FAQ 2  LAB 2
Due Date January 21

Class 3 January 28
Creating and using static libraries Creating and using shared libraries

Introduction to make

Unix File I/O
LPI 3-5
[APUE 3,4,5,7, 10]
[UULP 3,4] 

FAQ 3   LAB 3
Due Date February 4

Class 4 February 2 (Saturday:
9:00 AM - 11:50 AM)

Unix Processes & Signals

Introduction to Unix Processes

Signal Processing

 

LPI 6, 20-22
[BLP 10]
[APUE 7, 8, 10]
[UULP 8,9] 

FAQ 4   LAB 4
Due Date February 9

Class 5 February 4
Process Creation:  fork & exec

Problem Children:  Orphans and Zombies

Introduction to Interprocess Communication:  
Unnamed & Named Pipes

LPI 24-27, 43-44
[APUE 9, 14.1-14.5]
[BLP 12]
[UULP 10] 
FAQ 5   LAB 5
Due Date February 11
Class  6 February 11
MID TERM EXAM    (Written & Live) 
Mid Term Study Guide

Class 7 February 18
System V Interprocess Communication (IPC): 

Semaphores
Message queues
Shared Memory
LPI 45-48
[BLP, 13]
[APUE 14.6-14.11]
[UULP  15.3] 

FAQ 7  LAB 7
Due Date February 25

Class 8 February 25
C Socket Programming 
LPI 56-61
UNP1 1-9 
[UULP 11,12,13] 

FAQ 8  LAB 8
Due Date March 4

Class 9 March 4
Sun RPC

Multithreaded Programming on Unix with POSIX pThreads
LPI 51, 29-33
PPT 1-5, 8
[UULP 14]

FAQ 9  LAB 9
Due Date March 11
Class 10 March 11
FINAL EXAM: (Written (Cumulative) & Live (Classes 7, 8 & 9 only)) 
Final Exam Study Guide

Class 11
March 18
Advanced topics in Unix

X. Online Reference and Resources:

General:

Common Unix Commands

Norman Matloff's Unix Tutoral Center

IBM Developerworks Library

The Unix Reference Desk

Davin's collection of unix programming links

Unix Guru Universe

Unix FAQ Index at faqs.org

Stanford CS Education Library (C tutorials, programmer tools pdf, pointer references, fun with Binky, et. al.)

History of Unix by Mike Loukides

History of Unix by Dennis Ritchie

DDD Debugger

glibc Manual

Regular Expressions:

Regular Expression HOWTO

Single UNIX Specification:  Regular Expressions

 Steve Ramsay's Guide to Regular Expressions

Awk:

How to Get Things Done With Awk

Awk Filters

C Programming:

Unix C Programming FAQ

A. D. Marshall's Programming in C:  UNIX System Calls and Subroutines using C

Introduction to C Programming

C Programming on Unix Tutorial at University of Strathclyde

POSIX Threads:

Threads FAQ

Programming Posix Threads Bounce Point
 
 

Supplemental Reading
(in no particular order)

Mastering Regular Expressions, Jeffrey E. F. Friedl (O'Reilly & Assoc. 1997, ISBN: 1-56592-257-3). An thorough discussion of an inexhaustible subject.

Learning the UNIX Operating System , 4th Edition, Jerry Peek, Grace Todino & John Strang (Orielly & Associates, 1997, ISBN: 1-56592-390-1) A virtual "Cliffs Notes" for the Unix Operating System.

Using C on the UNIX System, David A. Curry (O'Reilly & Assoc., 1985, ISBN: 0-937175-23-4). A good introduction to C programming on Unix.

Learning GNU Emacs, Debra Cameron & Bill Rosenblatt (O'Reilly & Assoc., 1991, ISBN: 0-937175-84-6). A good introduction to emacs.

UNIX for the Impatient, Paul W. Abrahams & Bruce R. Larson (Addison-Wesley Publishing Company, 1992, ISBN 0-201-55703-7). Good, clear coverage of the utilities, recommended for Unix beginners.

UNIX in a Nutshell: A Desktop Quick Reference for System V & Solaris 2.0 (O'Reilly & Associates, Inc., 1992, ISBN 0-56592-001-5). A handy reference for SysV and Solaris 2.

When You Can't Find Your UNIX System Administrator, Linda Mui (O'Reilly & Associates, Inc., 1995, ISBN 1-56592-104-6). The title says it all.

UNIX Power Tools, Jerry Peek, Tim O'Reilly, and Mike Loukides (O'Reilly & Associates, 1993, ISBN 0-679-79073-X). An excellent compendium of tricks of the masters, written for beginners and intermediates. Includes a CDROM of useful software.

Exploring the UNIX System, Stephen G. Kochan & Patrick H. Wood (SAMS, a division of Macmillan Computer Publishing, 1989, ISBN 0-8104-6268-0).(OUT OF PRINT)

Learning GNU Emacs, Debra Cameron and Bill Rosenblatt (O'Reilly & Associates, 1992, ISBN 0-937175-84-6).

Unix Shell Programming, Stephen G. Kochan & Patrick H. Wood (Hayden Book Co., 1990, ISBN 0-8104-6309-1). The classic on shell programming. The third edition is available at amazon

The Unix C Shell Field Guide, Gail Anderson and Paul Anderson (Prentice Hall, 1986, ISBN 0-13-937468-X).

A Student's Guide to UNIX, Harley Hahn. (McGraw-Hill, 1993, ISBN 0-07-025511-3). This, and its almost identical sister, Open Computing's Unix Unbound (same author and publisher), is an excellent aid for beginners. Hahn's wry humor runs throughout.

Tricks of the UNIX Masters, Russell G. Sage (Howard W. Sams & Co., Inc., 1987, ISBN 0-672-22449-6).

Unix System V: A Practical Guide , Mark Sobell (Benjamin/Cummings, 1995, ISBN 0805375678) (A classic)

Unix Network Programming, Volume 1: Networking APIs: Sockets and XTI , Richard Stevens (Prentice Hall, 1998, ISBN 013490012X) The definitive work on Unix Sockets

Unix Network Programming, Volume 2: Interprocess Communication, Richard Stevens(Prentice Hall, 1999, ISBN 0130810819) The definitive work on IPC.

Applied Unix Programming, Volume 2 , Bharat Kurani (Prentice Hall, 1997, ISBN 0133043460) The Unix C Library Reference Manual, includes C Library, math library, socket library, transport library, and internet library.

Advanced Programming in the Unix Environment , Richard Stevens (Addison-Wesley, 1992, ISBN: 0201563177). A practical guide to the theory of sockets and IPC on Unix.

The C Programming Language, Brian Kernighan and Dennis Ritchie (Prentice Hall, 1988, ISBN 0131103626). The definitive tutorial on the C Programming Language.

Pointers on C, Kenneth Reek (Addisson-Wesley, 1998, ISBN 0673999866). A good introduction to the C Programming Language.

C: A Reference Manual, Fourth Edition , Harbinson and Steele (Prentice Hall, 1995, ISBN 0133262243). A good reference manual for the C langugage.

Absolute Beginner's Guide to C , Greg Perry (Sams, 1994, ISBN 0672305100). One of the easiest avenues into C Programming in print.

Practical C Programming, Third Edition , Steve Oualline (O'Reilly, 1997, ISBN 1565923065). A good tutorial on C, and one of the few that assumes you might be using GNU tools as opposed to Microsoft's.

Design of the Unix Operating System , Maurice Bach (Prentice Hall, 1986, ISBN 0132017997). Perhaps the best general discussion of the details of the Unix Operating System.

Unix Internals: The New Frontiers , Uresh Vahalia (Prentice Hall, 1996, ISBN 0131019082). A newer discussion of the details of Unix, published 10 years after Bach's book.

Unix Internals: A Practical Approach , Steve Pate (Addison-Wesley, 1996, ISBN 020187721X). A good and readable discussion of the details of the Unix kernel.

The Linux Kernel Book, Card, et. al. (Wiley, 1998, ISBN 0471981419). A good book which concentrates on the particularities of the Linux Kernel code itself. A gentle tour through the kernel's source code. The book comes with a CD for RedHat 5.0, whose kernel's code is examined throughout the book.