Questions tagged [deadlocks]

In OS, a deadlock is where two or more processes are waiting indefinitely for an event that can be caused by one of the waiting processes. Deadlock is a common problem in distributed systems, parallel computing & multiprocessing systems.

Filter by
Sorted by
Tagged with
0 votes
2 answers
58 views

Why does a lock ordering prevent deadlocks?

I am reading C++ Concurrency in Action and it says that always locking mutexes in a certain order prevents deadlocks. However, this is not a computer science book and no proof is given for this claim. ...
Bart Louwers's user avatar
0 votes
0 answers
25 views

Least amount of resources required in order to prevent deadlock?

Precedence graph of 6 processes and each number of resources they need to be fully executed is as follows: Process Resource A Resource B P1 4 2 P2 2 3 P3 3 2 P4 4 1 P5 3 2 P6 2 1 What is the ...
Amirhosein Yousefi's user avatar
0 votes
1 answer
98 views

Bankers Algorithm - maximum number of processes

I recently got the following question in my exam. Q1) In the banker's algorithm, if the total number of resources in the system is 20 and the maximum resource allocation for a process is 5, what is ...
ray an's user avatar
  • 115
0 votes
1 answer
31 views

Naive Read-Write Lock

Consider the simply read-write lock algorithm that allows many readers and a single writer. Why is this algorithm flawed? I was thinking about the implementation of a well-known read-write lock ...
user166476's user avatar
0 votes
1 answer
75 views

Deadlock in LockTwo Algorithm

I was reading the Book: The Art of Multiprocessor Programming; Section 2.3.2. and I have a doubt regarding their $\texttt{LockTwo}$ algorithm mentioned in Page 26. The snippet of the algorithm is: <...
Equation_Charmer's user avatar
0 votes
1 answer
58 views

Reader / writer locking algorithm

I'm pretty sure there's a textbook solution to this problem, but I haven't figured it out. I have fixed-size blocks of data arranged in a sequence: block 0, block 1, etc.. There are reader threads ...
ccleve's user avatar
  • 129
1 vote
1 answer
368 views

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

I am confused as to why 2 threads waiting for a lock from each other will result in a deadlock. Let's say I have a Thread 1 that needs to execute contents in Lock 1 and then Lock 2 and a Thread 2 that ...
Adam Lee's user avatar
  • 213
0 votes
3 answers
385 views

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?

I know deadlock occurs when Process A has resource R1 and is waiting for resource R2, while process B has resource R2 and is waiting for resource R1, however why don't both processes just let go of ...
Salma Osama's user avatar
1 vote
0 answers
103 views

Starvation and Livelock

I think Option C is false. Following is my thought process: Starvation in general mean Process is waiting indefinitely for the resource or to get scheduled etc. [A/c to Galvin Book]. So, here in this ...
sgoel's user avatar
  • 41
0 votes
0 answers
31 views

Different ways to avoid deadlocks

I am thinking of techniques that we can implement in order to avoid deadlocks in processes. While I am aware of some tactics, e.g. killing a process when we reach a deadlock, or using spooling, would ...
average_discrete_math_enjoyer's user avatar
1 vote
1 answer
1k views

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

Cheers, so my textbook explains these parts very poorly, so I would gladly take any advice! I am confused between the test-and-set instructions, which per my book is a very common CPU instruction set, ...
average_discrete_math_enjoyer's user avatar
0 votes
0 answers
115 views

Minimal number of resources such that the system is considered safe?

In a system with a single type of resource, there are 8 processes with the following maximal requirements: Process P1 P2 P3 P4 P5 P6 P7 P8 MAX 75 60 65 35 30 45 30 30 Specify the minimal value for ...
Alin Salagean's user avatar
0 votes
0 answers
32 views

Deadlock still occurs

Is it in in a deadlocked state? In this graph, there is a deadlock initially I think. Since P1 is holding R1 and waiting for R2; P2 is holding R2 and waiting for R1 and R3; P3 is holding R3 and ...
user129260's user avatar
1 vote
1 answer
180 views

Exit a deadlock cycle

Suppose i have the following resource allocation graph with a deadlock cycle, i see why it is a deadlock cycle, what i don't get is how to recover from this cycle i'm thinking about aborting a ...
Fibi's user avatar
  • 111
1 vote
1 answer
206 views

Does Dekkers solutions to critical section problem ensure progress?

I was reading concurrency control section from Operating Systems book by William Stallings. In this book, he gives three attempts by Dekker to give solution to critical section problem: Attempt 1 <...
RajS's user avatar
  • 1,667
