
Compile and Run OpenMP Programs with GCC and Clang
Build and run OpenMP C programs with GCC 14 and Clang 19 on Linux, set the thread count, check that the pragma took effect, and fix the common link errors.
Threads, atomics, memory models, lock-free structures, async runtimes and actor systems such as Erlang/OTP, and the races each one invites.

Build and run OpenMP C programs with GCC 14 and Clang 19 on Linux, set the thread count, check that the pragma took effect, and fix the common link errors.

Turn a serial C loop into a multithreaded one with one OpenMP pragma, then learn which loops are safe to split and which ones silently give wrong answers.

Avoid lock-ordering deadlocks in C++17 and C++20 by locking several mutexes at once with std::scoped_lock, with a bank transfer example and the pitfalls.

Make a C thread sleep until another signals that work is ready with pthread_cond_wait, pthread_cond_signal and a predicate loop on Linux with glibc 2.41.

Share mutable state across threads in Rust 1.85 with Arc and Mutex, see why Rc and a bare Mutex fail to compile, and how to keep lock guards short.

Guard shared state in C++20 with std::mutex and std::lock_guard so the lock is released on every path, even exceptions. Includes unique_lock.

Guard a shared linked-list stack in C with pthread_mutex_lock and pthread_mutex_unlock on glibc 2.41, check return codes, and avoid leaks from missed unlocks.

A race condition is a bug where the result depends on thread timing. See a lost-update counter in C with pthreads and how a mutex makes the update atomic.

Name threads with pthread_setname_np so gdb, top -H and /proc show readable names. Covers the 15-character limit, ERANGE, prctl and C++ and Rust.

Pass arguments to a pthread through void pointers and get results back with pthread_join, a result struct or pthread_exit, without dangling pointers.

Start OS threads in Rust with std::thread::spawn, move data in with move closures, read results from JoinHandle and handle a panicking thread safely.

Launch threads in C++ with std::thread and the C++20 std::jthread, which joins automatically. Covers arguments, references, join rules and std::terminate.
We send one email when a new post is published. No spam.