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]
3 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]3 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
As photography developed, a variety of materials were employed as image capture surfaces. Choose the correct order
Debora [2.8K]

glass, pewter, copper, paper
5 0
3 years ago
The term "Big Data" is relative as it depends on the size of the using organization.
oksano4ka [1.4K]

Answer:

A

Explanation:

8 0
3 years ago
How is it possible for the router to know whether it is supposed to send a cat photo to your laptop
kupik [55]

It is possible for the router to know whether it is supposed to send a cat photo to your laptop because  It uses the private IP address.

Router  is a  device that help to transfer data and across the internet or across the user device and the internet.

Private IP addresses are internet protocol addresses that is often  assign to user device by   router in order to a successful communicate to take place between the internet and user device.

Private IP addresses are mostly at:

•Home

•Office

•Business  environments

Inconclusion It is possible for the router to know whether it is supposed to send a cat photo to your laptop because  It uses the private IP address.

Learn more here:

brainly.com/question/19112414

3 0
2 years ago
What is the next line?
Evgen [1.6K]

Answer:3

Explanation: it’s 3

3 0
3 years ago
Read 2 more answers
How is peace circulated?​
Agata [3.3K]

Answer:

Peace is when people are able to resolve their conflicts without violence and can work together to improve the quality of their lives. 

6 0
3 years ago
Read 2 more answers
Other questions:
  • What types of automation device might require specialist installer training?
    5·1 answer
  • List of programming languages and their typing
    5·2 answers
  • Soo...My Old 3DS XL haven't been touched in around a year...So i tried to charge it but no LED lights opened..Even the power but
    14·1 answer
  • What is the age group for the silent genration
    10·1 answer
  • Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for th
    13·1 answer
  • I need help getting earbuds please help
    11·2 answers
  • In java
    6·1 answer
  • Which step in the software development life cycle analyzes the scope of work?
    6·1 answer
  • Differentiate between perfect and imperfect market​
    14·1 answer
  • ....is an act of introducing an invention into market on business basis for profit​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!