Learn Multithreading with Modern C++

Comprehensive introduction to multithreading in C++. Unleash the full power of modern multi-processor hardware!

  • 0.0 (0 Reviews)
  • 0 Students
  • 125 Lessons
  • James Raynard

Course Overview

Multithreading is used in many areas of computing, including graphics processing, machine learning and Internet stores. An understanding of threads is essential to make full use of the capabilities of modern hardware.

C++ now provides direct support for threads, making it possible to write portable multithreaded programs which have well-defined behaviour, without requiring any external libraries.

This course thoroughly covers the basics of threading, and will prepare you for more advanced work with threads. Source code is provided for all the examples. No previous knowledge of threading is required, but you should be comfortable with programming in C++ at an intermediate level, using "Modern" features such as smart pointers and move semantics.

We start with the concepts of multithreading and how threading is implemented at the processor level. We then learn how to launch threads in C++, followed by looking at the problems which can occur with multiple threads and how to avoid them.

C++ provides tools which allow us to work at a higher level of abstraction than system threads which share data; we cover condition variables and promises with futures. We will also look at asynchronous, lock-free and parallel programming, including atomic variables and the parallel algorithms in C++17. We will finish the course by implementing a concurrent queue and thread pool, which will bring together the material you have learnt. A final section, currently under construction, will cover the concurrency features added in C++20.

There are downloadable exercises for each video, with solutions, so you can check your understanding as you learn, gaining familiarity and confidence with the material. There are also some optional assignments, which are more challenging.

I will be actively supporting the course. I will respond promptly if you have any questions or experience difficulties with the course content. Please feel free to use the Q&A feature or alternatively you can send me a private message.

See more

FAQ

FAQ area empty

Course curriculum

13 chương 125 bài học 10 giờ 3 phút 7 bài học thử miễn phí
Chương 1 Introduction
Chương 2 Review of Modern C++ Features
Chương 3 Introduction to Concurrency
  • Concurrency Introduction 3:06
  • Concurrency Introduction
  • Concurrency Motivation 9:04
  • Concurrency Motivation
  • Concurrency Overview 4:26
  • Concurrency Overview
  • Threaded Program Structure 2:23
  • Threaded Program Structure
  • A Brief History of C++ Concurrency 3:37
  • A Brief History of C++ Concurrency
  • Launching a Thread 8:15
  • Launching a Thread
  • Launching a Thread
  • Thread Function with Arguments 7:11
  • Thread Function with Arguments
  • Computer with Single Processor 8:37
  • Computer with Single Processor
  • Computer with Single Processor and Cache 4:30
  • Computer with Single Processor and Cache
  • Computer with Multiple Processors 7:10
  • Computer with Multiple Processors
  • Synchronization Issues 4:07
  • Synchronization Issues
Chương 4 Getting Started with Threads
  • System Thread Interface 6:54
  • System Thread Interface
  • The C++ Thread Class 6:08
  • The C++ Thread Class
  • Managing a Thread 6:57
  • Multiple Threads 7:30
  • Data Races 4:39
  • Data Races
  • Data Race Consequences 10:48
Chương 5 Working with shared data
  • Critical Sections 2:25
  • Mutex Introduction 3:22
  • Mutex Class 5:59
  • Internally Synchronized Class 4:11
  • Lock Guard 7:26
  • Unique Lock 6:16
  • Timeouts and Mutexes 8:58
  • Multiple Reader,Single Writer 5:46
  • Shared Mutexes 7:40
  • Shared Data Initialization 8:15
  • Thread-local Data 3:30
  • Lazy initialization 3:15
  • Double-checked Locking 5:39
  • Deadlock 4:31
  • Deadlock Practical 7:46
  • Deadlock Avoidance 9:04
  • Deadlock Avoidance Practical 5:14
  • Livelock 5:12
  • Livelock Practical 3:18
  • Livelock
  • Mutex Conclusion 4:48
Chương 6 Thread Synchronization
  • Thread Coordination 2:10
  • Thread Coordination Practical 8:41
  • Condition Variables 6:35
  • Condition Variables
  • Condition Variables with Predicate 7:43
  • Condition Variable Practical 4:59
  • Futures and Promises Overview 4:22
  • Future and Promise Classes 3:33
  • Futures and Promises Examples 6:27
  • Promises with Multiple Waiting Threads 3:37
Chương 7 Atomic Types
  • Integer Operations and Threads 7:39
  • Atomic Types 5:19
  • Double-checked Locking Reprise
  • Atomic Operations 8:33
  • Lock-free Programming 4:18
  • Lock-free Programming Continued 7:14
  • Lock-free Programming Practical 3:58
  • Lock-free Programming Practical Continued 7:19
Chương 8 Asynchronous Programming
  • Asynchronous Programming 6:50
  • Packaged Task 7:05
  • Packaged Task Assignment
  • The async Function 5:13
  • The async Function and Launch Options 6:13
  • Choosing a Thread Object 5:47
Chương 9 Parallelism
  • Parallelism Overview 5:00
  • Parallelism Overview Continued 8:00
  • Data Parallelism Practical 5:51
  • Standard Algorithms Overview 8:32
  • Execution Policies 11:24
  • Algorithms and Execution Policies 4:36
  • New Parallel Algorithms 8:09
  • New Parallel Algorithms Continued 5:38
  • Parallel Algorithms Practical 4:02
  • New Parallel Algorithms Conclusion 4:21
Chương 10 Practical Data Structures for Concurrent Programming
  • Data Structures and Concurrency 7:37
  • Shared Pointer 9:03
  • Monitor Class 5:30
  • Monitor Class Continued 11:04
  • Semaphore 9:23
  • Concurrent Queue 9:42
  • Concurrent Queue with Condition Variable 5:06
  • Thread Pools 6:40
  • Thread Pool Basic Implementation 5:57
  • Thread Pool with Multiple Queues 8:38
  • Thread Pool with Work Stealing 5:03
  • Thread Pool with Work Stealing Continued 10:08
Chương 11 Multithreading in C++20 (under development)
  • Joining Thread 5:41
  • Co-operative Cancellation 10:19
  • Co-operative Cancellation and Joining Thread 5:08
  • Co-operative Cancellation and Condition Variables 8:04
  • Co-operative Cancellation and Condition Variables Practical 10:21
  • Co-operative Cancellation with Callback 12:25
Chương 12 Multithreading Resources
  • Recommended Book
  • Multithreading libraries
Chương 13 And finally...
  • Bonus Material

Requirment

  • Familiarity with Advanced Modern C++ features such as lambda expressions and move semantics

  • Access to C++11 compiler (C++14 preferred.) Parallel algorithms require C++17

  • Intended for students who have taken my courses "Learn Advanced Modern C++" or "Update to Modern C++"

  • Proficiency in English (B2 level, preferably C1)

Outcomes

  • How to write portable multi-threaded code in C++

  • Basic principles of multi-threading which will be applicable in all languages

  • Understanding of concurrency

  • Knowledge of C++17 parallel algorithms

Instructor

...
James Raynard

0.0

  • ... 0 Student
  • ... 2 Courses
  • ... 0 review

View Details

Reviews

Rate this course :

Remove all