Explain about deadlocks, Operating System

Q. Explain about Deadlocks?

Deadlocks

for (int i = 0; i < n; i++) {

// first find a thread that can finish

for (int j = 0; j < n; j++) {

if (!finish[j]) {

boolean temp = true;

for (int k = 0; k < m; k++) {

if (need[j][k] > work[k])

temp = false;

}

if (temp) { // if this thread can finish

finish[j] = true;

for (int x = 0; x < m; x++)

work[x] += work[j][x];

}

}

}

}

At present there are two resources available. It is an system is in an unsafe state as process P1 could complete thereby freeing a total of four resources. But we can't guarantee that processes P0 and P2 can complete. Nevertheless it is possible that a process may release resources before requesting any further. For instance process P2 could release a resource thereby increasing the total number of resources to five. This permit process P0 to complete which would free a total of nine resources thereby allowing process P2 to complete as well.

Posted Date: 7/27/2013 4:01:01 AM | Location : United States







Related Discussions:- Explain about deadlocks, Assignment Help, Ask Question on Explain about deadlocks, Get Answer, Expert's Help, Explain about deadlocks Discussions

Write discussion on Explain about deadlocks
Your posts are moderated
Related Questions
Define the Main reason to encrypt a file Major reason to encrypt a file is secure it for transmission.

What is an acyclic graph? A tree that has been corrupted by links to other branches, but does not have any cyclic paths in it.

Describe the file system architecture. File System Architecture contains the subsequent components:- Device Driver 1 Device Driver 2 Device Driver 3 Basic fi

function of lazy swapper

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

Assignment What I'm covering: General control flow fork() execlp() Parameters Makefiles Additional Questions General Control Flow/fork(

Another solution then would be to keep a pool of threads. Whenever a new task arrives, the system would simply get a thread from pool and set that thread to work on the given task.

A paper mill produces two grades of paper viz., X and Y. Because of raw material restrictions, it cannot produce more than 400 tons of grade X paper and 300 tons of grade Y paper i

The Cigarette-Smokers difficulty Consider a system with three smoker processes and one agent process. Every smoker continuously rolls a cigarette and then smokes it. But to roll as

Define Instance. An instance is an administrative unit in which components of R/3 systems giving one or more services are grouped together.  The services offered by a case are