Part A Multithreading Thread Synchronization Pthreads

Linux POSIX Threads ( Pthreads ), thread Synchronization, Operating System Concepts, C/C++ programming with Projects
Part A Multithreading Thread Synchronization Pthreads
File Size :
6.62 GB
Total length :
16h 37m

Category

Instructor

Abhishek CSEPracticals

Language

Last update

5/2023

Ratings

4.2/5

Part A Multithreading Thread Synchronization Pthreads

What you’ll learn

MultiThreading Fundamentals
Concurrency
Mutual Exclusion Vs Atomocity
Thread Synchronization Techniques
Writing Thread Safe Codes
Mutexes, Semaphores
Signaling and Wait
Interview Questions

Part A Multithreading Thread Synchronization Pthreads

Requirements

C language is MUST
Linux Operating Systems
Zeal to learn and excel
Enthusiasm to write lots of Code

Description

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 ThreadsThread Creation & TerminationRace condition on Thread CreationPassing Argument to Thread FunctionStack Memory Mgmt for Multi-threaded ProgramsThread Scheduling2. Understanding Concurrency and ParallelismSinglularism Vs Concurrency Vs ParallelismConcurrent Process Design – 2 ExamplesThreads as Light Weighted ProcessOverlapping and Non-Overlapping Work3. Joinable and Detached ThreadsJoinable Vs Detached ThreadsHow to Join a threadWhom to Join?Sample – Map-Reduce Program4. Inter Thread CommunicationUnderstanding Callbacks and Function PointersBest way to implement ITCImplementing Notification ChainsA Publisher Subscriber ModelHow to Subscribe/UnSubscribeHow to send Notification to Subscribers                5. Asynchronous Thread CancellationThread CancellationAsynchronous and Deferred Thread CancellationProblem with Async Thread CancellationResource LeakingInvariantsDeadlocksConcept of Thread Cleanup HandlersPrevent Resource Leaking                                        Data Structure Corruption – InvariantsCancellation causing Deadlocks6. Deferred CancellationUnderstanding Deferred CancellationImplementation7. Listener Threads – Responsibility DelegationWhy Listener threads?Designing Listener threadsCode Changes and Demo                                Cancellation of blocked Threads8. Thread SynchronizationCritical SectionMutex RulesMutex LockingMutex Locking – Code LockingMutex Locking – Data LockingMutex based APIsMutexes in Action9. DeadlocksWhat are deadlocks and why do they happen?Necessary conditions for Deadlock to happenMutex lock Ordering Causing Deadlocks                             10. Condition VariablesUnderstanding CVCV Vs MutexWait( )  &  Signal( )Producer-Consumer Thread SynchronizationSpurious Wake UpsThread Vs Resource Specific CVBroadcasting a CV Implement Producer-Consumer Problem            11. Dining Philosopher ProblemProblem DescriptionData Structures Setup                           Assignment Program SetupFlowchart/Algorithm DiscussionFinal Implementation (Step by Step )12. SemaphoresIntroductionSemaphores Vs Mutexes  How Semaphore work Strict Alternation ProblemSemaphore ImplementationSemaphore TypesStrong and Weak SemaphoresListing Upcoming Advanced Multi-Threading Topics for Sequel Course ( Under Progress )= = = = = = = = = =  = = = = = =  = = = = = = 1. Pausing and Resuming Threads 2. Thread Pools3. Standard Problems – Reader/Writer Problem4. Implementing Thread Barriers5. Implementing Thread Monitors6. Solving Sync Problems using Monitors7. Deadlock Detection and Prevention8. Wait  Queues9. Implement Timers using Threads10. How to fork a multi-threaded process11. Process Synchronization using Named Semaphores Happy Learning.Featured ReviewThis 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

Overview

Section 1: Getting Started With Multi-Threading

Lecture 1 Agenda and Prerequisites

Lecture 2 What is a Thread ?

Lecture 3 Join Telegram Group

Lecture 4 Code Access for this Course

Lecture 5 Hello World Ex – Part 1

Lecture 6 Hello World Ex – Part 2

Lecture 7 Race Condition on Thread Creation

Lecture 8 Thread Termination

Lecture 9 main( ) thread termination

Lecture 10 Resource Sharing

Lecture 11 Thread Stack Memory Mgmt

Lecture 12 Thread Scheduling

Section 2: Concurrency Vs Parallelism (Theory Section)

