This assignment can be done in groups of 2. The names of both participans must be on all documents. Both will receive the same grade for the design (from 0 to 10 points) and for the program (from 0 to 20 points). Send your team's composition to the instructor by November 12 at 10pm.
We want to develop a distributed program where operations are transactional. We will simplify all sort of issues so that we can focus on transactionality. You can write the program in C, or Java, or Python.
The transactions will involve trivial operations. You should try, within the available time, to come up with reasonably general solutions.
We will assume that there are 10 accounts, numbered from 0 to 9, 5 on machine A, 5 on machine B.
Their initial balance is 1000.0. You can keep each balance stored in its own separate file, balance0,
.., balance4 at machine A, balance 5, .., balance 9 at machine B. You will decide if to keep the balances
stored as binary or text.
Clients in a loop will execute the code
loop Select at random accounts j and k, j != k; Select at random an amount x, 0 < x <= 300; Transfer atomically x dollars from the j to the k account; Sleep a random time; until terminated by a signal;Of course if the amount x exceeds the balance at j, the transaction will be aborted.
Transfers are transactions and must satisfy the ACID properties: Atomicity, Consistency, Isolation, and Persistence. Each transaction must have a unique identifier. Logs must be maintained at A and at B so that we can later see which transactions were initiated and carried out.
Systems A and B may crash at any moment. You may simulate that by having an exit call executed at random moments or, if you have your own computers, by unplugging them. When the crashed systems are restarted the system should recover as if nothing had happened.
Note that you will have to worry about:
If you would like to modify these instructions, discuss your suggestions with the instructor and ask for approval.
Submit the homework at the specified dates to the blackboard dropbox.