A step-by-step learning repository for building a deep understanding of multithreading, concurrency, parallelism, async/await, synchronization, producer/consumer patterns, Channels, benchmarking, and testing in C#/.NET.
This repository is not just a collection of examples. It is a structured learning path.
For every topic you will:
- Implement a naive version.
- Observe the problem.
- Implement a better version.
- Write correctness tests.
- Write stress tests where useful.
- Benchmark alternatives.
- Document what you learned.
csharp-multithreading-lab/
├── docs/ Learning documentation
├── src/
│ ├── MultithreadingLab.Core/ Interfaces and reusable implementations
│ ├── MultithreadingLab.Playground/ Console experiments
│ └── MultithreadingLab.App/ Final job processor app
├── tests/
│ ├── MultithreadingLab.Tests/ Unit tests
│ └── MultithreadingLab.StressTests/ Stress/concurrency tests
├── benchmarks/
│ └── MultithreadingLab.Benchmarks/
└── .github/
├── workflows/
└── ISSUE_TEMPLATE/
dotnet restore
dotnet build
dotnet test
dotnet run --project src/MultithreadingLab.Playground
dotnet run -c Release --project benchmarks/MultithreadingLab.BenchmarksStart here:
- Roadmap
- Thread vs Task
- ThreadPool
- Race Conditions
- Locking
- Async/Await
- Parallelism
- Producer/Consumer
- Channels
- Cancellation and Timeouts
- Deadlocks and Starvation
- Performance Guidelines
- Final Project
Each task is complete only when:
- The implementation is finished.
- Unit tests pass.
- Stress tests are added if the topic involves shared state.
- A benchmark exists if there is a meaningful performance comparison.
- The documentation page contains:
- Problem
- Naive implementation
- Improved implementation
- Trade-offs
- Benchmark notes
- Key takeaways
Use one branch per topic:
git checkout -b 001-thread-vs-task
git checkout -b 002-threadpool
git checkout -b 003-race-conditionsThe GitHub issue templates are in .github/ISSUE_TEMPLATE.
You can create one issue per step using the task descriptions from docs/00-roadmap.md.