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
What is the definition of D1-D4?
IRINA_888 [86]
Please give more information on what your asking.
6 0
3 years ago
"Use onblur and onfocus to add red borders to the input elements when the user leaves without any input, and a green border if a
strojnjashka [21]

Answer:

habla en español no te entiendo por favor

6 0
3 years ago
Which of the following does NOT describe word processing?
GarryVolchara [31]

Answer:

Editing graphics

Explanation:

I looked it up (at least I was honest)

3 0
3 years ago
Read 2 more answers
which of the following scenarios is a circumstance in which it would be ethical to practice confidentiality?
Citrus2011 [14]
Hi. I am not sure if there should be choices included in your post. If there is none, I'll just share a circumstance to where a professional practices confidentiality as an answer. 

Counselors or psychotherapists can only divulge information about their clients or patients if there is a court order or if the client will harm him/her self or plan to harm others. Primarily, they are to respect the client's choice to keep the sessions with full confidentiality. 
4 0
3 years ago
The following slide was created as part of a presentation that trains new employees how to use the scheduling and calendar softw
brilliants [131]

it has animation, but it does not have multimedia and only has text and no images

8 0
3 years ago
Read 2 more answers
Other questions:
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    5·1 answer
  • Which of the following is the correct syntax for a hyperlink:
    7·1 answer
  • 1. Which of the following is a drone? (1 point)
    10·1 answer
  • You have an interface on a router with the IP address of 192.168.192.10 /29. What is the broadcast address the hosts will use on
    15·1 answer
  • A(n) ____ uses the communication interface to request resources, and the server responds to these requests.
    15·1 answer
  • Low-end CRM systems are designed for companies like Boeing because they only have a few, large customers.
    11·1 answer
  • Why is statistics important for business professionals in many career fields?
    13·2 answers
  • 50 POINTS
    6·1 answer
  • What is the importance of server modules and add-ons?
    9·1 answer
  • Can someone please help me with this .
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!