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
Synchronization In communication among processes messages passed may be blocking or nonblocking - also called as synchronous and asynchronous. Blocking send : The sending pr


I need help implementing malloc

What is meant by file management systems? File Management systems are as well referred to as simply a file system .File system is the system that an OS operating system or prog

Consider the following C program where M, N, K are predefined constants. Assume int is 4 bytes. Suppose this program is run on a machine with 4KB page size and 32 TLB entries. Init

Briefly discuss on I/O hardware? A controller is a collection of electronics that can operate a port, a bus, or a device. A serial-port controller is an easy controller. It is

What are batch systems? Early computers were physically huge machines run from a console. The general input devices were card readers and tape drivers. The common output device

Q. What are two differences among user-level threads and kernel-level threads? Under what situations is one type better than the other? Answer: (1) User-level threads are un

Cold Backup: It is copying the three groups of files when the object is shut down. This is a straight file copy, generally from the storage disk directly to tape. You must end th

Load Sharing : Processes are not given to a particular processor. A global queue of threads is used to maintain. Each processor, when idle, picks a thread from this queue. Note th