Chapter 8. Designing concurrent code

This chapter covers

  • Techniques for dividing data between threads
  • Factors that affect the performance of concurrent code
  • How performance factors affect the design of data structures
  • Exception safety in multithreaded code
  • Scalability
  • Example implementations of several parallel algorithms

Most of the preceding chapters have focused on the tools you have in your C++ toolbox for writing concurrent code. In chapters 6 and 7 we looked at how to use those tools to design basic data structures that are safe for concurrent access by multiple threads. Much as a carpenter needs to know more than how to build a hinge or a joint in order to make a cupboard or a table, there’s more to designing concurrent code than the design and use of basic data structures. You now need to look at the wider context so you can build bigger structures that perform useful work. I’ll be using multithreaded implementations of some of the C++ Standard Library algorithms as examples, but the same principles apply at all scales of an application.

8.1. Techniques for dividing work between threads

8.2. Factors affecting the performance of concurrent code

8.3. Designing data structures for multithreaded performance

8.4. Additional considerations when designing for concurrency

8.5. Designing concurrent code in practice

Summary

sitemap