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.
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 Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

Students also viewed these Databases questions