Recall that a set of processes is deadlocked if every process in that set is blo
ID: 3712134 • Letter: R
Question
Recall that a set of processes is deadlocked if every process in that set is blocked waiting for some action that can only be done by some other process in that set. For each set of conditions discussed below, is automatic deadlock detection possible? If yes, how? In this case, don't give an algorithm, but give enough detail that you can convert the problem to one where there are known algorithms that solve the problem. If no, why not?
a) All memory is shared between all processes, with processes using semaphores for mutual exclusion and synchronization.
b) Memory is not shared. Interprocess communication is through shared files, with the Unix/Linux flock kernel call being used for mutual exclusion and synchronization. Ignore the LOCK_NB option that allows for non-blocking operations (polling), so locks have only 3 states: unlocked, shared or exclusive.
Explanation / Answer
For the above set of conditions automatic deadlock detection is possible.
a) Given as the memory is shared between all processes. When memory is shared among processes and more than one process is accessing the same memory location with read and write operations , it leads to deadlock. But ,here in this condition it was explicitly mentioned as all these processes are using semaphores for mutual exclusion and synchonization. According to the concept of semaphore it does not allow them into deadlock using the wait and signal operations.
b)In this condition it was explicitly represented as memory is not shared and interprocess communication is done through shared files using flock() system call for mutual exclusion and sychronization.A single file may not have both shared and exclusive locks.When lock is created using flock() a duplicate file descriptor may refer the same lock ,and this lock may be released using any of these file descriptors or the lock may be released by using unlocked state.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.