Your goal in this project is to implement a lock manager and a transaction simulation program that simulates the lock request of multiple concurrently running transactions.
This project should be implemented in Java. Each transaction is simulated as one thread. Each transaction/thread reads in its own operation sequence from a file named id.txt where id is the transaction id. For example, transaction 1 will read in its schedule from "1.txt". All the transactions/threads are started randomly according to a random generator. After a transaction is started, it sends out lock request to lock manager in the order given in id.txt file.
The content in id.txt is given in the format of one operation each line. Each operation consists of two parts, the lock mode and the data object, which are seperated by empty space. For example, 1.txt. In our project, we consider two lock modes, read and write, represented as "r" and "w". You can think a data/resource object as a String object in Java.
The lock manager class should support the following two operations:
Note that there are two ways to "lock" the lock table. You can either lock the table including the RCBs chain until the operation ends. Or you can just lock the table temporarily. Once the pointer to the RCBs is available, the lock to the lock table is released. Both of them are correct. However, the first one has a bad concurrency. If you implement it in the first way, you will only receive partial credit. If you implement it using the temporary-locking idea, make sure that the RCB chain is locked before you operate on it.
Students can work in groups. Each group has at most 2 people in it. Group members may share code with each other, but not with the students from other groups. Each group member must also submit a short statement in en envelope directly to the instructor with comments about the participation or whatsoever of the other group member in the project. Group members should have contact information of each other.
There are three milestones. The first two should be submitted in paper in class. The third one, i.e. the final project should be sent to jshan@ccs.neu.edu in a tarred file. For each submission, one copy is needed for each group.
Please submit a short descriptionn about thread and synchronized programming in Java. For those who are not familiar with Java or these concepts, you should learn how to use these techniques now. The concepts and corresponding examples can be found in many Java programming books. Thinking in Java 3rd Edition and Sun Java Tutorial are two free books available online. You can search them in Google by typing "Thinking in Java" or "Sun Java Tutorial". Here are two links to these resources I found. Thinking in Java . Sun Java Tutorial
Write a short description about your project design. For example, how many classes you are going to have in the project and what is the functionality of each class and their methods. API specification should also be included in this milestone.
The final project due May 27 midnight. Please send all your source code files in a tarred file to jshan@ccs.neu.edu.
Note:
(1) Submission of the first two milestones counts 5% and the submission of the third milestone counts the other 10%.
(2) Late hand-in will receive 20% late penalty.
(3) No late submission will be accepted after the final exam Wednesday June 4.
When ti aborts (due to deadlock), it releases all the locks (LCBs) of ti, i.e. it should call unlockAll(i).
You can either output the following message using "System.out.println(your message here)" or you can write the output to a file.
A transaction should print message for the following operations (1) when it requests a lock, it should print "which transaction requests what lock on which resource", e.g. "t1 requests X lock on resource x1". (2) When a lock request is granted, you should print a message like "x lock on resource x1 by t1 is granted, the current lock mode of x1 is x" (3) When a transaction aborts, it should print message "transaction ti aborts, unlock .......".
Back to course homepage.