Question: There are three mutex locks and different functions that use the locks. For the following cases, can the threads end up in a deadlock? If

 There are three mutex locks and different functions that use the

There are three mutex locks and different functions that use the locks. For the following cases, can the threads end up in a deadlock? If a deadlock cannot occur, then explain which of the four required conditions for the deadlock is missing.

(1) Multiple threads concurrently calling functions 1 and 2.

(2) Multiple threads concurrently calling functions 3 and 4.

(3) Multiple threads concurrently calling functions 5 and 6.

(4) Multiple threads concurrently calling functions 1, 3, and 5.

(5) Multiple threads concurrently calling functions 1, 3, and 6.

Synchronization: deadlocks mutex_lock_t lock_a; mutex_lock_t lock_b; mutex_lock_t lock_c; void function_10 { LOCK (&lock_a); LOCK (&lock_b); UNLOCK (&lock_b); UNLOCK(lock_a); ) void function 20) { LOCK (&lock_b): LOCK (&lock_a); UNLOCK(&lock_a); UNLOCK(&lock_b): } void function 30) { int is locked - TRY_LOCK(Block_b); LOCK (&lock_c); UNLOCK(Slock_c); if (is_locked) (UNLDOK (&lock_b); } ) void function_40) int is locked - THY_LOCK(Block_c); LOCK (&lock_b); UNLOCK (&lock_b); if (is_locked) { UNLOCK (&lock_c); } ) void function 50) { int is locked; LOCK (&lock_c); is_locked - TRY_LOCK (&lock_a): if (is_locked) (UNLDOK (&lock_a); } UNLOCK (&lock_c); ) void function_60) int is locked; LOCK (&lock_a); LOCK (&lock_c); UNLOCK (Glock_c); UNLOCK(&lock_a); Synchronization: deadlocks mutex_lock_t lock_a; mutex_lock_t lock_b; mutex_lock_t lock_c; void function_10 { LOCK (&lock_a); LOCK (&lock_b); UNLOCK (&lock_b); UNLOCK(lock_a); ) void function 20) { LOCK (&lock_b): LOCK (&lock_a); UNLOCK(&lock_a); UNLOCK(&lock_b): } void function 30) { int is locked - TRY_LOCK(Block_b); LOCK (&lock_c); UNLOCK(Slock_c); if (is_locked) (UNLDOK (&lock_b); } ) void function_40) int is locked - THY_LOCK(Block_c); LOCK (&lock_b); UNLOCK (&lock_b); if (is_locked) { UNLOCK (&lock_c); } ) void function 50) { int is locked; LOCK (&lock_c); is_locked - TRY_LOCK (&lock_a): if (is_locked) (UNLDOK (&lock_a); } UNLOCK (&lock_c); ) void function_60) int is locked; LOCK (&lock_a); LOCK (&lock_c); UNLOCK (Glock_c); UNLOCK(&lock_a)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!