CS4432 (DBII) - Project #3 on Lock Management |
To give you a reprieve from all those string manipulations
and file management headaches, the third and final project in CS4432
will be the development of HappyLocker, a system
that is responsible for the management of locks for shared
resources (such as tuple access) in a database.
HappyLocker is intended to be a stand-alone system used for
transaction-management purposes in a database system.
HappyLocker is not to be integrated
with your previous project #1 or project #2.
And, what may be even better news for you, you are free to choose
between JAVA, C++ or C.
To simplify the project,
your lock manager
HappyLocker will receive lock requests from stdin, and will
output text describing the outcome of those requests to stdout.
Request Possible Messages STXN Transaction started SLOC Lock granted XLOC Lock granted
ETXN
Transaction ended ULOC
Lock released
Input Output STXN1 STXN 1 : Transaction 1 started STXN 2 STXN 2 : Transaction 2 started SLOC 1 A SLOC 1 A: Lock granted XLOC 2 A XLOC 2 A: Waiting for lock (S-lock held by: 1) ULOC 1 A ULOC 1 A: Lock released XLOC 1 B XLOC 1 B: Lock granted
XLOC 2 B XLOC 2 B: Waiting for lock (X-lock held by: 1) XLOC 1 A
XLOC 1 A: Waiting for lock (X-lock held by: 2)
ETXN 1
ETXN 1 : Transaction 1 ended ULOC 2 A
ULOC 2 A: Lock released
ETXN 2
ETXN 2 : Transaction 2 ended
Basic Design of Lock Table and Manager.
For your program, you need to implement a lock table.
You can use your own design for this system.
Your lock table will reside in memory and will contain
information for every outstanding lock in the system. The minimum
information that you should
maintain is which transactions have the lock and in which mode; as well as
which transactions are waiting for the lock.
Deadlock Detection.
As additional feature,
after processing a request for an exclusive or shared lock your
program should report any deadlocks
(it does not necessarily need to prevent or solve them).
For example, in the sample input
above, a deadlock is created after processing
Error Handling.
Furthermore, you should provide some solid error handling to your
lock manager. That is, you should be testing your program both
with some legal and well-formed schedules as input as well
as with input composed of an ill-formed schedule.
One example of an ill-formed schedule are lock-requests arriving for
transaction that did already terminate via an END-TRANSACTION
(ETXN) command.
Another one are lock-requests arriving for
a transaction
that currently is not active, i.e., there is no current
START-TRANSACTION (STXN) for this given transaction id in the system.
Also, we will need to double-check in the input that
no requests (except
Each team is
expected to submit a description of your design
(data structures and algorithms)
in a plain text file
called README, as
well as to include comments in the
code. For the format of this document, please refer to CS
Department Standard Document.
Also, you have to provide a complete
set of testing cases you have
worked with to evaluate your program, including testing runs scripting
successful runs of the respective tests.
A discussion of what
features work and do not work must be included. The grade of your program will be based on four aspects: Submission of the assignment will take place electronically via myWPI.
Each team must submit one copy of their HappyLocker system
into myWPI.
Your complete work including your README documentation file must be submitted in
one package
that has been zipped. Several individual files by one team
will not be accepted.
Make sure that your zipped file has a clear name of the
form "project3.team-number".
Waiting for lock (X-lock held by:  <trans_ID>)
Upgrade to XLOC granted
Waiting for lock (S-lock held by: <transID > . . . < transID>)
Waiting for lock (X-lock held by:  <trans_ID>)
Lock released
Lock granted to <transID > . . . < transID>
Lock granted to <transID > . . . < transID>
X-Lock granted to 2
Release X-lock on B
X-Lock on B granted to 2
Documentation
Grading
Submission
Also, please make sure to include on top of each of your files in the zipped file the following to avoid any confusion: "CS4432-project#3, your names and the number of your team (to be gotten from our CS4432 website).