FlashKeepers

Programming Concepts · College · College and University

Concurrency and Parallelism Concepts

Threads, race conditions, deadlock, mutexes, semaphores, the actor model, async I/O, memory models and amdahl's law.

About this set

39 basic cards for College Programming Concepts. It opens with "What is a thread?" and "Define concurrency". Study it alongside the other College sets below.

39 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a thread?
Show answerThe smallest unit of execution within a process, capable of running concurrently with other threads in the same process.
Define concurrency.
Show answerThe ability of a program to deal with multiple tasks being interleaved in execution, not necessarily executing at the same instant.
Define parallelism.
Show answerMultiple tasks executing truly simultaneously on different physical processors or cores.
What is context switching?
Show answerThe process of storing and restoring the state of a thread so the CPU can switch between executing different threads.
What is a critical section?
Show answerA code segment where a thread accesses shared resources and must not be interrupted by other threads.
What is a race condition?
Show answerA bug where the outcome of a program depends on the unpredictable order in which multiple threads execute.
What is mutual exclusion?
Show answerThe guarantee that only one thread can execute a critical section at any given time.
What is deadlock?
Show answerA situation where two or more threads are blocked forever, each waiting for the other to release a resource.
List the four Coffman conditions for deadlock.
Show answerMutual exclusion, hold and wait, no preemption, and circular wait.
How can you prevent deadlock?
Show answerBreak at least one Coffman condition, such as using timeouts, resource ordering, lock-free algorithms, or allowing preemption.
What is a mutex?
Show answerA synchronization primitive that acts as a mutual exclusion lock, allowing only one thread to hold it at a time.
How does a mutex work?
Show answerA thread acquires the mutex before entering a critical section and releases it upon exit, blocking other threads that try to acquire it.
What is lock contention?
Show answerThe situation where many threads compete to acquire the same lock, causing performance degradation and increased waiting times.
What is a semaphore?
Show answerA synchronization primitive that maintains a counter, allowing threads to increment or decrement it and block if the counter would go negative.
What is a binary semaphore?
Show answerA semaphore with a counter that can only be 0 or 1, functionally equivalent to a mutex.

24 more cards in the app

Study this set free