Deadlock detection, Operating System

Deadlocks can be detected while the program is running, by running cycle detection algorithms on the graph that de?nes the current use of resources.

De?ne this graph as follows: it has one vertex for each resource (r1; : : : ; rm) and one vertex for each thread (t1; : : : ; tn). If a resource ri is held by thread tj , then we add an edge from vertex ri to vertex tj . If a thread tk is trying to acquire resource r', then we add an edge from vertex tk to vertex r'.

Given this graph, we can run a cycle detection algorithm. If a cycle is found, there is a deadlock. Detecting a deadlock ismuch easier than recovering froma deadlock. Several possible approaches might be to kill all of the threads in the cycle, or kill the threads one at a time, forcing them to release resources, and hope that this will break the deadlock.

While this may sound easy, it is not. Killing threads generally doesn't release their resources cleanly (locks,memory, ?les, etc). This is essentially the rollback problem, to back out all the actions of a thread. Databases usually include rollback mechanisms, which can be quite complicated, and it is not always possible to roll back all the actions of a thread (consider a thread which outputs hard-copy printed pages).

As a general guideline, do not use functions like pthread cancel(), which kills a thread, unless you really know what you are doing.

Posted Date: 3/12/2013 5:31:38 AM | Location : United States







Related Discussions:- Deadlock detection, Assignment Help, Ask Question on Deadlock detection, Get Answer, Expert's Help, Deadlock detection Discussions

Write discussion on Deadlock detection
Your posts are moderated
Related Questions
Define the Server Communications Module or SCM The Server Communications Module (SCM) performs many necessary functions. The SCM responsible for establishing, maintaining, and

What are the various layers of a file system? The file system is composed of many dissimilar levels. Each level in the design uses the feature of the lower levels to make new f

? FREE ASSOCIATION ASSIGNMENTS of multiprograming

What are the disadvantages of swapping technique used in pre-3BSD UNIX systems? If there is excessively much memory contention, processes are swapped out until sufficient

LRU evicts the page which was last accessed the farthest into the past of any page resident in physical memory, i.e. the least-recently used page. LRU approximates OPT when the rec

Q. What are the advantages as well as disadvantages of using circuit switching? For what types of applications is circuit switching a viable strategy? Answer: Circuit

WHAT IS OPERATING SYSTEM ?ENLIST AND EXPLAIN BASIC SERVICES PROVIDE BY OS

Question: a) Illustrate with the help of a diagram, the difference between two tier and three tier architectures. b) Explain in what kind of environment, a peer to peer envi

What is the benefits OS co-operating process? Information sharing. Computation speeds up. Modularity. Convenience.

Tree structured directories: This is the main common directory structure. The tree has a root directory as well as every file in the system has a unique path name. A directory