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
What are the objectives of operating system? Objectives of OS 1.      Convenience: An OS makes a computer more suitable to use. 2.      Efficiency : An OS allows t

What is a two state process model?   At any time a process is being implementing by a processor or not. Therefore a process may be in Running or not running state. When an Ope


Questiion 1 What is RTOS? What are its requirements? Questiion 2 Explain the structural elements of a real time system mode Questiion 3 What is kernel? Explain abo

Worst Fit Algorithm Here we obtain the largest space available for the smallest. Therefore after that process entered there will be much more space remaining. In this space we

What is a reference string? An algorithm is evaluated by running it on a particular string of memory references and computing the number of page faults. The string of memory re


What are the main advantages of the microkernel approach to system design? Benefits typically contain the following  (a) Adding a new service does not require modifying the

Define FIFO Page Replacement Algorithm This policy simply eliminates pages in the order they arrived in the main memory. By using this policy we simply remove a page based upo

Q. Consider a system in which a program is able to be separated into two parts: code and data. The CPU recognizes whether it wants an instruction (instruction fetch) or data (data