The ACCU 2023 conference is next week, running from 19th-22nd April 2023, in Bristol, UK. My presentation This year I will be presenting "Designing for concurrency using message passing" on 22nd April. The abstract is: One common way to design concurrent code with less potential for synchronization and other concurrency errors is to use message passing. In this talk, I will walk through the design…
Verdict: Conditionally Recommended (3/5) This is a huge book, over 1300 pages, and contains a wealth of information about all the language (not library) facilities added in C++11 and C++14. It has one "section" per language feature, and the sections are largely independent of each other, so they can be read in almost any order, and used as a reference. This is mostly a useful structuring, except…
I am excited to be going to CppCon again this year, where I will be running a 2-day class: More Concurrent Thinking in C++: Beyond the Basics . The class is onsite at the conference venue in Aurora, Colorado, USA, on Saturday 10th September 2022 and Sunday 11th September 2022, immediately before the main conference. I'll be teaching you to think about the synchronization properties of the…
The restrictions brought upon us by COVID-19 are not over yet, and C++ on Sea is the latest conference that will be running as an online-only conference. I will be running my More Concurrent Thinking class as an online workshop for C++ on Sea on 30th June and 1st July 2021. The workshop will run from 09:30 UTC to 18:15 UTC each day. For attendees from North and South America, this is likely quite…
In my previous blog post I wrote about spin locks, and how compilers must not move the locking loop above a prior unlock. After thinking about this done more, I realised that is not something specific to locks — the same issue arises with any two step synchronization between threads. Consider the following code std::atomic<bool> ready1{false}; std::atomic<bool> ready2{false}; void thread1(){…
There has been discussion on Twitter recently about whether or not the C++ memory model allows spinlocks to deadlock if they just use memory_order_acquire in lock and memory_order_release in unlock , due to compiler optimizations. The case in question is where a thread locks one mutex, unlocks it, and locks a second: can the compiler reorder the second lock above the first unlock? If it does, and…
It has been an increasingly common scenario that I've encountered where you have some ID that's monotonically increasing, such as a subscription or connection index, or user ID, and you need your C++ program to hold some data that's associated with that ID value. The program can then pass round the ID, and use that ID to access the associated data at a later point. Over time, IDs can become…
With all the restrictions brought upon us by COVID-19, many C++ conferences are moving online. This includes Cppcon and NDC Tech Town , both of which are being run as 100% virtual conferences this year. I will be running my More Concurrent Thinking class as an online class for both conferences. The class at NDC Tech Town will be a 2-day class running on 31st August 2020 and 1st September 2020, 9am…
I tend to think about invariants and preconditions a lot. Pretty much every class has invariants, and most functions have preconditions. I don't think they are complicated concepts, but somehow they seem to confuse people anyway, so I decided it was time to write down some of my thoughts. Invariants A class invariant is something that is always true for every instance of that class. Users of…
Having been back from CppCon 2019 for over a week, I thought it was about time I wrote up my trip report. The venue This year, CppCon was at a new venue: the Gaylord Rockies Resort near Denver, Colorado, USA. This is a huge conference centre, currently surrounded by vast tracts of empty space, though people told me there were many plans for developing the surrounding area. There were hosting…