Introduction to C++ Concurrency LiveLessonsintroduces the principles of concurrency by creating and running simple programs. It not only shows how to write correct code, but also discusses the dangers and pitfalls of concurrency such as data races, deadlocks, livelocks, and more.
C++ is undergoing rapid changes to support concurrent and parallel programming. The 2011 Standard introduced a new multicore memory model, atomic variables, threads, asynchronous tasks, and synchronization primitives. Work is being done to add even more support in the future. It’s no longer enough to just learn some new syntax and library API. There’s a need to gain a deeper understanding of the theory and mechanics of concurrency, and Bartosz leads you to that understanding in this video training.
About the Instructor
Bartosz Milewskiis the president of Reliable Software, a company that creates high-quality productivity tools for programmers. His work has been widely published in major journals over the past several years, and he is the author of C++ In Action(Addison-Wesley, 2001). During his eight years at Microsoft, he was the development lead of the Content Index component of Windows 2000. He has taught C++ programming at the University of Wroclaw in Poland and holds a Ph.D. in theoretical physics from the University of Wroclaw. He is also involved with the University of Washington, where he participates in graduate courses and seminars in computer science. He is a member of the advisory board at UW Professional and Continuing Education, advising on C/C++ courses.
What You Will Learn
- Understanding the principles of concurrency and parallelism
- Understanding the principles of synchronization
- Writing multithreaded code
- Understanding common pitfalls of concurrent programming
Who Should Take This Course
- Any C++ programmer with some programming experience who is interested in the exciting topic of concurrency
- Familiarity with the C++ language
Lesson 1, "Running an Interactive Demo," shows you the difference that concurrency can make in the behavior of an interactive application. You learn about latency and throughput and the difference between concurrency and parallelism.
Lesson 2, "Starting and Joining Threads," teaches you how to start a thread and what fork/join parallelism is. It also shows you how to pass arguments to threads and talks about thread construction and destruction.
Lesson 3, "Using Threads to Return Values," teaches you how to return data from threads using promises and futures. It shows you how to use async to start threads and tasks and also discusses task-based parallelism.
Lesson 4, "Passing Data Between Threads," teaches you more about passing data between threads. You learn what a data race is and how to avoid it. The lesson describes different ways of passing data that don't introduce data races. This knowledge is then used to implement a program that lists directories in parallel.
Lesson 5, "Working with Mutexes and Locks," demonstrates how to use a mutex and a critical section to protect shared data from races. You learn the basics of the ownership system, which is a systematic way of preventing data races in concurrent programs. You also learn about the limitations of mutexes and locks and their lack of scalability and composability. You see how easy it is to create deadlocks and how to protect your program from them.
Lesson 6, "Using Condition Variables to Communicate," teaches you about the ways threads can communicate with each other. You see a polling example and the use of condition variables. The lesson discusses the client/server architecture, message passing, and the actor model. It also implements a message passing queue and talks about producers and consumers.
Lesson 7, "Understanding the Dangers of Atomic Variables," teaches you about the C++ memory model. It explains what sequential consistency is and how it can be broken. You learn about atomic variables and the dangers of lock-free programming. You also see an example of atomicity violation.
Lesson 8, "Looking into the Future of C++ Concurrency," teaches you about the future of C++ concurrency. It discusses the new ways of composing futures, asynchronous operations, and resumable functions. You also get a taste of programming using software transactional memory.
About LiveLessons Video Training
LiveLessons Video Training series publishes hundreds of hands-on, expert-led video tutorials covering a wide selection of technology topics designed to teach you the skills you need to succeed. This professional and personal technology video series features world-leading author instructors published by your trusted technology brands: Addison-Wesley, Cisco Press, IBM Press, Pearson IT Certification, Prentice Hall, Sams, and Que. Topics include IT Certification, Programming, Web Development, Mobile Development, Home and Office Technologies, Business and Management, and more. View all LiveLessons on InformIT at http://www.informit.com/livelessons.
Table of Contents
- Lesson 1: Running an Interactive Demo
- Lesson 2: Starting and Joining Threads
- Lesson 3: Using Threads to Return Values
- Lesson 4: Passing Data Between Threads
- Lesson 5: Working with Mutexes and Locks
- Lesson 6: Using Condition Variables to Communicate
Lesson 7: Understanding the Dangers of Atomic Variables
- Learning Objectives 00:00:28
- 7.1 Understand sequential consistency 00:07:27
- 7.2 Get acquainted with atomic variables 00:03:31
- 7.3 Use atomic variables and run into atomicity violations 00:12:02
- Lesson 8: Looking into the Future of C++ Concurrency
- Title: Introduction to C++ Concurrency LiveLessons (Video Training)
- Release date: October 2014
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780134031507