Practical UNIX programming: a guide to concurrency, communication, and multithreading (1995)

I. FUNDAMENTALS. 1. What Is Concurrency? Multiprogramming and Multitasking. Concurrency at the Applications Level. UNIX Standards. Programming in UNIX. Making Functions Safe. Exercise: Argument Arrays. Additional Reading. 2. Programs and Processes. Layout of a Program Executable. Static Objects. The Process ID. The Process State. Process Creation and the UNIX fork. The wait System Call. The exec System Call. Background Processes and Daemons. The Process Environment. Process Termination in UNIX. Critical Sections. Exercise: Process Chains. Exercise: Process Fans. Exercise: Simple biff. Exercise: News biff. Additional Reading. 3. Files. Directories and Paths. UNIX File Representation. File Handle Representation. Filters and Redirection. Pipes. Reading to and Writing from Files. Nonblocking I/O. The select call. FIFOs. Special Files-The Audio Device. Exercise: Traversing Directories. Exercise: proc Filesystem. Exercise: Audio. Exercise: Terminal Control. Additional Reading. 4. Project: The Token Ring. Forming a Ring. Simple Communication. Mutual Exclusion with Tokens. Mutual Exclusion by Voting. Leader Election on an Anonymous Ring. Token Ring for Communication. A Pipelined Preprocessor. Parallel Ring Algorithms. The Flexible Ring. Additional Reading. II. ASYNCHRONOUS EVENTS. 5. Signals. Sending Signals. The Signal Mask and Signal Sets. Catching and Ignoring Signals-sigaction. Waiting for Signals-pause and sigsuspend. An Example-biff. System Calls and Signals. siglongjmp and sigsetjmp. Realtime Signals. Asynchronous I/O. Exercise: Dumping Statistics. Exercise: proc Filesystem II. Exercise: Spooling a Slow Device. Additional Reading. 6. Project: Timers. Times in UNIX. Interval Timers. Project Overview. Simple Timers. Setting One of Five Single Timers. Multiple Timers. A Robust Implementation of Multiple Timers. mycron, a Small Cron Facility. POSIX Timer Implementation. Additional Reading. 7. Project: Cracking Shells. A Simple Shell. Redirection. Pipelines. Signals. Process Groups, Sessions, and Controlling Terminals. Handling Background Processes in ush. Job Control. Job Control for ush. Additional Reading. III. CONCURRENCY. 8. Critical Sections and Semaphores. Atomic Operations. Semaphores. Semaphores in POSIX. Semaphores in System V (Spec 1170). Semaphores and Signals. Exercise: POSIX Unnamed Semaphores. Exercise: POSIX Named Semaphores. Exercise: License Manager. Exercise: System V Shared Memory. Exercise: System V Message Queues. Additional Reading. 9. POSIX Threads. A Motivating Problem: Monitoring File Descriptors. POSIX Threads. Basic Thread Management. User versus Kernel Threads. Thread Attributes. Exercise: Parallel File Copy. Additional Reading. 10. Thread Synchronization. Mutexes. Semaphores. Condition Variables. Signal Handling and Threads. Exercise: Threaded Print Server. Additional Reading. 11. Project: The Not Too Parallel Virtual Machine. The Not Too Parallel Virtual Machine. NTPVM Project Overview. I/O and Testing of Dispatcher. Single Task with No Input. Sequential Tasks. Concurrent Tasks. Broadcast and Barriers. Termination and Signals. Additional Reading. IV. COMMUNICATION. 12. Client-Server Communication. Client-Server Strategies. The Universal Internet Communication Interface (UICI). Network Communication. Socket Implementation of UICI. Transport Layer Interface (TLI). STREAMS. STREAMS implementation of UICI. Thread-Safe UICI. Exercise: Transmission of Audio. Exercise: Ping Server. Additional Reading. 13. Project: Internet Radio. Overview of the Multiplexer. One-Way Communication. Two-Way Communication. The Transmit Buffer. Multiplexing the Transmit Buffer. Network Receivers. Tuning In and Out. Network Broadcaster. Signal Handling. Additional Reading. 14. Remote Procedure Calls. Basic Operation. Converting a Simple Local Call to an RPC. An Improved Remote Pseudorandom-Number Service. Server State and Idempotent Requests. Remote Idempotent File Service. Binding and Naming of Services. Failures. NFS-Network File System. Threads and Remote Procedure Calls. Exercise: Stateless File Server. Additional Reading. 15. Project: Tuple Space. Linda. Richard, a Simplified Linda. A Simple Richard Tuple Space. Blackboards: A Tuple Space Application. Active Tuples in Richard. Tuple Spaces as Tuples in Richard. A Multithreaded Server for Richard. Additional Reading. Appendix A. UNIX Fundamentals. Getting Help. Compilation. Makefiles. Header Files. Linking and Libraries. Debugging Aids. User Environment. Additional Reading. Appendix B. UICI Implementation. UICI Prototypes. Socket Implementation. TLI Implementation. Streams Implementation. Thread-safe UICI Implementation. Bibliography. Index.