Answered step by step
Verified Expert Solution
Link Copied!

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: 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.
task1:You should turn in an intermediate reportthat includes your preliminary design of the program psuedo-code (high-level 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 procedure/function psuedo-code with documentation corresponding to the actions your simulation will do for each input operation, as well as for commit, abort, block (wait), etc.
task2: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 ..
14. Before changing a transaction state to blocked, your program should check the deadlock preventionprotocol (wound-wait) rules to determine if the transaction should wait (be blocked) or abort. The transaction timestamps are used to decide on which action to take.
15. 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.
16. 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.
17. The process of unlocking an item should check if any transaction(s) 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Differentiate between a secured bond and an unsecured bond.

Answered: 1 week ago

Question

How often can I work from home?

Answered: 1 week ago