Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6.8 Race conditions are possible in many computer systems. Consider a banking sy

ID: 3534186 • Letter: 6

Question

6.8 Race conditions are possible in many computer systems.

Consider a banking system with the following two functions: deposit (amount) and withdraw (amount). These two functions are passed the amount that is to be deposited or withdrawn from a bank account.

Assume a shared bank account exists between a husband and wife and concurrently the husband calls the withdraw() function and the wife calls deposit().

Describe how a race condition is possible and what might be done to prevent the race condition from occurring.

Explanation / Answer

This Situation Of transaction is known as Concurrency Problem

The Banking Operation interleaves the actions of different transactions to improve performance,

in terms of increased throughput or improved response times for short transactions,

but not all interleaving should be allowed.

Ensuring transaction isolation while permitting such concurrent execution is difficult

but is necessary for performance reasons. First, while one transaction is waiting for a

page to be read in from disk, the CPU can process another transaction. This is because

I/O activity can be done in parallel with CPU activity in a computer. Overlapping I/O

and CPU activity reduces the amount of time disks and processors are idle, and

increases system throughput (the average number of transactions completed in a given

time). Second, interleaved execution of a short transaction with a long transaction

usually allows the short transaction to complete quickly. In serial execution, a short transaction could get stuck behind a long transaction leading to unpredictable delays

in response time, or average time taken to complete a transaction.

This Problem can be handled by

Serializibilty

Lock-Based Concurrency Control

Deadlocks Prevention