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
List the Coffman's conditions that lead to a deadlock. Mutual Exclusion : Only one process might be use a critical resource at a time. Hold & Wait: A process may be alloc

Q. What are the major differences between capability lists and access lists? Answer: An access list is a list for each object consisting of the domains with a nonempty set of

The question of fairness, regarding page eviction, is a hard one. How do we decide what is fair? Many operating systems use global LRU, where pages from all processes are managed t

Question: (a) As a System administrator, elaborate on how you can manage computer accounts in Active Directory of Windows Server 2008? (b) Explain the following user p

Central to implementation of a modern memory management system is the page replacement algorithm. Modern virtual memory systems break memory up into pages and map (via a page table

diffenciet between least recently used and not recently used

Ask question Project Details PROJECT OVERVIEW The ABC Hospital is upgrading their version of Windows. As part of the upgrade, 100 new computers will be purchased. Your task is to

A hard-disk drive reads “120 GB HDD 7200 rpm 3 GB/sec transfer rate”. If the drive has a sector size of 512 bytes, what is the average rotational latency and transfer time to read

Gang Scheduling : A set of related process is scheduled to execute on a set of processors at the similar time, on a 1-to-1 basis. Closely related processes or threads may be sched

What do you mean by semaphore?  Semaphore : A synchronization variable that acquires on positive integer values. Invented by the Dijkstra P (semaphore): an atomic proce