UNIX Network Programming Volume 2: Interprocess Communication
UNIX Network Programming Volume 2, 2nd Edition
Overview #
UNIX Network Programming, Volume 2: Interprocess Communication (Second Edition) is one of the most respected and comprehensive references on Interprocess Communication (IPC) ever published. Written by the legendary W. Richard Stevens, this volume explores the mechanisms that allow processes and threads to exchange information, synchronize execution, and cooperate efficiently within UNIX and Linux environments.
While Volume 1 focuses on network communication between hosts, Volume 2 concentrates on communication and coordination between processes running on the same system. These IPC mechanisms form the foundation of operating systems, databases, distributed platforms, high-performance servers, and countless enterprise applications.
The book systematically examines both POSIX IPC and System V IPC, covering the four major pillars of process communication:
- Message Passing
- Synchronization
- Shared Memory
- Remote Procedure Calls (RPC)
Beyond API usage, the text explores implementation details, performance characteristics, kernel interactions, scalability considerations, and practical engineering trade-offs. Through detailed examples and performance measurements, readers gain a deep understanding of how modern UNIX systems coordinate concurrent execution.
Why This Book Matters #
Interprocess Communication is one of the most critical areas of systems programming. Efficient communication and synchronization directly influence application scalability, latency, throughput, and reliability.
This book helps readers understand:
- How processes exchange data safely and efficiently.
- When to use message passing versus shared memory.
- The differences between POSIX and System V IPC.
- Synchronization strategies for multithreaded applications.
- Performance implications of different IPC mechanisms.
- Kernel-level behaviors affecting concurrency.
- Techniques for designing high-performance systems.
The material remains highly relevant because modern Linux systems continue to rely heavily on the IPC concepts introduced and analyzed throughout the book.
Technical Metadata #
| Attribute | Details |
|---|---|
| Title | UNIX Network Programming, Volume 2: Interprocess Communication (Second Edition) |
| Author | W. Richard Stevens |
| Original Publisher | Addison-Wesley Professional |
| Chinese Publisher | Posts and Telecommunications Press |
| ISBN | 9787115215116 |
| Primary Topics | POSIX IPC, System V IPC, Synchronization, Shared Memory, RPC |
| Platforms | UNIX, Linux, BSD, Solaris |
| Audience | Systems Programmers, Kernel Developers, Network Engineers |
About the Author #
W. Richard Stevens #
W. Richard Stevens remains one of the most influential authors in UNIX and networking literature. His books continue to serve as foundational references for systems programmers worldwide.
His most notable works include:
- UNIX Network Programming
- Advanced Programming in the UNIX Environment (APUE)
- TCP/IP Illustrated
Stevens was renowned for combining theoretical rigor with practical implementation details, making complex systems concepts accessible to working engineers.
Book Structure #
The book is organized into five major sections that progressively build from IPC fundamentals to advanced synchronization and remote communication technologies.
Part I: IPC Foundations #
The opening section introduces the concepts that underpin all interprocess communication mechanisms.
Core Topics #
- Processes and threads
- Information sharing models
- IPC persistence characteristics
- Naming and namespaces
- IPC object lifecycles
- Effects of
fork,exec, andexit - Error handling techniques
- UNIX standards compliance
Readers also gain a thorough understanding of the differences between:
- POSIX IPC
- System V IPC
This foundational knowledge is essential for understanding the design trade-offs discussed later in the book.
Part II: Message Passing #
Message passing is one of the oldest and most reliable forms of process communication.
Pipes and FIFOs #
The book begins with the classic IPC mechanisms:
- Anonymous pipes
- Named pipes (FIFOs)
- Full-duplex communication
- Client-server architectures
- Concurrent versus iterative servers
Important concepts include:
- Byte-stream semantics
- Communication limitations
- Process relationships
- Resource constraints
POSIX Message Queues #
Coverage includes:
mq_openmq_sendmq_receive- Queue attributes
- Notification mechanisms
- Real-time signals
The book also explores how POSIX message queues can be implemented using memory-mapped files.
System V Message Queues #
Readers learn:
msggetmsgsndmsgrcvmsgctl
Additional topics include:
- Message multiplexing
- Queue management
- Kernel limits
- Server design patterns
Part III: Synchronization #
Synchronization is crucial whenever multiple execution contexts share resources.
Mutexes and Condition Variables #
The book provides detailed discussions of:
- Mutual exclusion
- Locking strategies
- Condition-based waiting
- Producer-consumer models
- Timed waits
- Broadcast notifications
Special attention is given to avoiding race conditions and designing efficient synchronization schemes.
Read-Write Locks #
Topics include:
- Shared versus exclusive access
- Lock acquisition policies
- Reader-writer prioritization
- Custom lock implementations
- Thread cancellation considerations
Record Locking #
The text examines:
- POSIX record locking
- Advisory locking
- Mandatory locking
- File-based synchronization
- Daemon protection strategies
- Network file system considerations
POSIX Semaphores #
Comprehensive coverage includes:
- Named semaphores
- Unnamed semaphores
- Producer-consumer implementations
- Multi-producer architectures
- Process-shared synchronization
The book also demonstrates how semaphores can be constructed using alternative IPC primitives.
System V Semaphores #
Readers learn:
- Semaphore sets
- Kernel-managed synchronization
- Resource management
- Performance considerations
- Legacy UNIX synchronization techniques
Part IV: Shared Memory #
Shared memory is typically the fastest IPC mechanism because data can be accessed directly without repeated kernel-mediated transfers.
Memory-Mapped Files #
The book begins with:
mmapmunmapmsync
Topics include:
- Shared counters
- Anonymous mappings
- Memory visibility
- Mapping semantics
POSIX Shared Memory #
Coverage includes:
shm_openshm_unlink- Shared-memory messaging systems
- Continuous data sharing
- Resource management
System V Shared Memory #
Readers explore:
shmgetshmatshmdtshmctl
The book discusses:
- Segment management
- Kernel limitations
- High-performance data exchange
A major focus is understanding when shared memory outperforms message-passing approaches and how synchronization mechanisms must be combined with shared-memory designs.
Part V: Remote Procedure Calls #
The final section explores higher-level communication mechanisms that allow software to invoke operations across process boundaries.
Solaris Doors #
Doors are a highly efficient RPC mechanism originally developed for Solaris systems.
Coverage includes:
- Door creation
- Procedure invocation
- Credential passing
- Descriptor passing
- Server lifecycle management
The text explains how doors provide lower overhead than traditional RPC systems in many scenarios.
Sun RPC #
Readers learn:
- RPC architecture
- Service registration
- Authentication
- Timeout handling
- Data serialization using XDR
- Multithreaded RPC servers
The chapter demonstrates how remote procedures abstract communication details and simplify distributed application development.
Performance Analysis and Benchmarking #
One of the book’s most valuable contributions is its discussion of IPC performance measurement.
The appendices include methodologies for evaluating:
- Latency
- Throughput
- Synchronization overhead
- Shared memory performance
- Message queue efficiency
- Context-switch costs
These measurements help developers make informed architectural decisions based on empirical data rather than assumptions.
Key Learning Outcomes #
After studying this book, readers will understand how to:
- Design efficient process communication systems.
- Select appropriate IPC mechanisms for different workloads.
- Build scalable synchronization architectures.
- Implement thread-safe applications.
- Use POSIX and System V IPC APIs effectively.
- Develop high-performance shared-memory systems.
- Analyze concurrency bottlenecks.
- Build RPC-based distributed applications.
- Measure and optimize IPC performance.
Recommended Audience #
Systems Programmers #
Developers working close to the operating system will gain deep insights into process communication and synchronization.
Linux and UNIX Engineers #
The book serves as an invaluable reference for understanding the mechanisms that underpin modern UNIX-based operating systems.
Backend and Infrastructure Developers #
Engineers building databases, message brokers, storage systems, and distributed platforms will benefit greatly from the performance-focused discussions.
Researchers and Students #
Graduate students and computer science researchers studying operating systems, concurrency, or distributed computing will find the material both rigorous and practical.
Conclusion #
UNIX Network Programming, Volume 2: Interprocess Communication remains one of the most authoritative resources ever written on IPC. Through its comprehensive treatment of message passing, synchronization, shared memory, and remote procedure calls, it provides a complete framework for understanding how processes cooperate within UNIX and Linux systems.
For developers seeking mastery of concurrency, operating systems, and high-performance software architecture, this volume stands alongside Advanced Programming in the UNIX Environment and UNIX Network Programming Volume 1 as an essential reference. Its principles continue to influence modern systems programming, making it a timeless guide for anyone working with UNIX-based platforms.