1answer.
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
Travka [436]
4 years ago
14

Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw(

amount). These two methods are passed the amount that is to be deposited or withdrawn from a bank account. Assume that a husband and wife share a bank account and that concurrently the husband calls the withdraw() method and the wife calls deposit(). Describe how a race condition is possible and what might be done to prevent the race condition from occurring.
Computers and Technology
1 answer:
Fittoniya [83]4 years ago
4 0

Answer:

Race Condition is possible if husband and wife both have concurrent functionality.

Explanation:

For eg. if Balance = 3000 and husband withdraws = 1000 then remaining balance is = 2000.

One the other hand if balance is 3000 and wife deposits =1000 then remaining balance is 4000

we can see that there is inconsistency that is not acceptable.

To solve the problem mostly we are using Peterson's Algorithm

Account can be used for husband and wife,

int flag = 0

boolean account

1 :Husband

do{

account[i] =TRUE;

flag=(i+1)%2

while (account [(i+1)%2] && turn =(i+1)%2;

withdraw();

account[i] = FALSE

(remainder)

} While (TRUE);

This process can be repeat with (Wife)  where i will be replaced by j ,i=0 or 1 and j =1 or 0

  • flag identify which is going to access the bank account
  • account make sire that 2 users are mutually exclusive

Proved the race condition is prevented

You might be interested in
High speed printer that produce higher quality printouts but are more expensive is
lukranit [14]

Answer:

i think its D, laser printer

Explanation:

8 0
3 years ago
A program similar to mtr, ____, is available as a command-line utility in Windows operating systems.
KATRIN_1 [288]

Answer:

pathping

Explanation:

3 0
2 years ago
(10 LC)
barxatty [35]

Answer:

college A

Explanation:

7 0
3 years ago
The government now requires physicians to store patient information in databases that are accessible in multiple locations by mu
musickatia [10]

Answer:

.

Explanation:

3 0
3 years ago
Typically, when an organization purchases Internet access from an Internet Service Provider (ISP), the ISP will grant it
Radda [10]

Answer:

(B) A single public IP address that it can use for NAT

Explanation:

Because the IPV4 IP protocol is still used today, the number of available IP addresses is limited (only 4,294,967,296 addresses in the world), for this reason, the most correct practice is the assignment of a single public IP to those companies that acquire services from an ISP, with some few exceptional cases of companies that own several.

So that the company's addressing can be executed successfully, the use of NATs is enabled, this allows the translation of network addresses, allowing the company to have as many private networks as necessary and that these can be communicated Correctly with the global network, the Internet, through the public IP of the company.

4 0
4 years ago
Other questions:
  • Question 3 / 5
    9·1 answer
  • Help?!<br> Does anyone know how to use Adobe SoundBooth?
    14·2 answers
  • Write a Python function called validateCreditCard that takes 8-digit credit card number as the input parameter (string value) an
    8·1 answer
  • • Two advertisers A and B
    8·1 answer
  • The 2 main types of copyright relevant to the recording industry?
    5·2 answers
  • Which of the following are the benefits of using Responsive Display Ads?
    9·1 answer
  • Directions Interview your parent or any member of your family. Identity
    12·1 answer
  • Assuming even parity, find the parity bit for each of the following data units. a. 1001011 b. 0001100 c. 1000000 d. 1110111
    12·1 answer
  • Plz help me to solve all of this question answer.(of question no 7,8,9)​
    12·1 answer
  • A Development team begins work on a new software application and decides to involve the client’s IT experts to ensure that secur
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!