Lecture 13 Understanding Concurrency (Analogy)

Lecture 14 Understanding Parallelism (Analogy)

Lecture 15 Understanding Singularism (Analogy)

Lecture 16 Analogy <–> Multithreading World (Mapping)

Lecture 17 Multithreading Environment

Lecture 18 Why do we need Concurrency ?

Lecture 19 Concurrent Process Design – Example 1

Lecture 20 Concurrent Process Design – Example 2

Lecture 21 Why Threads are called Light Weighted Processes ?

Lecture 22 Overlapping and Non-Overlapping Work

Lecture 23 Conclusion and Summarization

Section 3: Joinable and Detached Threads

Lecture 24 Joinable Threads

Lecture 25 Detached Threads

Lecture 26 Joinable Threads in Action

Lecture 27 Whom to Join ?

Lecture 28 Implementing Map-Reduce Algorithm – Problem Statement

Lecture 29 When to Create Joinable/Detached Thread ?

Section 4: Inter Thread Communication

Lecture 30 Inter Thread Communication

Lecture 31 Transfer of Computation

Lecture 32 Transfer of Computation – Example

Lecture 33 Opening Gates to Publisher Subscriber Model

Section 5: Let us go on Vacations ! yaay !

Lecture 34 Vacations ! Dont miss it !

Section 6: Notification Chains

Lecture 35 Notification Chains – Introduction

Lecture 36 NFC – Pictorial Representation

Lecture 37 NFC – Data Structure

Lecture 38 NFC Implementation

Lecture 39 Real World – Problem Statement On NFC – Publisher Subscriber Model

Lecture 40 Setting up a Data Source

Lecture 41 Setting Up the Publisher

Lecture 42 Setting up the Subscriber

Lecture 43 Subscription and Notification

Lecture 44 Implementing Subscription

Lecture 45 Implementing Notification

Lecture 46 Final Demo !

Section 7: Thread Cancellation – Asynchronous

Lecture 47 Why Thread Cancellation ?

Lecture 48 Understanding Thread Cancellation – Asynchronous Mode

Lecture 49 Asynchronous Thread Cancellation – Demo Base Program

Lecture 50 Asynchronous Cancellation – Code Changes

Lecture 51 Thread Resource Leaking Problem

Lecture 52 Data Structure Corruption – Invariants

Lecture 53 Thread Cancellation Causing Deadlocks

Lecture 54 Handling Resource Leaking on Thread Cancellation

Lecture 55 Code Changes and Demo

Lecture 56 Cleanup handlers Usage

Section 8: Thread Cancellation – Deferred

Lecture 57 Understanding Deferred Cancellation

Lecture 58 Deferred Cancellation Implementation

Section 9: Listener Threads

Lecture 59 Listener Threads – Responsibility Delegation

Lecture 60 Preparation of Implementation

Lecture 61 Network APIs and Demo

Lecture 62 Multi – Listener Application Implementation

Lecture 63 Listener Thread – Quick Code Walk

Section 10: Thread Synchronization – Getting Started

Lecture 64 Thread Synchronization

Lecture 65 Critical Section

Lecture 66 Mutexes

Lecture 67 How Mutex Works ?

Lecture 68 Mutex Rules

Lecture 69 Mutex Locking – Code Locking

Lecture 70 Mutex Locking – Data Locking

Lecture 71 Mutex Posix APIs

Lecture 72 Mutexes in Action – Problem Statement

Lecture 73 Mutexes in Action – Deploying Mutual Exclusion

Section 11: Deadlocks

Lecture 74 Deadlocks

Lecture 75 Four Necessary Conditions for Deadlocks

Lecture 76 Mutex Lock Ordering Causing Deadlocks

Section 12: Condition Variables

Lecture 77 Getting Started with CV

Lecture 78 Understanding Condition Variables

Lecture 79 Condition Variables Vs Mutex

Lecture 80 Using Condition Variables – Wait & Signal

Lecture 81 Producer Consumer Threads Synchronization

Lecture 82 What is Spurious Wake Up ?

Lecture 83 Spurious Wake Up – Producer Consumer Threads Synchronization

Lecture 84 Understanding Pseudocodes through Real World Analogy

Lecture 85 Thread specific Vs Resource Specific CV

Lecture 86 Broadcasting a CV

Lecture 87 Lab Time – Implement Producer Consumer

Lecture 88 Question Program Setup

