concurrent.quest

A Taxonomic Guide to Concurrent Patterns

SynchronizationMutual ExclusionMutex

Mutex

Exclusio mutualis

A single-stemmed flower permitting only one visitor at a time. The mutex ensures exclusive access to a shared resource — like a solitary bloom that can only be pollinated by one bee. When one thread holds the lock, all others must wait until it is released.

SynchronizationCounting PrimitivesSemaphore

Semaphore

Semaphorus numeratus

A plant bearing counted leaves — each leaf represents one available permit. Threads may acquire a permit (pluck a leaf) to proceed; when all permits are taken, newcomers must wait for a leaf to regrow. Unlike the solitary mutex, the semaphore allows a measured plurality of concurrent access.

ExecutionWorker ManagementThread Pool

Thread Pool

Filum piscinae

A root system branching from a single trunk into many tendrils. The thread pool pre-allocates a fixed set of worker threads, reusing them for multiple tasks rather than growing new ones. Like a well-established root network, it efficiently distributes work across its established pathways.

HazardsCircular DependenciesDeadlock

Deadlock

Mortuus nexus circularis

Vines intertwined in a fatal embrace — each waiting for the other to release. A deadlock occurs when two or more threads hold resources the others need, forming a circular dependency from which none can escape. A cautionary specimen: once entangled, only intervention from outside the system can restore order.

CommunicationMessage PassingChannel

Channel

Canalis nuntiorum

A hollow stem through which seeds pass from one plant to another — the channel enables safe communication between concurrent processes without shared memory. Messages flow in one direction, buffered within the stem until the receiver is ready to collect them. "Do not communicate by sharing memory; share memory by communicating."

SynchronizationShared AccessRead-Write Lock

Read-Write Lock

Claustrum lectionis scripturae

A forked branch: one side lush with many leaves (readers), the other bearing a single, guarded bloom (writer). Many readers may observe simultaneously, but when the writer blooms, all readers must withdraw. This asymmetric lock optimizes for read-heavy workloads while preserving write safety.

CompositionDeferred ResultsFuture / Promise

Future / Promise

Futurum promissum

A bud not yet bloomed — the future represents a value that will arrive, a promise of eventual completion. The calling thread receives a placeholder, free to attend other tasks while the computation unfolds. When ready, the bud opens, and the awaited result is revealed.

ArchitectureMessage-DrivenActor Model

Actor Model

Actorum exemplar

Individual plants in a garden, each with its own soil and root space, communicating only through windborne seeds. The actor model encapsulates state within independent actors that interact solely via asynchronous message passing — no shared mutable state, no locks, only messages drifting between isolated organisms.

SynchronizationSignalingCondition Variable

Condition Variable

Conditio variabilis

A dormant bud awaiting the signal of spring — the condition variable allows threads to sleep until a particular condition is met. One thread signals the change; the waiting thread awakens and proceeds. Unlike busy-waiting, this pattern conserves resources through patient dormancy.

SynchronizationCoordinationBarrier

Barrier

Obex synchronus

A garden fence where all plants must reach the same height before the trellis is raised. The barrier synchronizes multiple threads at a rendezvous point — none may proceed until all have arrived. Only when the last thread checks in does the barrier lift, allowing all to continue in unison.

SynchronizationBusy WaitingSpinlock

Spinlock

Claustrum rotans

A tendril endlessly circling a support pole, waiting for the right moment to grasp. The spinlock continuously checks — spinning in a tight loop — whether the lock has been released. Efficient for brief waits, but wasteful for long ones: the tendril expends energy in its ceaseless rotation.

PrimitivesAtomic OperationsCompare-and-Swap

Compare-and-Swap

Comparatio et permutatio

Two specimens side by side — the naturalist compares the live plant to the expected form. If they match, the swap occurs atomically. If another has altered it first, the operation fails and must retry. This lock-free primitive is the foundation upon which many concurrent data structures are built.