-1 votes
2 answers
529 views

Is this a deadlock?

Consider we have two processes P1 and P2. There are also two semaphores M and N which are initialized to zero. Here's how they execute: ...
Andrew Scott's user avatar
1 vote
0 answers
197 views

How to prove that an algorithm has no deadlock

I need to mathematically prove that this algorithm is deadlock-free: ...
PorcoDioBastardo's user avatar
-2 votes
2 answers
364 views

Deadlocks in operating System

Consider a system with 6 processes, where each process needs 2 copies of Resource R. The maximum units of R required to cause deadlock is ??
Gokul's user avatar
  • 1
0 votes
0 answers
161 views

What are necessity and sufficiency?

I was reading deadlock topic from Operating Systems book by Stallings. It states four pre requisites for deadlock: Mutual exclusion No preemption Hold and wait Circular wait It then have following ...
RajS's user avatar
  • 1,667
1 vote
1 answer
465 views

How can I solve this deadlock related problem mathematically?

I came across following problem: A system has n resources R0,…,Rn-1,and k processes P0,….Pk-1.The implementation of the resource request logic of each process Pi is as follows: ...
RajS's user avatar
  • 1,667
1 vote
0 answers
27 views

Comparing wait-signal alternatives for synchronizing two piece of programs

I came across following problem: A certain computation generates two arrays a and b such that ...
RajS's user avatar
  • 1,667
2 votes
1 answer
241 views

Designing solution to critical section problem with two semaphores vs single semaphore

I came across following problem: Let two processes P1 and P2 are there: ...
RajS's user avatar
  • 1,667
2 votes
0 answers
41 views

Does this state certify to be called as a deadlock?

I came across following problem: Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others ...
RajS's user avatar
  • 1,667
1 vote
1 answer
177 views

Can 2-philosophers problem be analogous to dining philosophers problem?

Two philosophers A and B, two forks numbered "1", "2"; A needs both "1" and "2" for eating, so does B. Is this theoretical a dining philosopher problem? I'm questioning about the forks philosopher A ...
asap diablo's user avatar
2 votes
1 answer
578 views

Deadlock vs "Progress" requirement of the solution to the critical section problem

I came across following problem: Consider following code: ...
RajS's user avatar
  • 1,667
1 vote
1 answer
2k views

Can a safe state in Banker's Algorithm cause deadlock eventually?

I know that unsafe state does not always mean deadlock. That is a situation that banker's algorithm does not detect deadlock accurately. I am just wondering if there is any example of a safe state ...
MChotdog's user avatar
  • 113
1 vote
1 answer
870 views

What fraction of all combinations is guaranteed to be deadlock free?

I found this question in the exercise of Tanenbaum (operating systems): Two processes, $A$ and $B$,each need three records $1, 2, \text{ and } 3$ in a database. If $A$ asks for them in the order $...
laura's user avatar
  • 327
3 votes
1 answer
1k views

How do modern Operating Systems detect process starvation?