Lecture 89 Producer Consumer – Solution Implementation Step by Step

Lecture 90 Avoid Spurious Wake with Multiple Conditions

Section 13: Dining Philosopher Problem

Lecture 91 Problem Statement Explanation

Lecture 92 Data Structure Setup

Lecture 93 Assignment Program Setup

Lecture 94 Solution – RoadMap

Lecture 95 Solution Part 1 : Implementing philosopher_fn( )

Lecture 96 Solution Part 2 : Implementing philosopher_release_both_spoons( )

Lecture 97 Solution Part 3 : Implementing philosopher_get_access_both_spoons( )

Lecture 98 Solution Part 4 : Test and Conclude

Section 14: Thread Barriers

Lecture 99 Thread Barriers Introduction

Lecture 100 Thread Barrier Functioning

Lecture 101 Thread Barrier Data Structures

Lecture 102 Thread Barrier APIs

Lecture 103 Thread Barrier Wait ( ) Implementation

Lecture 104 Thread Barrier Demo

Section 15: Spin Locks

Lecture 105 Spin Locks

Section 16: Semaphores

Lecture 106 Introduction & Analogy

Lecture 107 Semaphore Vs Mutex

Lecture 108 Semaphore APIs and Working Example

Lecture 109 Semaphore – Hello World Example

Lecture 110 Strict Alternation Problem

Section 17: Semaphores – Internal Implementation

Lecture 111 Semaphores Internal Implementation

Lecture 112 Understanding Semaphore Counter Variable

Lecture 113 Semaphore Implementation

Lecture 114 Types of Semaphores

Lecture 115 Strong and Weak Semaphores

Section 18: Recursive Mutexes/Locks

Lecture 116 What is Recursive Mutex ?

Lecture 117 Practical Scenario of Using Reclusive Locks

Lecture 118 Assignment – Rec Mutex Internal Implementation

Lecture 119 Recursive Mutex – Data Structure Definition

Lecture 120 rec_mutex_lock() API Implementation

Lecture 121 rec_mutex_unlock() API Implementation

Section 19: Read-Write Locks

Lecture 122 What in this Section ?

Lecture 123 Understanding Read/Write Locks

Lecture 124 POSIX APIs

Lecture 125 Demo Example Program

Lecture 126 RW Lock Self Implementation – Begin

Lecture 127 Custom RW LOCK Data Structure

Lecture 128 Read Lock API Implementation

Lecture 129 Write Lock API Implementation

Lecture 130 RW lock Unlock API Implementation

Section 20: Implement Thread Safe Highly Concurrent CRUD Operations

Lecture 131 CRUD Operations – Introduction

Lecture 132 Performance Aspects with Wider Locks

Lecture 133 CRUD Goals

Lecture 134 Tools We need to Implement Thread Safe and Highly Concurrent CRUD Operations

Lecture 135 Understanding Reference Counting

Lecture 136 Reference Count APIs

Lecture 137 Ref Count Usage Examples

Lecture 138 CRUD : Locking Rules

Lecture 139 CRUD : Algorithm for READ & UPDATE ( WRITE ) Operation

Lecture 140 Setting Up Demo Example Project

Lecture 141 CRUD : Algorithm for READ & UPDATE Operation – Implementation

Lecture 142 CRUD : Algorithm for CREATE Operation

Lecture 143 CRUD : Algorithm for DELETE Operation

Lecture 144 CRUD Example Discussions

Lecture 145 Final Demo – Crud_algo.c

Lecture 146 What about Deadlocks ? Can it Happen in our CRUD solution ?

Section 21: Appendix A : Glue Based Linked List

Lecture 147 Introduction

Lecture 148 GLThread Definition

Lecture 149 Pictorial Difference

Lecture 150 Structure Field Offset

Lecture 151 Node Insertion

Lecture 152 Iteration

Lecture 153 Node Removal

Lecture 154 Code Walk – Demo

Lecture 155 Traditional Linked List Problems

Lecture 156 GLThread Benefits

Section 22: Bonus – Get some Candies !

Lecture 157 Get My Courses for Free

Engineering graduates & post-graduates,Working professionals and Job Seekers,Free lancers , System Engineers, Developers

Course Information:

Udemy | English | 16h 37m | 6.62 GB
Created by: Abhishek CSEPracticals

You Can See More Courses in the IT & Software >> Greetings from CourseDown.com

New Courses

Scroll to Top