Async and Batching
Every Runnable exposes sync and async twins (invoke/ainvoke, batch/abatch, stream/astream, from Runnables and LCEL), plus batch for running many independent inputs efficiently.
Every Runnable exposes sync and async twins (invoke/ainvoke, batch/abatch, stream/astream, from Runnables and LCEL), plus batch for running many independent inputs efficiently.
Why this matters
Atomic operations execute as single, indivisible steps with no interference from other threads. Memory fences (barriers) establish ordering constraints between operations.
Boost.Thread provides portable threading primitives — threads, mutexes, condition variables, futures,
The C++ memory model defines how threads interact through memory, including visibility of writes, ordering of operations, and synchronization primitives.
Overview
Condition variables allow threads to wait for specific conditions to become true, enabling efficient thread coordination beyond simple mutexes.
A bare-metal program with interrupts enabled is a concurrent program. There is one core and no scheduler, but there are still two threads of control — main and whatever handler just fired — and they share memory. Everything that makes concurrency hard is already present:atomic you can assume is lock-free, no kernel to block against.
A data race occurs when two or more threads access the same memory location concurrently, at least one access is a write, and there's no synchronization between them. Data races cause undefined behavior.
Why this matters
Futures and promises provide a mechanism for asynchronous computation: one thread computes a value and another retrieves it later.
A mutex (mutual exclusion) is a synchronization primitive that protects shared data by allowing only one thread to access it at a time.
Threads allow programs to perform multiple operations concurrently. C++11 introduced std::thread for portable threading.
A thread pool manages a fixed set of worker threads that execute tasks from a queue, avoiding the overhead of creating and destroying threads repeatedly.