


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



This time you will develop a transaction-based banking system based on your programming assignment one. A distributed banking system consists of a database server and some Automated Teller Machines (ATM). The server manages a database including account and balance information. A customer can invoke the following operations at an ATM. We assume that every customer can access any account in the database.
void begin_transaction(int cutm) First operation of a customer, before he performs any other operations. cutm is the ID of the customer. void deposit(int cutm, int acnt, int amt) Increases the balance of account acnt by amt, and returns nothing void withdraw(int cutm, int acnt, int amt) Decreases the balance of account acnt by amt, and returns nothing int inquiry(int cutm, int acnt) Returns the balance of account acnt void end_transaction(int cutm) Commits the customer’s transaction void abort_transaction(int cutm) Aborts the customer’s transaction
You should use the strict two-phase locking algorithm and the private workspace algorithm to implement the transaction. An account will be locked at the first time a customer access (read or write) that account, and will be unlocked when the customer performs either end_transaction or abort_transaction. You may implement the private space for each customer at either the server side or the customer side. For simplicity, assume that no ATM machine crashes.
Assume that initially the Bank server has the following data
Account Balance 100 $ 200 $ The bank server has only one input parameter “server_port”, which specifies the port of rmiregistry.
The input parameters of an ATM should be “server_address server_port operation customer account amount”.
server_address the address of the rmiregistry server_port the port of the rmiregistry operation one of “begin_transaction”, “deposit”, “withdraw”, “inquiry”, “end_transaction”, and “abort_transaction” customer customer ID account account ID amount only for “deposit” and “withdraw” operations
Same as Programming Assignment 1, you are required to test and run your program in the platform of Amazon Web Service (AWS). This time, you need to apply at least 3 instances for testing your program, where one runs as a database server while the other two are used as ATM.
Suppose we have 3 instances, S, C1 and C2. S maintains a database server while C1 and C work as ATM.
i. Launch S and start your database server there. First, start rmiregistry at port 6666 C:>rmiregistry 6666 Then, start the server C:>java Bank 6666
ii. Launch C1 for supporting Customer 1's transaction. C:>java ATM cse.unl.edu 6666 begin_transaction 1 Customer 1 starts his transaction. C:>java ATM cse.unl.edu 6666 inquiry 1 100 The current balance of account 100 is $ C:>java ATM cse.unl.edu 6666 deposit 1 100 200 Successfully deposit $200 to account 100! C:>java ATM cse.unl.edu 6666 inquiry 1 100