akshaykhoje/threads
๐ถ C++ Concurrency Sandbox for everyone
C++ Concurrency Sandbox ๐
A professional-grade collection of modern C++ concurrency patterns, synchronization primitives, and advanced task schedulers. This project serves as a technical portfolio for high-performance systems engineering.
๐ Documentation
The full API reference, including collaboration diagrams and call graphs, is automatically generated via Doxygen and hosted on GitHub Pages:
๐ View Documentation
๐ Project Structure
The repository is organized into distinct modules, each demonstrating a specific concurrency challenge:
Bounded-Blocking-Queue/: Implementation of a thread-safe blocking queue for Producer-Consumer synchronization.Readers-Writers/: Patterns for shared resource management using bothstd::shared_mutexand custom implementations with Writer Preference to prevent starvation.ThreadPools/:- Basic: Fire-and-forget worker pool.
- Priority: Importance-based task execution.
- Aging: Advanced scheduler that dynamically boosts task priority to ensure fairness.
- Message-Passing: Decoupled "Inbox" model for asynchronous communication.
Request-Response/: Sophisticated pools usingstd::futureandstd::packaged_taskfor async result retrieval.
๐ Highlights
1. Task Aging Algorithm
To solve the Priority Starvation problem common in standard priority queues, I implemented a background monitor thread that "ages" waiting tasks, ensuring that low-priority jobs eventually jump the line.
2. CI/CD Pipeline
This project features a fully automated documentation workflow. Every push to main triggers a GitHub Action that:
- Installs Doxygen and Graphviz.
- Regenerates the HTML documentation.
- Deploys the updated site to GitHub Pages.
๐ป Getting Started
Prerequisites
- A C++17 compatible compiler (GCC/Clang)
- Doxygen (optional, for local doc generation)
- Graphviz (optional, for diagrams)
Building the Docs Locally
doxygen Doxyfile
# Open docs/html/index.html in your browser