Deadlock detection, Operating System

Assignment Help:

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.


Related Discussions:- Deadlock detection

What is spooling, What is spooling? Spooling overlaps the I/O of single...

What is spooling? Spooling overlaps the I/O of single job with the computation of other jobs.

What is the sequence in which resources may be utilized, What is the sequen...

What is the sequence in which resources may be utilized? Under normal mode of operation, a process may utilize a resource in the following sequence: Request: If the requ

Explain about operating system services, Q. Explain about Operating System ...

Q. Explain about Operating System Services? An operating system offers services to programs and to users of those programs. It provided by one environment for execution of

Explain the steps in deadlock recovery, Explain the steps in deadlock recov...

Explain the steps in deadlock recovery. a)      Exterminate off all processes involved - drastic. b)      Exterminate off one at a time till deadlock gone - select a victim.

What are the steps followed in testing, What are the steps followed in test...

What are the steps followed in testing? i. Unit testing - The individual components are tested in this type of testing. ii. Module testing - Related collection of independen

Develop a utility in c programming, Develop a utility in C language which w...

Develop a utility in C language which will run in Linux operating systems to display following properties of the system: ? Processor speed ? Ram size ? Computer name ? System time

Define dynamic loading, Define dynamic loading. To obtain better memory...

Define dynamic loading. To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a routine is not loaded until it is called. All routines are ke

What are batch systems, What are batch systems? Batch systems are quite...

What are batch systems? Batch systems are quite appropriate for implementing large jobs that need little interaction. The user can submit jobs and return later for the results.

What is a path name, What is a path name? A pathname is the path from t...

What is a path name? A pathname is the path from the root by all subdirectories to a specified file. In a two-level directory structure a user name and a file name explain a pa

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd