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
What is the process of attaching gage blocks to each other
const2013 [10]

The blocks are joined by a sliding process called wringing, which causes their ultra-flat surfaces to cling together.

7 0
2 years ago
You are given a graph G = (V, E) with positive edge weights, and a minimum spanning tree T = (V, E’) with respect to these weigh
matrenka [14]
C vraiment très facile
Si tu a besoin d’aide recontacter moi
7 0
2 years ago
shapes polymorphism Create a set of classes derived from an abstract class Shape, which provides a common interface, for managin
Virty [35]

Answer:

Explanation:

demo.java Shapes 2 Shapes Polymorphism Create a set of classes derived from an abstract class Shape, which provides a common interface, for managing various 2D geometric shapes. In our model, each Java object will represent a shape somewhere in a Cartesian coordinate system. However, note that unlike in Mathematics, the positive y-axis grows down from the origin. Shapes All shapes have the following properties: color, area, perimeter, location, and bounds. Shapes are mutable, for example any shape can be moved.

5 0
2 years ago
Using e-mail has decreased the number of hand-written letters that people send to their friends and relatives. this is a ____ fu
k0ka [10]
Hello <span>Alexkalhor5415

</span>Answer: Using e-mail has made it easy, fast, and inexpensive for family members who live in different parts of the united states to keep in touch. this is a positive  function of e-mail.
Hope this helps-Chris
6 0
2 years ago
What is the multiplier effect, and how can you prevent if from happening?
nadezda [96]

Answer:

 The multiplier effect is the economical process that basically increase the final and national income disproportionately which results in the greater consumption as compared to the amount of the initial spend.

 In other words we can define as the capital implantation, regardless of whether it is in the legislative or corporate level, ought to have snowball impact in the monetary action.

It can be prevent by many ways by increasing the reserve ratio in the economical sector and by also increasing the taxes.

7 0
3 years ago
Other questions:
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • A. experiment by purposely misconfiguring the gateway address on pc-a to 10.0.0.1. what happens when you try and ping from pc-b
    14·1 answer
  • What are the advantages of homogenation
    5·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • Although your project has been accepted by the customer, the contract with the system vendor specifies that it will support the
    13·1 answer
  • What are the 5 font/typography families
    14·1 answer
  • What method of thermal energy is at work when heat lamps are used to warm up baby chickens?
    11·2 answers
  • Data type can only be true or false <br><br> Answer: Bool
    15·1 answer
  • True or false. The send e-mail feature, listed under tools, will allow you to send an e-mail to your instructor and to fellow st
    7·1 answer
  • You find a picture of a famous department store online that would be great to include in a project of yours. What should you do
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!