Project 13: System V Shared Memory Image Processor

An image processing pipeline where multiple worker processes share a large image in System V shared memory.

Quick Reference

Attribute Value
Primary Language C
Alternative Languages N/A
Difficulty Level 3 (Advanced)
Time Estimate See main guide
Knowledge Area Image Processing, Parallel Computing
Tooling See main guide
Prerequisites See main guide

What You Will Build

An image processing pipeline where multiple worker processes share a large image in System V shared memory.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Segment sizing → shmget with large sizes
  • Work partitioning → Each worker processes a region
  • Coordination → Signaling when all workers are done

Key Concepts

  • Map the project to core concepts before you code.

Real-World Outcome

$ ./shm_image_filter input.png output.png --filter=blur --workers=4

Shared Memory Image Processor
Image: 4096x4096 (64MB)
Workers: 4
Filter: Gaussian blur

[Master] Loaded image into shared memory (shmid=54321)
[Worker 1] Processing rows 0-1023
[Worker 2] Processing rows 1024-2047
[Worker 3] Processing rows 2048-3071
[Worker 4] Processing rows 3072-4095
[Worker 2] Done (245ms)
[Worker 1] Done (251ms)
[Worker 4] Done (248ms)
[Worker 3] Done (250ms)
[Master] All workers complete, writing output

Total time: 255ms (vs 980ms single-threaded)
Speedup: 3.84x with 4 workers

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. 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