модель памяти, примитивы, архитектурные паттерныthe memory model, primitives, architectural patterns

Многопоточность и асинхронностьConcurrency & asynchrony

Два слоя. Fundamentals — теоретический базис ниже примитивов stl/: модель памяти C++, data race vs race condition, порядки памяti у atomic, что такое CAS и ABA-проблема. Patterns — архитектурные решения, собранные уже поверх примитивов (mutex, atomic, thread, jthread — сами примитивы разобраны в stl/ по стандартам): producer-consumer, thread pool, actor model и другие. Раздел задуман с запасом на горизонтальное расширение — это одна из самых объёмных тем на собеседованиях. Fundamentals: все 4 темы заполнены. Patterns: 10 карточек, страницы ещё не написаны.Two layers. Fundamentals — the theoretical basis underneath the stl/ primitives: the C++ memory model, data race vs race condition, atomic memory orders, what CAS is and the ABA problem. Patterns — architectural solutions built on top of those primitives (mutex, atomic, thread, jthread — the primitives themselves are covered in stl/ by standard): producer-consumer, thread pool, the actor model, and others. This section is deliberately built with room for horizontal growth — it's one of the largest interview topics there is. Fundamentals: all 4 topics are filled in. Patterns: 10 cards, pages not yet written.

FundamentalsFundamentals

теоретический базис, до паттерновthe theoretical basis, before patterns

ПаттерныPatterns

Producer-Consumerочередь между потоками-производителями и потоками-потребителямиa queue between producer threads and consumer threadsinterview Thread Poolпереиспользуемый набор потоков вместо создания на каждую задачуa reusable set of threads instead of spawning one per taskinterview Actor Modelизоляция состояния за сообщениями вместо разделяемой памятиisolating state behind messages instead of shared memory Read-Write Lockмного читателей одновременно, один писатель монопольноmany concurrent readers, one exclusive writer Double-Checked Lockingклассический паттерн ленивой инициализации и его подводные камни до C++11the classic lazy-initialization pattern and its pitfalls before C++11interview Lock-Free Designобщий подход к построению lock-free структур, не конкретная структураthe general approach to building lock-free structures, not one specific structure Fork-Joinразбить задачу на подзадачи, дождаться и объединить результатыsplitting a task into subtasks, waiting, and combining the results Pipelineконвейер стадий обработки, каждая на своём потокеa pipeline of processing stages, each on its own thread Barrier Synchronizationточка ожидания, пока все потоки не дойдут до неёa wait point until every thread reaches it Future/Promise Compositionобъединение асинхронных результатов в цепочки и деревьяcomposing asynchronous results into chains and trees

статус и связь со stl/status and relation to stl/

Fundamentals заполнены: все 4 темы написаны, каждая с рабочим примером и минимальной реализацией, где применимо (lock-free стек, publish/subscribe через acquire-release). Patterns остаются каркасом: 10 карточек зафиксированы, страницы ещё не написаны. При заполнении логично ссылаться на конкретные примитивы из stl/ (cpp11/mutex-condvar.html, cpp11/thread.html, cpp11/atomic.html, cpp20/jthread-stop-token.html, cpp26/execution-senders-receivers.html) как на строительные блоки, не повторяя их описание с нуля. Раздел явно спроектирован для дальнейшего горизонтального расширения — «Практика многопоточного программирования на C++» Энтони Уильямса взята за основной ориентир по глубине и порядку изложения fundamentals.Fundamentals are filled in: all 4 topics are written, each with a working example and a minimal implementation where applicable (a lock-free stack, publish/subscribe via acquire-release). Patterns remain a skeleton: 10 cards are locked in, pages not yet written. When filling those in, it makes sense to reference the concrete primitives in stl/ (cpp11/mutex-condvar.html, cpp11/thread.html, cpp11/atomic.html, cpp20/jthread-stop-token.html, cpp26/execution-senders-receivers.html) as building blocks, rather than re-describing them from scratch. This section is explicitly designed for further horizontal expansion — Anthony Williams's "C++ Concurrency in Action" is the reference point for the depth and ordering of the fundamentals material.