CS604 GDB Solution feb 2015

Is it possible to have a deadlock condition with a single process? Explain and justify your answer with reference to deadlock prevention method”.
Solution: No, it is not possible to have a deadlock condition in a single process.The deadlock involves a circular “hold-and-wait” condition between two or more processes, so “one” process cannot hold a resource, yet be waiting for another resource that it is holding. In addition, deadlock is not possible between two threads in a process, because it is the process that holds resources, not the thread that is, each thread has access to the resources held by the process.
There are four conditions that are necessary to achieve deadlock:
Mutual Exclusion – At least one resource must be held in a non-sharable mode; If any other process requests this resource, then that process must wait for the resource to be released.
Hold and Wait – A process must be simultaneously holding at least one resource and waiting for at least one resource that is currently being held by some other process.
No preemption – Once a process is holding a resource ( i.e. once its request has been granted ), then that resource cannot be taken away from that process until the process voluntarily releases it.
Circular Wait – A set of processes { P0, P1, P2, . . ., PN } must exist such that every P[ i ] is waiting for P[ ( i + 1 ) % ( N + 1 ) ]. ( Note that this condition implies the hold-and-wait condition, but it is easier to deal with the conditions if the four are considered separately. )

DOWNLOAD SOLUTION HERE
loading...