Рет қаралды 186
This video is part of a series of presentations covering the
key concepts of multithreading and synchronization. This
presentation, provides a summary of the different approaches and provides suggestions for selecting one of the many different approaches for multithreading an algorithm. This presentation first reviews synchronization-free approaches using std::async, data parallel approaches, and using reduction. Next, the presentation provides suggestions for selecting approaches that involve synchronization. First it covers approaches requiring the use of only 1 shared resource using either std::atomic or std::mutex + std::lock_guard. Next it suggests using the producer-consumer model for situations where threads are performing very diverse operations. For the producer-consumer model it summarizes busy-wait vs. sleep-wakeup approaches for implementation. Finally it covers scenarios where multiple mutex need to be locked simultaneously, reminding us of the Dining philosopher's model.