Course Overview
Welcome to the Course Series on Multi-Threading - The Master Class Course on Threads.
This course is for those who want to develop fundamental concepts on Multi-threading and related concepts. In this course, we shall be going to cover Multi-threading concepts based on Pthreads (POSIX threads) on the Linux platform.
Though We use the C language to demonstrate the concepts, concepts hold good for any programming language. This course is equally valuable for C++ programmers. Other language programmers may also find this course useful as we explain Multithreading concepts close to the ground zero levels No Abstraction.
We shall discuss several concepts involved in multithreading and demonstrate each concept through a sample program. Several Important Concepts include but are not limited to - Deadlocks, Mutual Exclusion, Atomicity, Thread Synchronization, Race Conditions, Thread forking, and many more.
In the Next Installment of this course, we shall extend our knowledge of Multi-threading to Advance Concepts, including mini-projects on Multithreading and Thread Synchronization.
At each stage of this Course series, you shall be writing a lot of multi-threaded Codes. So be ready to Master the Multi-threading. Along the journey, we shall cover several interview-favorite topics and Questions to prepare you alongside for interviews.
Best of luck!
Table Of Contents:
= = = ======= = = =
1. Understanding Threads
Thread Creation & Termination
Race condition on Thread Creation
Passing Argument to Thread Function
Stack Memory Mgmt for Multi-threaded Programs
Thread Scheduling
2. Understanding Concurrency and Parallelism
Singlularism Vs Concurrency Vs Parallelism
Concurrent Process Design - 2 Examples
Threads as Light Weighted Process
Overlapping and Non-Overlapping Work
3. Joinable and Detached Threads
Joinable Vs Detached Threads
How to Join a thread
Whom to Join?
Sample - Map-Reduce Program
4. Inter Thread Communication
Understanding Callbacks and Function Pointers
Best way to implement ITC
Implementing Notification Chains
A Publisher Subscriber Model
How to Subscribe/UnSubscribe
How to send Notification to Subscribers
5. Asynchronous Thread Cancellation
Thread Cancellation
Asynchronous and Deferred Thread Cancellation
Problem with Async Thread Cancellation
Resource Leaking
Invariants
Deadlocks
Concept of Thread Cleanup Handlers
Prevent Resource Leaking
Data Structure Corruption - Invariants
Cancellation causing Deadlocks
6. Deferred Cancellation
Understanding Deferred Cancellation
Implementation
7. Listener Threads - Responsibility Delegation
Why Listener threads?
Designing Listener threads
Code Changes and Demo
Cancellation of blocked Threads
8. Thread Synchronization
Critical Section
Mutex Rules
Mutex Locking
Mutex Locking - Code Locking
Mutex Locking - Data Locking
Mutex based APIs
Mutexes in Action
9. Deadlocks
What are deadlocks and why do they happen?
Necessary conditions for Deadlock to happen
Mutex lock Ordering Causing Deadlocks
10. Condition Variables
Understanding CV
CV Vs Mutex
Wait( ) & Signal( )
Producer-Consumer Thread Synchronization
Spurious Wake Ups
Thread Vs Resource Specific CV
Broadcasting a CV
Implement Producer-Consumer Problem
11. Dining Philosopher Problem
Problem Description
Data Structures Setup
Assignment Program Setup
Flowchart/Algorithm Discussion
Final Implementation (Step by Step )
12. Semaphores
Introduction
Semaphores Vs Mutexes
How Semaphore work
Strict Alternation Problem
Semaphore Implementation
Semaphore Types
Strong and Weak Semaphores
Listing Upcoming Advanced Multi-Threading Topics for Sequel Course ( Under Progress )
= = = = = = = = = = = = = = = = = = = = = =
1. Pausing and Resuming Threads
2. Thread Pools
3. Standard Problems - Reader/Writer Problem
4. Implementing Thread Barriers
5. Implementing Thread Monitors
6. Solving Sync Problems using Monitors
7. Deadlock Detection and Prevention
8. Wait Queues
9. Implement Timers using Threads
10. How to fork a multi-threaded process
11. Process Synchronization using Named Semaphores
Happy Learning.
Featured Review
This course is amazing. I'm so glad the instructor decided to offer courses on Udemy. First, it's very rare to find courses on more advanced subject matter. As a software developer, I love learning but am often disappointed that Udemy largely has beginner-oriented material (understandably so). Then there's the CSEPracticals courses. I learned a LOT here. This is some valuable, real world stuff. It's incredibly useful to learn how multi-threading in C is actually applied in real world use cases and to implement these use cases on your own. The instruction was clear, the information valuable. The code samples are plentiful. The instructor is clearly very knowledgeable about networking and so the course examples tend to lean in that direction. I'm very impressed and had a LOT of fun with this course. I can't wait to check out the other ones by CSEPracticals.
I have just finished this course, and I cannot recommend it more. Its an excellent course on multi-threading and achieves exactly what it intends to from the start. Some features of this course 1) You write a lot of code, and you become more confident in using the pthread library ( along with some other things, I learned how important proper use of assert function can be). 2) Abishekh goes in depth on different synchronization method and shows you have to build them using fundamental tools like mutex and condition variables. This gives you a lot of confidence, and you can build your own in future in case your chosen OS or library does not have those built-in. This in my opinion is the biggest strength of the course. 3) The team of CSE Practicals is very responsive and you can expect to get a response on your queries within a very reasonable time-frame. Ongoing to the course sequel now. Ovais
FAQ
FAQ area empty
Course curriculum
Chương 1 Getting Started With Multi-Threading 12 bài · 49 phút
- Agenda and Prerequisites Học thử 4:30
- What is a Thread ? Học thử 3:25
- Join Telegram Group Học thử 0:13
-
Code Access for this Course 0:58
-
Hello World Ex - Part 1 9:03
-
Hello World Ex - Part 2 3:50
-
Race Condition on Thread Creation 4:19
-
Thread Termination 4:09
- Main( ) thread termination Học thử 2:08
- Resource Sharing Học thử 5:46
- Thread Stack Memory Mgmt Học thử 5:12
- Thread Scheduling Học thử 5:39
Chương 2 Concurrency Vs Parallelism (Theory Section) 12 bài · 49 phút
-
Understanding Concurrency (Analogy) 4:41
-
Understanding Parallelism (Analogy) 2:28
-
Understanding Singularism (Analogy) 4:07
-
Analogy <--> Multithreading World (Mapping) 2:03
-
Multithreading Environment 12:30
-
Why do we need Concurrency ? 5:05
-
Concurrent Process Design - Example 1 5:14
-
Concurrent Process Design - Example 2 3:33
-
Why Threads are called Light Weighted Processes ? 4:03
-
Overlapping and Non-Overlapping Work 3:02
-
Conclusion and Summarization 2:29
-
Probable Interview Questions
Chương 3 Joinable and Detached Threads 7 bài · 39 phút
-
Joinable Threads 6:12
-
Detached Threads 2:31
-
Joinable Threads in Action 16:21
-
Whom to Join ? 3:49
-
Implementing Map-Reduce Algorithm - Problem Statement 8:09
-
When to Create Joinable/Detached Thread ? 1:48
-
Practice Assignment
Chương 4 Inter Thread Communication 4 bài · 16 phút
-
Inter Thread Communication 3:57
-
Transfer of Computation 5:14
-
Transfer of Computation - Example 5:36
-
Opening Gates to Publisher Subscriber Model 1:30
Chương 5 Let us go on Vacations ! yaay ! 1 bài · 1 phút
-
Vacations ! Dont miss it ! 1:21
Chương 6 Notification Chains 14 bài · 1 giờ 5 phút
-
Notification Chains - Introduction 2:58
-
NFC - Pictorial Representation 7:28
-
NFC - Data Structure 4:32
-
NFC Implementation 7:55
-
Assignment - NFC Some Enhancement
-
Real World - Problem Statement On NFC - Publisher Subscriber Model 4:04
-
Setting up a Data Source 4:25
-
Setting Up the Publisher 7:16
-
Setting up the Subscriber 8:34
-
Subscription and Notification 2:03
-
Mandatory Assignment
-
Implementing Subscription 7:23
-
Implementing Notification 5:27
-
Final Demo ! 2:54
Chương 7 Thread Cancellation - Asynchronous 10 bài · 50 phút
-
Why Thread Cancellation ? 2:27
-
Understanding Thread Cancellation - Asynchronous Mode 5:30
-
Asynchronous Thread Cancellation - Demo Base Program 4:51
-
Asynchronous Cancellation - Code Changes 6:48
-
Thread Resource Leaking Problem 4:07
-
Data Structure Corruption - Invariants 5:23
-
Thread Cancellation Causing Deadlocks 2:09
-
Handling Resource Leaking on Thread Cancellation 6:25
-
Code Changes and Demo 4:40
-
Cleanup handlers Usage 7:39
Chương 8 Thread Cancellation - Deferred 2 bài · 12 phút
-
Understanding Deferred Cancellation 5:04
-
Deferred Cancellation Implementation 6:29
Chương 9 Listener Threads 6 bài · 25 phút
-
Listener Threads - Responsibility Delegation 7:12
-
Preparation of Implementation 3:36
-
Network APIs and Demo 3:46
-
Multi - Listener Application Implementation 3:46
-
Listener Thread - Quick Code Walk 6:31
-
Assignment - Let's Add on
Chương 10 Thread Synchronization - Getting Started 11 bài · 1 giờ
-
Thread Synchronization 7:51
-
Critical Section 4:20
-
Mutexes 2:57
-
How Mutex Works ? 8:39
-
Mutex Rules 4:06
-
Mutex Locking - Code Locking 4:02
-
Mutex Locking - Data Locking 13:32
-
Mutex Posix APIs 1:35
-
Mutexes in Action - Problem Statement 9:42
-
Mutexes in Action - Deploying Mutual Exclusion 3:35
-
Assignment on Mutexes & CS
Chương 11 Deadlocks 3 bài · 14 phút
-
Deadlocks 4:53
-
Four Necessary Conditions for Deadlocks 3:26
-
Mutex Lock Ordering Causing Deadlocks 5:50
Chương 12 Condition Variables 17 bài · 2 giờ 7 phút
-
Getting Started with CV 3:29
-
Understanding Condition Variables 7:28
-
Condition Variables Vs Mutex 7:06
-
Using Condition Variables - Wait & Signal 12:28
-
Assignment - Condition Variables
-
Producer Consumer Threads Synchronization 12:38
-
What is Spurious Wake Up ? 5:08
-
Spurious Wake Up - Producer Consumer Threads Synchronization 10:04
-
Assignment Questions
-
Understanding Pseudocodes through Real World Analogy 7:43
-
Thread specific Vs Resource Specific CV 8:07
-
Broadcasting a CV 8:38
-
Lab Time - Implement Producer Consumer 8:04
-
Question Program Setup 14:16
-
Producer Consumer - Solution Implementation Step by Step 15:21
-
Assignment - Test your Understanding
-
Avoid Spurious Wake with Multiple Conditions 6:43
Chương 13 Dining Philosopher Problem 8 bài · 53 phút
-
Problem Statement Explanation 7:56
-
Data Structure Setup 4:03
-
Assignment Program Setup 11:36
-
Solution - RoadMap 3:19
-
Solution Part 1 : Implementing philosopher_fn( ) 3:35
-
Solution Part 2 : Implementing philosopher_release_both_spoons( ) 7:24
-
Solution Part 3 : Implementing philosopher_get_access_both_spoons( ) 11:03
-
Solution Part 4 : Test and Conclude 4:14
Chương 14 Thread Barriers 6 bài · 41 phút
-
Thread Barriers Introduction 3:49
-
Thread Barrier Functioning 6:58
-
Thread Barrier Data Structures 8:37
-
Thread Barrier APIs 3:26
-
Thread Barrier Wait ( ) Implementation 12:23
-
Thread Barrier Demo 5:54
Chương 15 Spin Locks 1 bài · 10 phút
-
Spin Locks 10:16
Chương 16 Semaphores 6 bài · 39 phút
-
Introduction & Analogy 4:00
-
Semaphore Vs Mutex 8:01
-
Semaphore APIs and Working Example 11:12
-
Semaphore - Hello World Example 9:29
-
Strict Alternation Problem 6:01
-
Semaphore based Simple Problems
Chương 17 Semaphores - Internal Implementation 6 bài · 33 phút
-
Semaphores Internal Implementation 1:19
-
Understanding Semaphore Counter Variable 6:56
-
Semaphore Implementation 10:01
-
Types of Semaphores 3:10
-
Strong and Weak Semaphores 11:18
-
Assignment Questions on Semaphores
Chương 18 Recursive Mutexes/Locks 6 bài · 44 phút
-
What is Recursive Mutex ? 6:10
-
Practical Scenario of Using Reclusive Locks 7:03
-
Assignment - Rec Mutex Internal Implementation 4:19
-
Recursive Mutex - Data Structure Definition 5:06
-
Rec_mutex_lock() API Implementation 11:46
-
Rec_mutex_unlock() API Implementation 9:09
Chương 19 Read-Write Locks 11 bài · 1 giờ 17 phút
-
What in this Section ? 1:00
-
Understanding Read/Write Locks 10:39
-
POSIX APIs 1:36
-
Demo Example Program 10:12
-
RW Lock Self Implementation - Begin 5:47
-
Custom RW LOCK Data Structure 6:29
-
Read Lock API Implementation 17:13
-
Write Lock API Implementation 12:12
-
RW lock Unlock API Implementation 11:36
-
Assignment - Read / Write Locks
-
Validating our RW lock Implementation
Chương 20 Implement Thread Safe Highly Concurrent CRUD Operations 16 bài · 2 giờ 20 phút
-
CRUD Operations - Introduction 3:56
-
Performance Aspects with Wider Locks 6:52
-
CRUD Goals 6:10
-
Tools We need to Implement Thread Safe and Highly Concurrent CRUD Operations 4:17
-
Understanding Reference Counting 15:06
-
Reference Count APIs 7:12
-
Ref Count Usage Examples 13:11
-
CRUD : Locking Rules 11:04
-
CRUD : Algorithm for READ & UPDATE ( WRITE ) Operation 10:29
-
Setting Up Demo Example Project 3:46
-
CRUD : Algorithm for READ & UPDATE Operation - Implementation 8:23
-
CRUD : Algorithm for CREATE Operation 4:38
-
CRUD : Algorithm for DELETE Operation 11:19
-
CRUD Example Discussions 16:26
-
Final Demo - Crud_algo.c 13:09
-
What about Deadlocks ? Can it Happen in our CRUD solution ? 4:02
Chương 21 Appendix A : Glue Based Linked List 10 bài · 46 phút
-
Introduction 3:35
-
GLThread Definition 4:19
-
Pictorial Difference 4:53
-
Structure Field Offset 7:37
-
Node Insertion 3:41
-
Iteration 3:15
-
Node Removal 1:18
-
Code Walk - Demo 6:24
-
Traditional Linked List Problems 5:39
-
GLThread Benefits 4:54
Chương 22 Bonus - Get some Candies ! 1 bài · 1 phút
-
Get My Courses for Free 1:16
Requirment
-
C language is MUST
-
Linux Operating Systems
-
Zeal to learn and excel
-
Enthusiasm to write lots of Code
Outcomes
-
MultiThreading Fundamentals
-
Concurrency
-
Mutual Exclusion Vs Atomocity
-
Thread Synchronization Techniques
-
Writing Thread Safe Codes
-
Mutexes, Semaphores
-
Signaling and Wait
-
Interview Questions
0 Student
3 Courses
0 review