17 votes
Accepted

Why unsafe state not always cause deadlock?

Deadlock means something specific: there are two (or more) processes that are currently blocked waiting for each other. In an unsafe state you can also be in a situation where there might be a ...
Wandering Logic's user avatar
12 votes
Accepted

Does Deadlock imply Starvation

You should first state the deadlock freedom property and the starvation freedom property more precisely. I use the definition in the Book: The Art of Multiprocessor Programming; Section 2.2. Freedom ...
hengxin's user avatar
  • 9,461
10 votes

Why unsafe state not always cause deadlock?

Just to expound on what Wandering Logic was saying. Say I have two threads that both need access to X and Y, and have no synchronization and no mechanism to fix deadlock. This is unsafe, as one could ...
JustAnotherSoul's user avatar
10 votes
Accepted

Minimum number of processes for the deadlock?

I agree that no deadlock is possible here. If there are three or fewer processes, there clearly cannot be a deadlock because there are enough resources for every process to just hold two resources the ...
David Richerby's user avatar
6 votes
Accepted

How to satisfy bounded waiting in case of deadlock?

You are correct. Consider the simple synchronization algorithm which denies entry to all processes. In this case we have both deadlock and bounded waiting, since any process $p$ is not bypassed by ...
Ariel's user avatar
  • 13.3k
5 votes
Accepted

How does lack of deadlock relate to computability in process calculi?

I think you are asking about expressivity of concurrent programming languages. This is a deep and not well-understood field. For example you say that "the $\pi$-calculus [...] has the power to ...
Martin Berger's user avatar
4 votes
Accepted

What is the difference between "deadlock prevention" and "deadlock avoidance"

It seems that deadlock prevention and deadlock avoidance are two names for the same concept. Indeed, the Wikipedia section on deadlock avoidance has been marked as redundant. While the distinction ...
Yuval Filmus's user avatar
4 votes

How probable is a deadlock in the dining philosophers problem

the dining philosopher problem seems to be somewhat of a pedagogical "toy" example of concurrency and (dead)locking concepts for educational purposes. however it is studied seriously in some ...
vzn's user avatar
  • 11k
4 votes

When do deadlocks occur?

All 4 conditions must be satisfied at the same time. Hold and Wait Non-preemption of resources Mutual Exclusion Circular wait In case of single instance of resources: Cycle in resource allocation ...
Neelesh Shukla's user avatar
4 votes
Accepted

Why deadlock in cigarette smokers problem

Agent A consumes agentSem, and produces tobacco and paper. That might make Smoker I smoke but he is late: Smoker II already took the paper and Smoker III took tobacco. Now, all the smokers are stuck,...
chi's user avatar
  • 14.4k
4 votes
Accepted

Provide some help regarding the "Dining Philosophers Problem"?

Righties: will never try to acquire the left fork before they have the right one. Lefties: will never try to acquire the right fork before they have the left one. Deadlock: Assume that you reached ...
Ariel's user avatar
  • 13.3k
4 votes
Accepted

Bounded waiting and starvation free in critical section problem

No, starvation-free doesn't imply bounded waiting. For instance, consider a procedure that never even attempts to acquire any lock; but the amount of time it takes is variable and can be arbitrarily ...
D.W.'s user avatar
  • 154k
3 votes
Accepted

A Dead-lock in an Operating System is

Your attempt "If a process is unable to change its state indefinitely because the resources requested by it are being used by another waiting process, then the system is said to be in a deadlock." is ...
gnasher729's user avatar
  • 27.7k
3 votes
Accepted

Is Bounded Waiting satisfied for this 2 process Solution?

In the following, I treat the first two statements acquire(lock1) acquire(lock2) as "trying", the middle two statements ...
hengxin's user avatar
  • 9,461
3 votes

Is bounded waiting satisfied in the 2 Process Solution?

