PUP Exercises

The source code accompanying "Practical Unix Programming" by Robbins and Robbins is available from the author's web site and from this index into the PUP source code.

PUP Exercises. The "PUP Experience" incorporated into the following series of exercises offers a significant new dimension to our exploration of contemporary operating systems. We will be studying and in some cases modifying systems programs which illustrate processes and threads, clients and servers, shells, daemons, signals, semaphores, timers, and interrupts.

For each of the following nine exercises you are asked to hand in a "lab report" by the date indicated for that lab in the appropriate schedule. Though the specific form and format of these lab reports is not specified, they should generally include

Strive to make these lab reports concise, thorough, and accurate.

Chapter 1: Concurrency
Thursday, 24 Jan 2002

makeargv and freeargv, (PUP 1.6, p25, first two subparts only)

Chapter 2: Programs and Processes
Thursday, 31 Jan 2002

Simple biff, (PUP 2.14, p72, first seven subparts only)

Chapter 3: Files
Thursday, 7 Feb 2002

The /proc filesystem, (PUP 3.12, p133, get_prstatus and output_prstatus)

The PUP discussion of the /proc filesystem is rather sketchy, and is directed quite specifically at Sun's implementation of the concept. The exercise mentioned above makes use of a header file which is not available on our Red Hat Linux systems, so we are stopped at the front door. Rather than trying to bang on those code snippets, spend a few minutes browsing through this online discussion of the /proc filesystem under Linux. The main discussion starts on line 87. Issue a few of their illustrative commands and compare the results displayed in that document with the output that appears on your own system. This is a page from Cross-Referencing Linux, a very fine, extensively cross-referenced, online display of Linux source code.

Chapter 4: The Token Ring
Thursday, 14 Feb 2002

Forming a token ring; file descriptor tables; mechanics of redirecting input and output, (PUP 4.1, p147, test and modify Program 4.1)

Chapter 5: Signals
Thursday, 21 Feb 2002

Catching and Ignoring Signals, (PUP 5.5, p185, biff with signals)

Chapter 6: Timers
Thursday, 28 Feb 2002

Interval Timers, (PUP 6.8, p241, mycron)

Chapter 7: Timers
Thursday, 7 Mar 2002

A Simple Shell; A Shell that Handles Background Processes, (PUP 7.6, p274, myshell, ush)

Chapter 8: Semaphores
Thursday, 4 Apr 2002

Critical Sections and Semaphores, (PUP 8.4, p310, semaphores and critical sections)

Chapter 9: Threads
Thursday, 18 Apr 2002

POSIX Threads, (PUP 9.4, p356, user vs. kernel threads)