Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JUST NEED HELP ON NUMBER 2!!!!!!!!!!!!!!!, PLEASE SHOW PSEUDOCODE FOR THE ANSWER :) Question 1. [Points 4] Race conditions are possible in many computer systems.

JUST NEED HELP ON NUMBER 2!!!!!!!!!!!!!!!, PLEASE SHOW PSEUDOCODE FOR THE ANSWER :)

image text in transcribed

Question 1. [Points 4] Race conditions are possible in many computer systems. Consider an accounting system of an organization where multiple users have access to an account to which they can either deposit or withdraw from: deposit(amount) and withdraw(amount). These two functions are passed the amount that is to be deposited or withdrawn from the account balance. Assume that Mary and Joe are employees who have access to this account. Currently, the balance in the account is $3000. If Mary executes deposit(500) and simultaneously Joe executes withdraw(300) from the account, describe how a race condition is possible and what might be done to prevent the race condition from occurring. Show the possible balances with race condition and when race condition is prevented. Question 2 [Points 4] Let us try to solve the above race condition in the banking application using semaphores with wait() and signal() operations. Assume that the three variables that are to be protected through the semaphores are: balance, withdrawals, and deposits. Assume that all these variables are initialized to 0 . The three functions of interest are: deposit_money, withdraw_money, find_balance. For simplicity, assume that there is only one account that we need to deal with. Write pseudocode using semaphore ACCT to implement the three functions. (Code can be at the same level of detail as in the book examples.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

What is database?

Answered: 1 week ago