Project 6: Message Queue Performance Benchmark
A benchmark comparing POSIX vs System V message queues, pipes, and Unix domain sockets.
Quick Reference
| Attribute | Value |
|---|---|
| Primary Language | C |
| Alternative Languages | N/A |
| Difficulty | Level 2 (Intermediate) |
| Time Estimate | See main guide |
| Knowledge Area | Performance Analysis, IPC |
| Tooling | See main guide |
| Prerequisites | See main guide |
What You Will Build
A benchmark comparing POSIX vs System V message queues, pipes, and Unix domain sockets.
Why It Matters
This project builds core skills that appear repeatedly in real-world systems and tooling.
Core Challenges
- Identify the tricky edge cases and design for them.
Key Concepts
- Map the project to core concepts before you code.
Real-World Outcome
$ ./ipc_benchmark --msg-size=1024 --iterations=100000
IPC Mechanism Benchmark (1KB messages, 100K iterations)
═══════════════════════════════════════════════════════
Mechanism Throughput Latency (avg) Latency (p99)
─────────────────────────────────────────────────────────────────────
Pipe 1.2 GB/s 0.8 μs 2.1 μs
FIFO 1.1 GB/s 0.9 μs 2.4 μs
Unix Domain Socket 1.4 GB/s 0.7 μs 1.8 μs
POSIX Message Queue 0.8 GB/s 1.2 μs 3.5 μs
System V Message Queue 0.6 GB/s 1.6 μs 4.2 μs
Shared Memory + Sem 2.8 GB/s 0.3 μs 0.8 μs
Winner: Shared Memory (for raw throughput)
Best simplicity: Unix Domain Socket
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- Refactor into clean modules with tests.
Milestones
- Milestone 1: Minimal working program that runs end-to-end.
- Milestone 2: Correct outputs for typical inputs.
- Milestone 3: Robust handling of edge cases.
- Milestone 4: Clean structure and documented usage.
Validation Checklist
- Output matches the real-world outcome example
- Handles invalid inputs safely
- Provides clear errors and exit codes
- Repeatable results across runs
References
- Main guide:
UNIX_IPC_STEVENS_VOL2_MASTERY.md - Primary references are listed in the main guide