20 cards · Public · Shuffle

Concurrency & Async Programming - Mutexes, Threads & Event Loops

Master the essentials of concurrent and asynchronous programming. This high-yield deck covers synchronization primitives, deadlock prevention, thread pools, and event-driven runtimes.

Cards in this deck

(20 cards)

Preview terms and definitions before starting your study session.

#1
Term
Reentrant Lock (Recursive Mutex)
Definition
A mutex that allows the thread currently holding the lock to re-acquire it multiple times without causing a deadlock. It maintains an internal lock count and requires an equal number of release operations to fully unlock.
#2
Term
Concurrency vs. Parallelism
Definition
Concurrency is about structuring a program by decomposing it into independent execution paths that can overlap in time. Parallelism is about executing multiple computations simultaneously on separate hardware resources (e.g., multi-core CPUs).
#3
Term
Race Condition
Definition
A flaw in a concurrent system where the output is unexpectedly dependent on the timing or sequence of execution across threads. Occurs when two or more threads access shared memory concurrently, and at least one access is a write without proper synchronization.
#4
Term
Mutex (Mutual Exclusion Lock)
Definition
A locking primitive used to protect a critical section of code. Only one thread can hold the mutex at a time; other threads attempting to acquire it will block until it is released by the owner thread.
#5
Term
Counting Semaphore vs. Binary Semaphore
Definition
A Counting Semaphore maintains an integer counter to control access to a finite pool of resources ( total permits). A Binary Semaphore has a counter restricted to 0 or 1; unlike a mutex, it lacks ownership tracking, allowing any thread to signal (post/release) it.
#6
Term
Atomic Operations
Definition
Low-level, hardware-supported memory operations that execute completely without interruption. They guarantee that no other thread can observe a partial state change, enabling lock-free data structures.
#7
Term
Compare-And-Swap (CAS)
Definition
An atomic instruction of the form CAS(location, expected_val, new_val). It checks if location contains expected_val; if true, it updates it to new_val and returns true. Otherwise, it leaves memory unchanged and returns false.
#8
Term
Coffman Conditions for Deadlock
Definition
Four conditions that must hold simultaneously for a deadlock to occur:
1. Mutual Exclusion: Non-shareable resource allocation.
2. Hold and Wait: Holding a resource while waiting for another.
3. No Preemption: Resources cannot be forcibly taken.
4. Circular Wait: A closed chain of threads waiting on each other.
Showing 8 of 20 cards in this deck.
Study All Now