9

Understanding the C++ Memory Model

This chapter is a continuation of the discussion from Chapter 7, where we discussed a few multiprocess and multi-threaded techniques; this chapter will enhance their usage. We will guide you through various techniques while narrowing down to the main focus of the chapter – the C++ memory model. But in order to discuss this, you will start first with a brief examination of memory robustness through the smart pointer and the optional objects. We will use them later to implement lazy initialization and handle shared memory regions safely. An improved memory access analysis of cache-friendly code follows. You will learn when and why using multi-threaded execution could be a trap, even though you did everything ...

Get C++ Programming for Linux Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.