6533b872fe1ef96bd12d36ff
RESEARCH PRODUCT
Advanced C++11 Multithreading
Bertil SchmidtMoritz SchlarbJorge González-domínguezChristian Hundtsubject
Computer scienceMonitorMultithreadingThreading (manufacturing)Operating systemSemaphorecomputer.software_genreData typecomputerBottleneckSpawn (computing)Shared resourcedescription
Abstract The previous chapter introduced the basic concepts of multithreading using the C++11 threading API starting with basic spawn and join approaches, while finishing with non-trivial synchronization based on mutexes and condition variables. However, the major bottleneck of application performance is usually caused by contention for a shared resource. In case of mutex-based programming all participating threads usually try to acquire the same lock in parallel which effectively serializes the program for lightweight operations such as increment/decrement or updates of a single scalar value. Fortunately, modern CPUs provide dedicated commands that allow for the efficient execution of uninterruptible read-modify-write operations for scalar data types (so-called atomics). In this chapter you will learn how to improve your application's performance by enforcing race condition-free code without having to deal with the overhead of lock-based approaches.
year | journal | country | edition | language |
---|---|---|---|---|
2018-01-01 |