A little remark first: The bounded waiting (BW) property is defined with respect to algorithms, which is in turn defined as a set of concrete executions. Thus, we cannot conclude whether an algorithm ...
hengxin's user avatar
  • 9,461
3 votes

difference between deadlock avoidance and detection

Simply to put Deadlock avoidance: you employ some methods to avoid the deadlock ,but prevention is more restrictive than avoidance. Deadlock detection: Here only the detection only takes place ...
Pavan Kumar Munnam's user avatar
3 votes

For a given certain situation how to prove that the system will never get into the state of Deadlock

The question in the given situation is equivalent to the question: is it possible to create or to design a system such that m processes sharing n resources of the same type may enter a deadlock state ...
John Frederick Chionglo's user avatar
3 votes

How probable is a deadlock in the dining philosophers problem

I don't know what algorithm the philosophers follow, but let's assume that deadlock is reached if all philosophers try to start eating at the very same time. Since your time is discrete, under any ...
Yuval Filmus's user avatar
3 votes
Accepted

Bankers Algorithm-Is the system in safe state?

you can say there is no deadlock if there is a safe sequence for the completion, after $P1$ request is granted there must be a safe sequence where by which every process is completed. ...
Pavan Kumar Munnam's user avatar
3 votes
Accepted

Is this solution to the dining philosopher's problem entirely valid?

The description of an altruistic philosopher given in this answer, that you quoted in your question, is slightly imprecise. What it really is going on is that: A possible approach for avoiding ...
Patrick Trentin's user avatar
3 votes

A real life system that faces and solves the dining philosophers problem

The dining philosopher's problem is a worst case scenario used to illustrate issues in algorithms. It's a test case. You probably won't find a static one-to-one mapping between it and a real world ...
orlp's user avatar
  • 12.6k
3 votes
Accepted

In Operating Systems, I can't understand why deadlock happens, why does a process not let go of a resource when it is done using it?

To answer part of your question: Processes are not smart. Processes just execute the code of their program, so if the program of P1 has not been written to release R1 when it's done with it, it won't ...
Steven's user avatar
  • 27.4k
3 votes
Accepted

Deadlocks: Why if 2 threads are waiting for a lock from each other results in a deadlock?

The situation you are describing is not a deadlock. A deadlock would be more like this: Both Thread A and Thread B require both Lock 1 and Lock 2. Thread A first acquires Lock 1, then Lock 2. Thread ...
Jörg W Mittag's user avatar
2 votes
Accepted

Falsifying the "Circular Wait" Condition - Deadlock Prevention

It's fixed. Your example violates the protocol. If the process needs mutually exclusive access to both the tape drive and the disk drive, then it needs to take locks in increasing order, i.e. first ...
Derek Elkins left SE's user avatar
2 votes
Accepted

Does the following modified Two-Phase Locking protocol ensure serializability and freedom from deadlock?

The question is not clear about the details, but assuming said resources are always locked-then-accessed sequentially, then a deadlock is not possible to occur. Since the locks are always obtained in ...
Marcelo De Zen's user avatar
2 votes

When will deadlock occur in this producer-consumer code

It will be caused as follows: Both processes blocked at the end, hence deadlocked.
Mahesha999's user avatar
  • 1,745
2 votes
Accepted

How are semaphores and test-and-set instructions connected?

Semaphores are an abstract mechanism to control access to a shared resource. Other such mechanisms exist, for example locks and monitors. These are the counterparts of abstract data structures – they ...
Yuval Filmus's user avatar
1 vote

Does Deadlock imply Starvation

Starvation, as the name suggested, is when a process can acquire the lock, but it is being overlooked. It starves even with resources being available. There is no deadlock in starvation; each process ...
N. Osil's user avatar
  • 111
1 vote
Accepted

Deadlock not possible?

Lets say for the sake of argument we have 6 units of memory available and three processes in a current state where each holds 2 resources. Each process needs 3 resources to finish and release its ...
lPlant's user avatar
  • 1,602

Only top scored, non community-wiki answers of a minimum length are eligible