This repository showcases various POSIX Multithreading concepts and their implementations using C and C++ on Linux systems. It is divided into two parts, covering fundamental and advanced topics to help you master multithreading.
The repository was developed as part of a Udemy course on Multithreading. If you'd like to explore the course, you can check it out here.
This section focuses on the foundational aspects of multithreading with practical examples. Key topics include:
- Thread Management
- Creating and terminating threads, managing stack memory, and thread scheduling.
- Concurrency and Parallelism
- Differences between singularism, concurrency, and parallelism, with real-world examples.
- Joinable and Detached Threads
- Concepts, implementation, and use cases, including a sample map-reduce program.
- Inter-Thread Communication (ITC)
- Understanding callbacks, notification chains, and a publisher-subscriber model.
- Thread Synchronization
- Critical sections, mutex locking, and condition variables.
- Classic Problems
- Solutions for the producer-consumer problem and the dining philosopher problem.
- Semaphores
- Basics, implementation, and differences from mutexes.
All these examples and programs are located in the Part-A
folder.
This section delves into advanced multithreading concepts and problem-solving techniques. Topics include:
- Recursive Mutexes
- When to use them and their implementation.
- Read-Write Locks
- Benefits and custom implementation of read-write locks.
- Monitors
- Using monitors for thread management and solving synchronization problems.
- Assembly Line Model
- Designing multithreaded workflows.
- Deadlock Detection and Prevention
- Strategies to identify and avoid deadlocks.
- Wait-Queue Model and Thread Pools
- Implementing efficient multithreaded task management.
This section also includes unscheduled topics like bounded waiting, strong semaphores, and event pair synchronization, making it a complete reference for mastering multithreading. These examples are located in the Part-B
folder.
If you found this repository useful, please ⭐ the repository to show your support!
Explore the Udemy course on multithreading here.