A savings account is shared by several people. Each person may deposit or
withdraw money from the account. The current balance in the account is the
sum of all deposits to date less the sum of all withdrawals to date. The
balance must never become negative. Account holders are represented as
processes. A process making a deposit never has to delay (except for
mutual exclusion), but a withdrawal has to wait until there are sufficient
funds.
Develop a monitor to solve this problem. The monitor should have two
procedures: deposit(amount) and withdraw(amount). Assume the
arguments to deposit and withdraw are positive, and the
monitor uses Signal and Continue.