Complete Guide to Parallel and Concurrent Programming with C++

Complete Guide to Parallel and Concurrent Programming with C++

4h 4mIntermediate2025-01-24

Authors

Barron Stone

Barron Stone

Electrical Engineer

Course details

Parallel programming unlocks a program’s ability to execute multiple instructions simultaneously, increases the overall processing throughput, and is key to writing faster and more efficient applications. In this course, join instructors Barron and Olivia Chiu Stone as they introduce the basics of parallel and concurrent programming in C++, providing the foundational knowledge you need to write more efficient, performant code. Barron and Olivia explain concepts like threading and mutual exclusion in a fun and informative way, relating them to everyday activities you perform in the kitchen. To cement the ideas, they demo them in action using C++. Each lesson is short and practical, driving home the theory with hands-on techniques. By the end of this course, you'll be prepared to analyze the performance impact of parallel and concurrent programming techniques, evaluating the trade-offs and applying the appropriate programming patterns to optimize the throughput and efficiency of their C++ applications.

Skills covered

C++Programming FoundationsProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off

Concepts

Introduction

  • Learn parallel programming basics
  • What you should know
  • Installing Cygwin and Visual Studio Code

Parallel Computing Hardware

  • Sequential vs. parallel computing
  • Parallel computing architectures
  • Shared versus distributed memory

Threads and Processes

  • Thread versus process
  • Thread versus process - C++ demo
  • Concurrent versus parallel execution
  • Execution scheduling
  • Execution scheduling - C++ demo
  • Thread life cycle
  • Thread life cycle - C++ demo
  • Detached thread
  • Detached thread - C++ demo

Mutual Exclusion

  • Data race
  • Data race - C++ demo
  • Mutual exclusion
  • Mutual exclusion - C++ demo
  • Atomic objects - C++ demo

Locks

  • Recursive mutex
  • Recursive mutex - C++ demo
  • Try lock
  • Try lock - C++ demo
  • Shared mutex
  • Shared mutex - C++ demo

Liveness

  • Deadlock
  • Deadlock - C++ demo
  • Abandoned lock
  • Abandoned lock - C++ demo
  • Starvation
  • Starvation - C++ demo
  • Livelock
  • Livelock - C++ demo

Synchronization

  • Condition variable
  • Condition variable - C++ demo
  • Producer-consumer - C++ demo
  • Semaphore
  • Semaphore - C++ demo

Barriers

  • Race condition
  • Race condition - C++ demo
  • Barrier
  • Barrier - C++ demo
  • Latch - C++ demo

Asynchronous Tasks

  • Computational graph
  • Thread pool
  • Thread pool - C++ demo
  • Future
  • Future - C++ demo
  • Divide and conquer
  • Divide and conquer - C++ demo

Evaluating Parallel Performance

  • Speedup, latency, and throughput
  • Amdahl's law
  • Measure speedup
  • Measure speedup - C++ demo

Designing Parallel Programs

  • Partitioning
  • Communication
  • Agglomeration
  • Mapping

Challenge Problems

  • Welcome to the challenges
  • Challenge - Matrix multiply
  • Solution - Matrix multiply
  • Challenge - Merge sort
  • Solution - Merge sort
  • Challenge - Download images
  • Solution - Download images

Conclusion

  • Next steps
100,000 Toman