Question: Implement a program that simulates the behavior ofImportant Note: The input sequence will be affected during the simulation for example, some commands may cause a

Implement a program that simulates the behavior ofImportant Note: The input sequence will be affected during the simulation for example, some commands may cause a transaction to be blocked (wait). In such cases, the simulation should keep track of all subsequent operations of this transaction, and if the transaction is resumed, these operations should be simulated.Your simulation should assign transaction timestamps using an incremental counter, based on the transactions
start order, and are integer numbers: 1,2,3,.... For example, in the first example input file (on left above), TS(T2)=1, TS(T3)=2, TS(T4)=3, because T2 starts first, then T3, then T4.
You should do the following steps :
1. Design and implement appropriate data structures to keep track of transactions (transaction table) and
locks (lock table), as well as any other needed information (it is your responsibility as part of the project to determine any additional needed information).
2. In the transaction table, you should keep relevant information about each transaction. This includes transaction id, transaction timestamp, transaction state (active, blocked (waiting), aborted (cancelled),
committed, etc.), list of items locked by the transaction, plus any other relevant information. (It is part of
your work to determine and specify other relevant information needed.) For blocked transactions, you
should also keep an ordered list of the operations of that transaction (from the input file) that are waiting
to be executed if the transaction can be resumed.
3. In the lock table, you should keep relevant information about each locked data item. This includes item
name, lock state (read (share) locked, or write (exclusive) locked), transaction id for the transaction
holding the lock (for write locked) or list of transaction ids for the transactions holding the lock (for read
locked), list of transaction ids for transactions waiting for the item to be unlocked (if any), plus any
other relevant information. (It is part of your work to determine and specify other relevant information.)
4. Write a program that reads the operations from an input file representing a schedule and simulates the
appropriate actions for each operation by referring to and updating the entries in the transaction table
and lock table. Your program should print a short summary of the simulation action that the program
takes to simulate each command, including information on any updates to the system tables (transaction
table and lock table), and if the simulation will commit or abort or block a transaction, or just allow the
operation to execute.
 Implement a program that simulates the behavior ofImportant Note: The input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!