answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vsevolod [243]
2 years ago
11

In Section 8.5.4, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain ord

er. However, we also point out that deadlock is possible in this situation if two threads simultaneously invoke the transaction () function. Fix the transaction () function to prevent deadlocks.
Computers and Technology
1 answer:
ruslelena [56]2 years ago
4 0

Answer:

See Explaination

Explanation:

Separating this critical section into two sections:

void transaction(Account from, Account to, double amount)

{

Semaphore lock1, lock2;

lock1 = getLock(from);

lock2 = getLock(to);

wait(lock1);

withdraw(from, amount);

signal(lock1);

wait(lock2);

deposit(to, amount);

signal(lock2);

}

will be the best solution in the real world, because separating this critical section doesn't lead to any unwanted state between them (that is, there will never be a situation, where there is more money withdrawn, than it is possible).

The simple solution to leave the critical section in one piece, is to ensure that lock order is the same in all transactions. In this case you can sort the locks and choose the smaller one for locking first.

You might be interested in
You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
shtirl [24]

Answer:

a)

Explanation:

Since the worksheet contains most of the data that you need, there is a decent possibility that it also contains the data that you are missing. Therefore, you should check for data you have previously hidden. Sometimes, some data in a worksheet may become irrelevant in a given moment, and instead of deleting it since it may be useful later most people tend to make that data hidden. So checking for previously hidden data may be the best solution in this scenario.

7 0
1 year ago
What technique creates different hashes for the same password? ccna routing protocols final answers?
elena-s [515]
The answer is Salted Password Hashing.  The process is similar to hashing., but with a twist. A random value is introduced for each user. This salt value<span> is included with the password when the hash value is calculated and is stored with the user record. Including the salt value means that two users with the same password will have different password hashes.</span>
7 0
2 years ago
Choose the response that best completes the following statement.
lisabon 2012 [21]
I am guessing. My guess is code.
7 0
1 year ago
Read 2 more answers
Which feature of a typical professional networking site helps users add professional details to their profile ?
ludmilkaskok [199]
All I  could find are networking cites allow people to take pics of themselves for a personal effect! hope this is what your looking for.
7 0
1 year ago
Read 2 more answers
To be a successful computer systems engineer, you must be proficient in programming languages and operating systems. Similarly,
Maslowich

Collectively, skills like the ones listed above are Technical skills. These skills refer to the Knowledge and ability to perform specific tasks. However, Soft skills are also important, because they relate to the ability to interact and communicate effectively with people.

6 0
2 years ago
Read 2 more answers
Other questions:
  • A ____ partition contains the data necessary to restore a hard drive back to its state at the time the computer was purchased an
    8·2 answers
  • When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being
    11·2 answers
  • Which of the following best defines the term cross-platform application?(A) A program used to coordinate data sharing among mult
    14·2 answers
  • In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all
    7·1 answer
  • What output is produced by the following program segment? Why? (Recall that name.charAt(i) is the i-th character in the string,
    11·1 answer
  • Explain why Windows and Linux implements multiple locking mechanisms. Describe the circumstances under which they use spinlocks,
    13·1 answer
  • You have been employed as a technical consultant to a computer shop chain. You are given the task of creating a short consumer b
    12·1 answer
  • A company decides to relocate its operations to another state in order to take advantage of some new business investment credits
    15·1 answer
  • Consider the packets exchanged in TCP connection setup between Host A and Host B. Assume that Host A's initial sequence number i
    7·1 answer
  • Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!