Concurrency and Parallelism Flashcards
Concurrency
Handling multiple tasks at once, but not necessarily simultaneously. The execution of the tasks shouldn’t interfere with each other.
Parallelism
Executing multiple tasks simultaneously, often using multiple CPU cores or machines.
Multithreading
A method of concurrency by running multiple threads within a single process.
Thread Safety
Ensuring that shared resources are accessed in a way that avoids race conditions.
Locks and Synchronisation
Mechanisms to control access to shared resources.
Mutexes
Ensures only one thread accesses a resource at a time.
Semaphores
Allow a limited number of threads to access a resource.
Deadlocks
Situation where two or more threads are blocked forever, waiting for each other.
Thread Pools
Managing a group of threads to execute them efficiently.
MapReduce
A framework for processing large datasets in parallel.
Data Parallelism
Splitting data across multiple processors to perform the same operation.
Task Parallelism
Splitting tasks across processors.
Consensus Algorithms
Used for agreement in distributed systems.
Examples: Paxos, Raft
Message Passing
Communication between distributed components (e.g., via REST, gRPC, or message queues like Kafka).