lock

The Null Object Pattern

A Null Object encapsulates a do nothing behavior inside an object. It is often pretty comfortable to use a neutral object.

Read more
Tags: lock, mutex
Views: 6647

Dining Philosophers Problem III

This post ends the mini-series about the dining philosophers problem by Andre Adrian. Today, he applies powerful locks and semaphores.

Read more
Views: 8244

Dining Philosophers Problem II

In the last post "Dining Philosophers Problem I", Andre Adrian started his analysis of the classical dining philosophers' problem. Today, he uses atomics, mutexes, and locks.

Read more
Views: 5820

C++ Core Guidelines: Sharing Data between Threads

If you want to have fun with threads, you should share mutable data between them. To get no data race and, therefore, undefined behavior, you have to think about the synchronization of your threads.

Read more
Tags: lock, mutex
Views: 106344

C++ Core Guidelines: Rules for Concurrency and Parallelism

C++11 is the first C++ standard that deals with concurrency. The basic building block for concurrency is a thread; therefore, most rules are explicitly about threads. This changed dramatically with C++17.

 

Read more
Views: 90936

Single Threaded: Summation of a Vector

What is the fastest way to add the elements of a std::vector? This a question that I will pursue in the following posts. I use the single-threaded addition as the reference number. In further posts, I discuss atomics, locks, and thread-local data.

Read more
Views: 28919

Thread-Safe Initialization of a Singleton

There are a lot of issues with the singleton pattern. I'm aware of that. But the singleton pattern is an ideal use case for a variable, which can only be initialized in a thread-safe way. From that point on, you can use it without synchronization. So in this post, I discuss different ways to initialize a singleton in a multithreading environment. You get the performance numbers and can reason about your use cases for the thread-safe initialization of a variable.

Read more
Views: 365293

Ongoing Optimization: Locks and Volatile with CppMem

The easiest way to solve the undefined behaviour in the post Ongoing Optimization: Unsynchronized access is, to use a lock.

Read more
Views: 15222

Reader-Writer Locks

With C++14 came reader-writer locks. The idea is straightforward and promising. Arbitrary reading threads can access the critical region simultaneously, but only one thread is allowed to write.

Read more
Tags: lock
Views: 83636

Prefer Locks to Mutexes

If the previous post showed something, it's that you should use mutexes with great care. That's why you should wrap them in a lock.

Read more
Tags: lock, mutex
Views: 153405

Stay Informed about my Mentoring

 

Mentoring

English Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Course: The All-in-One Guide to C++20

Course: Master Software Design Patterns and Architecture in C++

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 968

Yesterday 6503

Week 27225

Month 7471

All 12085680

Currently are 295 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments