Friday, 1 December 2017

OS Assignment

Operating System

Deadlocks


Deadlock in OS

A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.

Deadlock Conditions

·  Mutual exclusion condition :The resources involved must be unshareable; otherwise, theprocesses would not be prevented from using the resource when necessary.
·     Hold and wait condition :The processes must hold the resources they have already been allocated while waiting for other (requested) resources. If the process had to release its resources when a new resource or resources were requested, deadlock could not occur because the process would not prevent others from using resources that it controlled
·    No pre-emption condition :The processes must not have resources taken away while that resource is being used. Otherwise, deadlock could not occur since the operating system could simply take enough resources from running processes to enable any process to finish.
·      Circular wait condition :A circular chain of processes, with each process holding resources which are currently being requested by the next process in the chain, cannot exist
All of the four conditions must be present for a deadlock to occur.If one of the condition is absent,no deadlock is possible.

Ostrich algorithm:The ostrich algorithm is a strategy of ignoring potential problems on the basis that they may be exceedingly rare. It is named for the ostrich effect which is defined as "to stick one's head in the sand and pretend there is no problem." It is used when it is more cost-effective to allow the problem to occur than to attempt its prevention.
ReferencesDeadlock PPT

No comments:

Post a Comment