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
Gopher Gallery consists of a shopping mall and a cart ride that covers  the 150 acre habitat. There are m visitors and n single-person vehicles. Visitors  stroll around the mall at

Explain Chaining to Handle Collision Chaining:  One easy scheme is to chain all collisions in lists attached to the suitable slot. This permits an unlimited number of collision

Using pages makes it easier to manage the whole memory, avoiding excessive fragmentation and waste. As an analogy, think of Tetris, but with only square blocks: it is relatively ea

BEST FIT ALGORITHM Here scanning is for the finest fit one. Signifies it searches the entire list for the best fit position. For the process therefore in that the process will

RESOURCE ALLOCATION GRAPH When a process Pi wishes an instance of resource type Rj, a request edge is inserted in the resource allocation graph. When this request is able to be

What is a file? A file is a named collection of related information that is recorded on secondary storage. A file having either programs or data. A file has particular "structu

How does a program execution take place in multiprogramming? While the processor is dealing with a number of programs, the sequence with which programs are implemented will de

Suppose your process starts up, and allocates some memory with malloc(). The allocator will then give part of a memory page to your process. The OS then updates the corresponding p

Task 1 description: Design and implement the disableuser.sh script. Required script functionality: disableuser.sh -v : prints the script version number and exits dis

What is the use of fork and exec system calls? Fork is a system call by which a latest process is created. Exec is also a system call, which is used after a fork by one of the