Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: For example, in the first example input file on left above TST TST TST because T starts first, then T then T
You should do the following steps :
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
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.
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.
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.
task:You should turn in an intermediate reportthat includes your preliminary design of the program psuedocode highlevel code description this is written in English with programming language constructs as needed Include the data structures that will be used for transaction table, lock table, Include one procedurefunction psuedocode with documentation corresponding to the actions your simulation will do for each input operation, as well as for commit, abort, block wait etc.
task:Include: i Sufficient documentation. If there is any change of the design and implementation, please state in the report. ii An output file for
each input should be turned in that prints the actions taken by your program when processing each operation, including the description of any changes to the transaction table and lock table
source code for your program with sufficient internal documentation comments
Some basic information about the actions that your program should
Before changing a transaction state to blocked, your program should check the deadlock preventionprotocol woundwait rules to determine if the transaction should wait be blocked or abort. The transaction timestamps are used to decide on which action to take.
The process of aborting a transaction should release unlock any items that are currently locked by
the transaction, one at a time, and changing the transaction state to aborted in the transaction table. Any subsequent operations of the aborted transaction that are read from the input file should be ignored by the simulation.
If a transaction reaches its end e operation successfully, it should be committed. The process of committing a transaction should release unlock any items that are currently locked by the transaction,
one at a time, and changing the transaction state to committed in the transaction table.
The process of unlocking an item should check if any transactions are blocked because of waiting for the item. If any transactions are waiting, it should remove the first waiting transaction and grant it access
to the item note that this will relock the item and thus resume the transaction. All waiting operations of the transaction are processed as discussed above, subject to the locking protocol before any further
operations from the input file are processed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started