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
Organizational, Structural, Logical and Execution Relationships Between Important System Components in Linux Kernel Subsystems A. Description of the Project You are require


What are the advantages of Linked allocation? The benefits are a. No external fragmentation b. Size of the file does not require to be declared

What is a Process Control Block? Every process in the operating system is represented by a process control block as well called a task control block. It contains several pieces

Multitasking - An Operating systems that is proficient of allowing multiple software processes to be run at the same time. Below are some instances of multitasking Operating Syste

Transparency : Users must be able to access remote resources as though these resources were local. Transparency should as well promote user mobility. Users must be allowed to lo


What is the use of inter process communication. Inter process communication gives a mechanism to allow the co-operating process to communicate with each other and synchronies t

Determine a component of a process precedence sequence Process name, Sequence operator ‘;’ and Concurrency operator ‘,’

Safety algorithm : This is to make sure if the system is in safe state or not. It may need an order of m x n2 operation to determine if the state of the system is safe or not.