Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Deadlocks and Livelocks

20

Flashcards

0/20

Still learning
StarStarStarStar

Dining Philosophers Problem

StarStarStarStar

A classic synchronization problem that illustrates the challenges of avoiding deadlock while meeting mutual exclusion, hold and wait, and circular wait conditions. Solution: Use an arbitrator, impose resource ordering, or limit the maximum number of philosophers that can eat at once.

StarStarStarStar

Message Passing

StarStarStarStar

A form of communication used in parallel programming where information is sent between processes through the use of messages. Avoidance Techniques: Design protocols carefully to prevent blocking and ensure non-blocking operations where possible.

StarStarStarStar

Two-Phase Locking

StarStarStarStar

A locking protocol that helps to ensure serializability in database systems. A transaction must obtain all required locks before it begins to release any lock. Solution: Implement strict two-phase locking while ensuring no cyclic dependencies between transactions to avoid deadlocks.

StarStarStarStar

Resource Allocation Graph

StarStarStarStar

A directed graph that represents the allocation of resources in a system. Nodes represent processes and resources, edges represent allocations. Solution: Analyzing the graph for cycles can detect deadlocks.

StarStarStarStar

Lock-Free Algorithms

StarStarStarStar

Algorithms designed to allow concurrent access to data without the need for locking mechanisms, reducing the risk of deadlock. Solution: Use atomic operations and carefully designed data structures to safely allow concurrent modifications.

StarStarStarStar

Readers-Writers Problem

StarStarStarStar

A classic synchronization problem concerning a data structure that has to be accessed by readers and writers. Writers must have exclusive access to the data structure, while readers can access concurrently. Solution: Implement readers-writer locks to allow multiple readers or an exclusive writer.

StarStarStarStar

Condition Variables

StarStarStarStar

Synchronization primitives that enable threads to wait until a certain condition occurs. Avoidance Techniques: Use condition variables with mutexes to prevent races and ensure changes in condition are properly signaled to waiting threads.

StarStarStarStar

Nested Locks

StarStarStarStar

A situation where an already locked thread must acquire additional locks. This can increase the risk of deadlock if locks are not acquired and released in a consistent order. Solution: Establish a lock hierarchy and always acquire locks in a well-defined order.

StarStarStarStar

Spinlock

StarStarStarStar

A lock which causes a thread trying to acquire it to simply wait in a loop ('spin') while repeatedly checking if the lock is available. Avoidance Techniques: Use higher-level synchronization primitives or adaptive spinlocks to minimize CPU wastage.

StarStarStarStar

Livelock

StarStarStarStar

A condition where two or more processes continually change their state in response to changes in the other processes without doing any useful work. Avoidance Techniques: Introduce randomness in the decision-making process, ensure a hierarchy for resource claiming, or limit the number of times a process can change its state.

StarStarStarStar

Mutex Lock

StarStarStarStar

A lock used to control access to a particular resource in a concurrent system. Avoidance Techniques: Careful algorithm design to ensure locks are held for minimal necessary time, using lock-free algorithms or fine-grained locks.

StarStarStarStar

Monitor

StarStarStarStar

A high-level synchronization construct that allows threads to have both mutual exclusion and the ability to wait (block) for a certain condition to become true. Avoidance Techniques: Design monitors carefully to avoid deadlocks by making sure no process can hold a monitor indefinitely.

StarStarStarStar

Starvation

StarStarStarStar

A problem where a process never gets sufficient resources to run while others are being allocated resources. Solution: Fair allocation policies such as aging techniques or priority queues can prevent starvation.

StarStarStarStar

Semaphore

StarStarStarStar

An abstract data type used for controlling access, by multiple processes, to a common resource in a concurrent system. Avoidance Techniques: Ensure semaphores are used consistently and are properly released after use to prevent deadlocks.

StarStarStarStar

Deadlock

StarStarStarStar

A situation in parallel computing where two or more processes are unable to proceed because each is waiting for the other to release a resource. Solution: Use resource allocation strategies such as the Banker's Algorithm or prevent one of the necessary conditions for deadlock from occurring.

StarStarStarStar

Banker's Algorithm

StarStarStarStar

An algorithm used to avoid resource allocation problems. It allocates resources only if it's safe to do so, ensuring that the system is never in a deadlock state. Solution: Proper implementation and careful resource request evaluation based on the Banker’s principle.

StarStarStarStar

Priority Inversion

StarStarStarStar

Occurs when a higher priority process is waiting for a lower priority process holding a needed resource. Solution: Implement priority inheritance where the lower priority process inherits the higher priority until the resource is freed.

StarStarStarStar

Critical Section

StarStarStarStar

A piece of code that accesses shared resources and must not be concurrently accessed by multiple threads of execution. Solution: Use synchronization mechanisms like mutexes, semaphores, and monitors to protect critical sections.

StarStarStarStar

Ostrich Algorithm

StarStarStarStar

A strategy of ignoring deadlock conditions and hoping they never occur based on the assumption that the cost of preventing the deadlock is greater than the cost of its occurrence. Avoidance Techniques: Not recommended except in systems where deadlock is very rare and can be easily corrected after it happens.

StarStarStarStar

Barriers

StarStarStarStar

A synchronization method that ensures each thread or process does not proceed past a certain point until all participating threads or processes reach this point. Solution: Implement barriers carefully to prevent deadlocks and use timeout mechanisms if necessary.

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.