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
The __________ of a desktop computer is the case that houses the computerâs critical parts, such as the processing and storage d
Phantasy [73]
You said it in your question. The case! Though it's also given other names, such as housing, chassis, enclosure etc.
4 0
1 year ago
Information gathered from observing a plant grow 3 cm over a two-week period results in _______.a. inferences. b. variables. c.
Leya [2.2K]

Answer:

The answer is d. Data

Explanation:

information gathered from observing a plant grow 3 cm over a two-week period results in Data

data is facts and statistics collected together for reference or analysis.

Data is any information that has been collected, observed, generated or created to validate original research findings

6 0
2 years ago
Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors p
jasenka [17]

Answer:

19.71 ms

Explanation:

The disk rotates at 3600 rpm, hence the time for one revolution = 60 / 3600 rpm = 16.67 ms.

Hence time to read or write on a sector = time for one revolution / number of sectors per track = 16.67 ms / 32 sectors = 0.52 ms

Head movement time from track 8 to track  9 = seek time = 2 ms

rotation time to head up sector 1 on track 8 to sector 1 on track 9 = 16.67 * 31/32 = 16.15 ms

The total time = sector read time +head movement time + rotational delay + sector write time = 0.52 ms + 2 ms + 16.15 ms + 0.52 ms = 19.19 ms

3 0
1 year ago
Marco makes $65,000 a year as a graphic designer. He makes a charitable donation of $1,000 each year. He also has $5,000 of busi
iogann1982 [59]
The correct answer is $59,000. 
5 0
1 year ago
Read 2 more answers
3) 5, 10, 15, 20 are items of data. Explain how these could become information and what knowledge
yKpoI14uk [10]

For example when there is research on how many people shoplift in a shopping centre per week. These numbers could show a increase in the number of shoplifters per week.

8 0
1 year ago
Other questions:
  • A circuit contains three resistors connected in parallel. The value of R1 is 2 K , the value or R2 is 6 K , and the value of R3
    5·1 answer
  • An mp3 takes up about 16 kilobytes of memory per second of music. if you owned a one terabyte hard drive and filled it with only
    15·1 answer
  • Open this link after reading about Ana's situation. Complete each sentence using the drop-downs. Ana would need a minimum of ato
    5·2 answers
  • In cell B16, enter a function to calculate the total attendance for the years 2014 through 2018 using the totals in the range B1
    10·1 answer
  • If the computer has an encrypted drive, a ____ acquisition is done if the password or passphrase is available. a. passive b. sta
    8·1 answer
  • Design a GUI program to find the weighted average of four test scores. The four test scores and their respective weights are giv
    5·1 answer
  • Mara's presentation included essential information about the company's new safety procedures. She wanted to make
    13·2 answers
  • 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
  • A summer camp offers a morning session and an afternoon session.
    5·1 answer
  • What measures are needed to trace the source of various types of packets used in a DoS attack? Are some types of packets easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!