Question: (P5)Please select all the correct answers concerning C code/ Linux environment Which of the following are true about deadlocks, semaphores and mutexes? Select one or
(P5)Please select all the correct answers concerning C code/ Linux environment


Which of the following are true about deadlocks, semaphores and mutexes? Select one or more: a. Deadlock detection is a strategy where resource allocation requests are rejected if they will potentially lead to a deadlock. O b. Mutual exclusion is guaranteed on a shared resource when a counting semaphore is used to protect it. C. A deadlock can happen when there is mutual exclusion, hold-and-wait and no-preemption. d. Mutexes are used for ensuring exclusive access to a particular resource, whereas semaphores can additionally be used for signalling or synchronisation between processes or threads (but a binary semaphore can technically be used to achieve equivalent functionality to a mutex in guarding a critical section of code). e. Deadlocks can be directly prevented by designing a system so that circular waits can never happen. Which of the following are true about processes/threads and concurrency? Select one or more: a. To ensure data consistency, a shared resource should not be accessed by a thread if there is currently another thread accessing it. ob. When two threads concurrently access and modify the value of a shared variable x, the final value of x will determined by the thread that was first in writing to x. c. A deadlock is said to have occurred when process A is indefinitely blocked waiting for a resource held by process B, and process B at the same time is indefinitely blocked waiting for a resource held by process A. d. A critical section is a part of code where a shared resource is accessed or modified. e. Mutual exclusion is used so that a shared resource cannot be accessed by any threads or processes at all
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
