Companies Home Search Profile

C++ Concurrency : C++ Atomics and memory model Deep Dive

Focused View

RougeNeuron Academy

3:05:40

128 View
  • 1. Introduction.mp4
    01:12
  • 2. C++ Memory Model from standard to production.mp4
    07:51
  • 1. Memory Model guarantees.mp4
    03:19
  • 2. External factors affecting the program execution workflow of a C++ program.mp4
    06:44
  • 3. Sequential conisistency definition in multithreaded applications.mp4
    01:15
  • 4. Race condition in concurrency with regard to sequential consistency.mp4
    02:56
  • 5. SC-DRF Sequential Concistency (Data Race Free).mp4
    03:02
  • 6. Role of Modern C++ memory model in guarantee of SC-DRF.mp4
    04:56
  • 1. Simple optimization example.mp4
    04:41
  • 2. Code walkthrough of issue with the concurrent execution of multithreaded code.mp4
    02:50
  • 3. Optimization example with single threaded code.mp4
    03:10
  • 4. Summary and general tips around optimization of concurrent code in modern C++.mp4
    02:43
  • 1. Thinking in Transactions.mp4
    04:12
  • 2. The concept of critical section in concurrent and multithreaded applications.mp4
    04:13
  • 3. Concurrency considerations while moving code out of critical sections.mp4
    02:21
  • 4. Concurrency considerations while moving code inside of critical sections.mp4
    02:45
  • 5. Concept of acquire and release barriers in concurrency memory models.mp4
    02:53
  • 6. Considerations while choosing memory barriers while desiging for multithreading.mp4
    02:22
  • 7. A closer look at barriers and their relation to sequential consistency.mp4
    02:36
  • 8. Summary of memory barriers in concurrent applications.mp4
    03:08
  • 9. Impact of external optimizations on concurreny in modern C++ applications.mp4
    07:42
  • 1. Considerations while making performace measurements.mp4
    03:16
  • 2. Code experiment recommended to be performed by students..mp4
    00:48
  • 3. Code demonstartion of behavoir of atomic variables in practice.mp4
    05:07
  • 4. Do atomic variables wait for each other.mp4
    03:52
  • 5. False sharing in concurrency and multithreading.mp4
    02:59
  • 1. Introduction to compare and swap.mp4
    03:12
  • 2. Example of compare and swap.mp4
    02:28
  • 3. Pseudo code implementation of compare and exchange strong.mp4
    02:38
  • 4. Pseudo code implementation of compare exchange strong - faster.mp4
    03:37
  • 5. Compare and exchange weak - reason for spurios failures.mp4
    02:50
  • 1. Memory ordering basics in concurrency.mp4
    02:49
  • 2. Memory ordering nuances.mp4
    03:30
  • 3. Memory ordering and memory barriers in modern C++ language.mp4
    01:58
  • 4. Acquire Barrier in Modern C++.mp4
    02:57
  • 5. Release Barrier in Modern C++.mp4
    02:44
  • 6. Using acquire and release barriers for synchronization in multithreading.mp4
    03:20
  • 7. Using memory barriers as locks for efficient concurreny with modern C++.mp4
    02:53
  • 8. Bidirectional barriers in Modern C++ memory model.mp4
    02:18
  • 9. Why does compare and exchange in C++ have two parameters for memory ordering.mp4
    03:29
  • 1. Purpose of memory order in modern C++ concurrency memory model.mp4
    02:26
  • 2. Memory order as a tool to convey the C++ programmers intent.mp4
    02:38
  • 3. Memory order as programmers intent Example - 1.mp4
    03:16
  • 4. Memory order as programmers intent Example - 2.mp4
    01:45
  • 5. Memory order as programmers intent Example - 3.mp4
    01:05
  • 6. Memory barriers and performance implications.mp4
    03:36
  • 7. Sequential consistency and performance implications.mp4
    02:10
  • 8. Design and implementation guidelines for using stdatomics.mp4
    02:13
  • 9. When to use the atomics provided by the modern C++.mp4
    03:21
  • 1. Demo code Walkthrough of code sample being used to genreate results of tools.mp4
    03:08
  • 2. top utility output from Linux machine.mp4
    02:02
  • 3. htop utility output from Linux machine.mp4
    01:58
  • 4. perf utility output from Linux machine.mp4
    02:25
  • 5. gprof utility output from Linux machine.mp4
    01:43
  • 6. Intel Vtune utility output from Linux machine.mp4
    03:14
  • 7. Google Orbit utility output from Linux machine.mp4
    02:46
  • 8. Heaptrack utility output from Linux machine.mp4
    01:58
  • 9. Valgrind utility output from Linux machine.mp4
    01:31
  • 10. pahole utility output from Linux machine.mp4
    01:42
  • 11. Demonstration of false sharing in concurrent applications using modern C++.mp4
    04:13
  • 12. Other tools to explore gdb, gcore, visual studio code, debugging tools.mp4
    02:13
  • 13. Conclusion.mp4
    00:41
  • 14. [Bonus Lecture].html
  • Description


    C++ Memory model, concurreny, multithreading, performance, modern C++, C++11/14/17/20, gdb, valgrind, C++ atomics

    What You'll Learn?


    • Details of C++ memory model on which atomics are built
    • Concepts of memory barriers and memory order in C++
    • Using Modern C++ to design lock free algorithms with C++ atomics and memory model
    • Importance of sequential consistency in concurrency
    • Getting high performane using C++ memory model
    • External factors influencing performance of atomics
    • Tools to use in production while working with C++ in production

    Who is this for?


  • Intermediate C++ developers
  • C++ developers curious to understand the details of C++ memory model
  • C++ developers exploring options to write high performance concurrent applications in C++
  • More details


    Description

    This intermediate-level course is for C++ developers who want to deepen their understanding of memory models in C++. These are skills that tools like ChatGPT will take years to develop.


    Memory models are critical to modern software development, especially for concurrent programming. In this course, you will learn about the C++ memory model, including the Sequential Consistency-Data Race Free (SC-DRF) guarantee, which ensures that concurrent programs are well-defined and behave as expected.

    You will also learn about the different memory barriers used to enforce ordering constraints between memory accesses in a concurrent program. Finally, you will explore the impact of these barriers on performance and learn how to use them to optimize your code.

    In addition, you will delve into false sharing in caches, which can lead to significant performance degradation in multi-threaded programs. You will learn how to identify and avoid false sharing in your code.

    The course will also cover the performance of atomics in C++ and how to use them to implement efficient synchronization mechanisms in your programs. You will explore the different types of atomics available in C++, including lock-free and wait-free algorithms, and learn how to use them effectively.

    Finally, the course will provide an overview of performance analysis tools such as perf, Valgrind, Intel Vtune, Google Orbit, and gdb, which can be used to profile, debug, and optimize your code.

    Throughout the course, you will work on practical examples and hands-on exercises to reinforce your understanding of the material. By the end of this course, you will have a solid experience with memory models in C++ and be able to write correct, efficient, high-performance concurrent programs.


    Importance of memory models in Modern C++

    Learning memory models in modern C++ is crucial for developing high-performance applications and avoiding tricky bugs resulting from the misuse of concurrent programming constructs.

    Memory models define the rules for accessing shared memory in a multi-threaded program. As multi-core processors become more prevalent, writing concurrent programs that correctly and efficiently utilize shared memory is essential for achieving high performance.

    Misuse of memory models can lead to subtle and hard-to-find bugs that can be difficult to diagnose and fix. These bugs can result in incorrect behavior, data corruption, and crashes. Therefore, understanding memory models and the various synchronization primitives provided by modern C++ is essential for developing reliable concurrent programs.

    By learning memory models in modern C++, developers can write efficient and correct multi-threaded programs that fully utilize the available hardware resources. They can also avoid common pitfalls and tricky bugs arising from the incorrect use of memory models.

    In short, learning memory models in modern C++ is a critical skill for developers who want to develop high-performance applications that utilize multiple cores and avoid the common pitfalls and tricky bugs associated with concurrent programming.


    Evolution of the C++ Memory Model

    The C++ concurrency model has evolved significantly from C++11 to C++20, introducing new language features and library components that provide more powerful and flexible support for concurrent programming. Here are some of the significant changes that have occurred:

    1. C++11: C++11 introduced the first set of language-level concurrency features, including the std::thread class for creating and managing threads, mutexes and condition variables for synchronization, and atomic types for lock-free programming. C++11 also defined the Sequential Consistency-Data Race Free (SC-DRF) memory model, which guarantees correct behavior for well-synchronized programs.

    2. C++14: C++14 introduced several improvements to the concurrency features introduced in C++11, including new constructors and member functions for std::thread, support for heterogeneous lookup in concurrent containers, and enhancements to the std::atomic template.

    3. C++17: C++17 introduced several new concurrency features and enhancements, including support for parallel algorithms in the Standard Template Library (STL), structured bindings for returning multiple values from std::thread functions, and support for shared_mutex for shared read access and exclusive write access. C++17 also introduced a new memory model that provides stronger guarantees for atomic operations.

    4. C++20: C++20 builds on the concurrency features introduced in previous language versions and adds several new features and enhancements. These include the atomic_ref class, which provides a safer way to access shared variables without the need for explicit synchronization, improvements to the memory model to reduce the need for explicit fences and barriers, and enhancements to the coroutines library that make it easier to write asynchronous code.

    The evolution of the C++ concurrency model from C++11 to C++20 has provided developers with a more powerful and flexible set of tools for writing efficient and correct concurrent programs. The new language features and library components introduced in each version have addressed many of the challenges and limitations of earlier versions. In addition, they have made concurrent programming in C++ more accessible and easier to use.


    Who this course is for:

    • Intermediate C++ developers
    • C++ developers curious to understand the details of C++ memory model
    • C++ developers exploring options to write high performance concurrent applications in C++

    User Reviews
    Rating
    0
    0
    0
    0
    0
    average 0
    Total votes0
    Focused display
    RougeNeuron Academy
    RougeNeuron Academy
    Instructor's Courses
    About Instructor=============As a professional programmer with over 17 years of experience, I have a Master of Science degree in Electrical Engineering and a strong interest in Distributed Systems, Algorithms, Deep Learning, Performance, and Optimization. My journey as a programmer started during my school days with Logo software, continued with assembly, BASIC, and Pascal during high school, and concluded with interdisciplinary research as part of my M.S.Currently, I am working on online education initiatives and have experience adapting to dynamic and versatile startup work environments. I am comfortable working with open problem assignments and operating in an intrapreneurial role. Additionally, I have built big data (Spark) and data science (TensorFlow) skills that overlap with my M.S. curriculum and programming work experience.My thesis focused on a geographically distributed network of sensors synchronized with nanosecond precision, collecting data for a machine learning system to detect a cosmic event. I have extensive experience with Linux and C++ (familiar with C++14/17/20 features), and I enjoy exploring new languages and frameworks with the help of active developer communities, resourceful websites, public code repositories, and YouTube channels.My interests span Deep Learning, Databases, Networking, Algorithms, Performance, Kubernetes, and Optimization. Follow on the Website, Youtube, and LinkedIn.
    Students take courses primarily to improve job-related skills.Some courses generate credit toward technical certification. Udemy has made a special effort to attract corporate trainers seeking to create coursework for employees of their company.
    • language english
    • Training sessions 62
    • duration 3:05:40
    • Release Date 2023/05/05