28.1 Introduction and Objectives
In this chapter we introduce the C++ Concurrency library by first focusing on how it supports multithreading, that is creating programs that are executed by multiple independent threads of control. The main goal of this chapter is to show how the library supports multithreading by introducing each syntax feature in the library, creating examples and then using these features to write simple and complete multithreaded programs. We also give initial examples and exercises from computational finance based on some of the numerical methods and option pricing models as already discussed in previous chapters.
This chapter is useful for the following reader groups:
- Developers who have little or no experience of writing multithreading programs. The chapter is structured in such a way that the code samples can be run and extended in order to get hands-on experience with the library.
- Developers with experience of proprietary or open-source multithreading libraries who wish to compare their functionality with that offered by C++ Concurrency.
- C++ developers who already use C++ Concurrency. This chapter could then function as a compact summary of the functionality and the examples and exercises hopefully provide insights into simple multithreaded code for a number of the numerical algorithms that we have discussed in previous chapters of this book.
In Chapter 29 we discuss how to write parallel programs using tasks. ...