So first off do the modern operating systems like windows and linux have a method for detecting starvation? if not, why? and if they do, then how are they going to detect starvation of a process? (...
John P's user avatar
  • 750
-1 votes
1 answer
259 views

I have a question about resource alocation to avoid dead lock

In the code below, three processes are competing for six resources labeled A to F.How can I modify the get request in each procedure in this graph to avoid dead lock You cannot move requests ...
Afraz Afaq's user avatar
0 votes
0 answers
44 views

Banker's algorithm

I have a question regarding the banker's algorithm step 2. When it says the Need[i] <= work. Need is an n * m matrix and work is a vector of length m. I want to know what Need[i] <= Work means. ...
rert588's user avatar
  • 261
1 vote
1 answer
54 views

deadlock caused by a cyle of locks ? unprobable event causing it or just a false intuition

Thanks a lot for your help. I want to understand what really causes what I suppose to be a deadlock: I have standards objects, let's call it 'Words' that contains 3 letters and a key; (it doesn t ...
StudentInFinance's user avatar
3 votes
1 answer
993 views

Does starvation freedom imply progress?

The above answer taken from the book https://www.amazon.com/Operating-Systems-Sibsankar-Haldar/dp/8131730220 says starvation freedom may not imply progress as processes can be deadlocked. I think ...
Zephyr's user avatar
  • 993
0 votes
0 answers
38 views

Deadlock necessary conditions [duplicate]

I read that the 4 conditions for deadlock prevention are necessary conditions and not sufficient. The four necessary conditions are :- Mutual exclusion. Hold and wait. No preemption. Circular wait. ...
Ramesh's user avatar
  • 391
1 vote
0 answers
56 views

Does the following piece of code lead to a deadlock?

Process X ...
Krish__'s user avatar
  • 23
2 votes
0 answers
2k views

Resource Allocation Graph Algorithm

In the book Operating System Concepts, it is said that: A claim edge $P_i \rightarrow R_j$ indicates that process $P_i$ may request resource $R_j$ at some time in the future. [emphasis added] ...
Mooncrater's user avatar
0 votes
1 answer
1k views

Deadlock and safe state

I read that system being in safe state doesn't guarantee that deadlock is not possible. Can someone give me an example where system is in safe state and deadlock is possible?
Zephyr's user avatar
  • 993
1 vote
0 answers
61 views

Is a single starved process considered deadlocked?

In regard to the critical section problem, an algorithm that switches between allowing one of two processes, P1 or P2, to complete their critical section would cause starvation for P1 if P2 stayed in ...
Adriankusiak's user avatar
4 votes
1 answer
2k views

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

I'm looking for an application of the dining philosophers problem. Is there some real life system that faces the concurrency problem of "the dining philosophers problem" and implements a solution? I'...
842Mono's user avatar
  • 223
7 votes
3 answers
2k views

Bounded waiting and starvation free in critical section problem

I have 4 questions regarding relation between starvation and bounded waiting. 1.Does starvation-freedom imply deadlock-freedom? My Answer: From here, definition of starvation free is Freedom from ...
laura's user avatar
  • 327
2 votes
1 answer
776 views

When will deadlock occur in this producer-consumer code

I was reading about Producer Consumer problem from Operating Systems by William Stallings where following code was given: ...
Mahesha999's user avatar
  • 1,743
0 votes
2 answers
4k views

difference between deadlock avoidance and detection

I know the difference between deadlock prevention and avoidance. But i want to know the difference between deadlock avoidance and detection. ?
dulaj sanjaya's user avatar
6 votes
6 answers
7k views

Does Deadlock imply Starvation

If there is a deadlock between the processes does that mean that there is starvation also? My Thinking: deadlock is no process using that resources , but starvation is like not giving chance to only ...
Pavan Kumar Munnam's user avatar
0 votes
1 answer
463 views

Is Bounded Waiting satisfied for this 2 process Solution?

This is my new post linked with my previous post. Is bounded waiting satisfied in the 2 Process Solution? The answer in that post was very useful and cleared many concepts, but I just want to apply ...
Garrick's user avatar
  • 462
2 votes
1 answer
907 views

Is bounded waiting satisfied in the 2 Process Solution?

Suppose, There are $2$ processes $P1$ and $P2$. It is given that Mutual Exclusion and Progress are satisfied by these $2$ processes. Suppose, Programming protocol is designed such that CPU only ...
Garrick's user avatar
  • 462
0 votes
1 answer
75 views

Deadlock not possible?

System is in safe state if there exists a safe sequence of all processes. Sequence $[P_1, P_2 …P_n]$ is safe, if for each $P_i$ the resources that can still request can be satisfied by $P_i$ ...
Tobi Alafin's user avatar
  • 1,617
3 votes
1 answer
1k views

Why deadlock in cigarette smokers problem

"The Little Book of Semaphores" (2nd Ed. by Allen B. Downey, section 4.5.1) as well as Wiki (link) mentioned that a trivial solution (as shown below) to the 'Cigarette smokers problem' will cause a ...
KGhatak's user avatar
  • 229
4 votes
1 answer
192 views

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

I'm interested in knowing things about the computability of concurrent programs. If you had a Turing complete language that also let you branch off new programs but had no means of communication ...
Jake's user avatar
  • 3,810
-3 votes
1 answer
917 views

A Dead-lock in an Operating System is

A Dead-lock in an Operating System is Desirable process Undesirable process Definite waiting process All of the above My attempt: As "If a process is unable to change its state indefinitely because ...
Mithlesh Upadhyay's user avatar
0 votes
1 answer
898 views

Is bounded waiting satisfied in this 2 process solution?

Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes: ...
Garrick's user avatar
  • 462
6 votes
1 answer
4k views

How to satisfy bounded waiting in case of deadlock?

I have a doubt regarding bounded waiting. Deadlock implies no Progress because the processes take indefinite time to decide who will enter the critical section . But, Does deadlock implies no ...
Garrick's user avatar
  • 462