search
Log In
0 votes
61 views
In an electronic funds transfer system, there are hundreds of identical processes that work as follows. Each process reads an input line specifying an amount of money, the account to be credited, and the account to be debited. Then it locks both accounts and transfers the money, releasing the locks when done. With many processes running in parallel, there is a very real danger that a process having locked account $x$ will be unable to lock $y$ because $y$ has been locked by a process now waiting for $x.$ Devise a scheme that avoids deadlocks. Do not release an account record until you have completed the transactions. (In other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)
in Operating System 61 views

1 Answer

0 votes
We can number the accounts to avoid circular wait. Process acquires lock in increasing order of account number.  No deadlock possible now as we are providing a order in which resources can be requested.

Related questions

0 votes
0 answers
2
37 views
Main memory units are preempted in swapping and virtual memory systems. The processor is preempted in time-sharing environments. Do you think that these preemption methods were developed to handle resource deadlock or for other purposes? How high is their overhead?
asked Oct 30, 2019 in Operating System Lakshman Patel RJIT 37 views
0 votes
1 answer
3
53 views
One way to prevent deadlocks is to eliminate the hold-and-wait condition. In the text it was proposed that before asking for a new resource, a process must first release whatever resources it already holds (assuming that is possible). However, doing so introduces ... that it may get the new resource but lose some of the existing ones to competing processes. Propose an improvement to this scheme.
asked Oct 30, 2019 in Operating System Lakshman Patel RJIT 53 views
0 votes
1 answer
4
60 views
Two processes, $A$ and $B,$ each need three records, $1, 2,$ and $3,$ in a database. If $A$ asks for them in the order $1, 2, 3,$ and $B$ asks for them in the same order, deadlock is not possible. However, if $B$ asks for them ... resources, there are $3!$ or six possible combinations in which each process can request them. What fraction of all the combinations is guaranteed to be deadlock free?
asked Oct 30, 2019 in Operating System Lakshman Patel RJIT 60 views
...