4.1 Locking Methods in Real-Time Databases
In this section a few well-known pessimistic concurrency control methods are being presented.Most of these methods are based on 2PL.
2PL High Priority In the 2PL-HP (2PL High Priority) concurrency control
Method conflicts are resolved in favor of the higher priority transactions. If the lock requester has a priority higher than the priority of the lock holder, the lock holder is aborted, rolled back and restarted. The lock is granted to this requester and the requester can continue its execution. If the priority of the lock requester is lower than that of the lock holder, the requesting transaction blocks to wait for the lock holder to finish and release its locks. High Priority concurrency control may lead to the cascading blocking problem, a deadlock situation, and priority inversion.
2PLWait Promote In 2PL-WP (2PLWait Promote) the analysis of concurrencycontrol method is developed from. The mechanism presented usesshared and exclusive locks. Multiple concurrent readers are allowed in Shared locks permit. Anew definition is made – the priority of a data object, which is defined to be thehighest priority of all the transactions holding a lock on the data object. If the dataobject is not locked, its priority is undefined.A transaction can join in the read group of an object if and only if its priorityis higher than the maximum priority of all transactions in the write group of an object. Thus, conflicts arise from incompatibility of locking modes as usual. Particular attention is given to conflicts that lead to priority inversions. A priorityinversion occurs when a transaction of high priority requests and blocks for an object which has lesser priority. This means that the requesting transaction has higher priority all the lock holders. This same method is also called 2PL-PI
(2PL Priority Inheritance)
2PL Conditional Priority Inheritance Sometimes High Priority may be too strict policy. If the lock holding the transaction can finish in the time that the lock requesting transaction Tr can afford to wait, that is within the slack time of Tr, and let proceed to execution and Tr wait for the completion of Th. This policy iscalled 2PL-CR (2PL Conditional Restart) or 2PL-CPI (2PL Conditional Priority Inheritance) .
Priority Ceiling Protocol the focus is to minimize the duration ofblocking to at most one lower priority task and prevent the formation of deadlocks.A real-time database can often be decomposed into sets of database objectsthat can be modeled as atomic data sets. For example, two radar stations trackan aircraft representing the local view in data objects O1 and O2. These objectsmight include e.g. the velocity, current location, etc.
Each of these objects forms an atomic data set, since consistency constraints can be checked and validated locally. The notion of atomic data sets is generally useful for tracking multiple targets.
A simple locking method for elementary transactions is the two-phase lockingmethod; a transaction cannot release any lock on any atomic data set unless it hasobtained all the locks on that atomic data set. Once it has released its locks itcannot obtain new locks on the same atomic data set, however, it can obtain newlocks on different data sets. Theory of modular concurrency control permits an elementary transaction to hold locks across atomic data sets. This increases theduration of locking and decreases perceptibility. In this study transactions do nothold locks across atomic data sets.Priority Ceiling Protocol minimizes the duration of blocking to at most oneelementary lower priority task and prevents the formation of deadlocks .The idea is that when a new higher priority transaction preempts a running transactionits priority must exceed the priorities of all preempted transactions, takingthe priority inheritance protocol into consideration. If this condition cannot bemet, the new transaction is suspended and the blocking transaction inherits thepriority of the highest transaction it blocks.
The priority ceiling of a data object is the priority of the highest priority transactionthat may lock this object . A new transaction can preempt a lock-holding transaction if and only if its priority is higher than the priority ceilings ofall the data objects locked by the lock-holding transaction. If this condition is notsatisfied, the new transaction will wait and the lock-holding transaction inheritsthe priority of the highest transaction that it blocks. The lock-holder continues to execute, and then it releases the locks, its original priority is resumed. Allblocked transactions are awaked, and the one with the highest priority will startits execution.The fact that the priority of the new lock-requesting transaction must be higher
than the priority ceiling of all the data objects that it accesses, prevents the formationof a potential deadlock. The fact that the lock-requesting transaction isblocked only at most the execution time of one lower priority transaction guarantees,the formation of blocking chains is not possible.
Read/Write Priority Ceiling The Priority Ceiling Protocol is further advanced in, where the Read/Write Priority Ceiling Protocol is introduced. It containstwo basic ideas. The first idea is the notion of priority inheritance. The secondidea is a total priority ordering of active transactions. A transaction is said tobe active if it has started but not completed its execution. Thus, a transactioncan execute or wait caused by a preemption in the middle of its execution. Totalpriority ordering requires that each active transaction execute at a higher prioritylevel than the active lower priority transaction, taking priority inheritance andread/write semantics into consideration.
4.2 Optimistic Methods in Real-Time Databases
Optimistic Concurrency Control (OCC), is based on the assumption thatconflict is rare, and that it is more efficient to allow transactions to proceed withoutdelays. When a transaction desires to commit, a check is performed to determinewhether a conflict has occurred. Therefore, there are three phases to an optimisticconcurrency control method:
‘ Read phase: The transaction reads the values of all data items it needs fromthe database and stores them in local variables. Concurrency control schedulerstores identity of these data items to a read set. However, writes are appliedonly to local copies of the data items kept in the transaction workspace.Concurrency control scheduler stores identity of all written data items to awrite set.
‘ Validation phase: The validation phase ensures that all the committed transactionshave executed in a serializable fashion. For a read-only transaction,this consists of checking that the data values read are still the current valuesfor the corresponding data items. For a transaction that has writes, the validationconsists of determining whether the current transaction has executed serializable way.
‘ Write phase: This follows the successful validation phase for transactions including write operations. In this phase , all changes made by thetransaction are permanently stored into the database.
5. SUMMARY
The field of real-time database research has evolved greatly over the relatively short time of its existence. The future of real-time database system research is dependent of continues progress of this evolution. Research in this field should continue to be pursue state-of-the-art applications and apply both existing techniques to them as well as develop a new ones when needed.