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
Write short note on recovery regarding the file system in Windows 2000. In many file systems a power breakdown at the wrong time can damage the file system data structures so s

Minor page fault :I f the page is loaded in memory at the time the fault is started, but is not checked in the memory management unit as being loaded in memory, then it is named a

Discuss the high barriers to entry in the market for PL operating systems

What advantages are there to this two-level directory? Users are isolated from each other. Users have more freedom in choosing file names.

Problem 1: (a) What are the likely benefits which an organisation may derive from the planning process? (b) Explain the main reasons why an organisation may fail to plan.

Characteristics of suspend process Suspended process isn't immediately available for execution. The process may or may not be waiting on an event. For preventing t

Which are the different states of a process?   Different status of a process is: New: When the process is created. Running: When instructions are executed. Wait

A daemon is a process that removes itself from the terminal and disconnected, executes, in the background, waiting for requests and responding to them. It may also be described as

What is virtual file system? A Virtual file system switch (VFS) or Virtual file system is an abstraction layer   on top of a more concrete file system. The purpose of a VFS

Explain the BeginThread Function used in the NetWare example code BeginThread(MyThread Function, stack,size, arg) BeginThread creates a thread and places it on the NetWar