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
How do I change the year I was born on this website? I made a mistake and now I can't fix it. Can somebody please help me?
Eddi Din [679]

Answer:

you can go to settings and try to fix it or contact the people of this website

Explanation:

8 0
3 years ago
Can you list the answers in order
viva [34]

whats the question?????????????????????

5 0
3 years ago
PREDATION AND EVOLUTION
choli [55]

Answer:

Yes, it is correct. God is great. He gives pain but gives the ointment as well to get rid of it. God gives tougher challenges, but God also gives the guts to tackle them and win them. The story of adaptation, ad predator also goes like this. God gives spines to sea urchins to survive, and it gives the birds stronger beaks to break shells. Similarly, he gives programmers awesome brains to solve the toughest problems.

Explanation:

Please check the answer.

3 0
3 years ago
Timothy was reading tournament results of the football World Cup matches on Infogoalistic.com. As he was going through the resul
Gennadij [26K]

Answer:

B) contextual

Explanation:

Contextual advertising is a form of targeted advertising for advertisements appearing on websites or other media.

For example:

Timothy was reading tournament results of the football World Cup matches on Infogoalistic.com. As he was going through the results, an advertisement of new football studs popped up. This is an example of <u>contextual</u> advertising.

5 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
erica [24]

Answer:

Router

Explanation:

Routers have something called a WAN link, which can be used to connect 2 local area networks

7 0
3 years ago
Other questions:
  • What is the best overall approach to education and career development for IT professionals?
    14·1 answer
  • Design an algorithm for a bounded-buffer monitor in which the buffers (portions) are embedded within the monitor itself."
    10·1 answer
  • What is 450 g of flour a measure of?
    11·1 answer
  • Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
    6·1 answer
  • Lisa has had her California real estate license suspended for violations involving mobile homes under the California Business an
    12·1 answer
  • Alexi is writing a program which prompts users to enter their age. Which function should she use?
    6·2 answers
  • Which statement is true? Select 3 options.
    5·2 answers
  • Given three packets of size 2,500 Bytes (caution this is Bytes not bits) each are ready inside computer 1 to be transmitted onto
    14·1 answer
  • A client is looking to maximize value from its Cloud investments by baselining, profiling, and prioritizing its human capital ne
    9·1 answer
  • Which of the following is not considered essential for an electronic device to be called a computer?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!