**5. Real-Time concurrency control protocol based on accessing temporal data (RTCC-DD)**

The concurrency control mechanism in the database must guarantee the consistency of the database; serializability is one correctness standard of concurrency control in the database.

Real-Time Concurrency Control Protocol Based on Accessing Temporal Data 185

RTCC-DD method dynamically adjusts the data by checking the value of k, for each variable temporal data are calculated to ensure that the scheduling of variable data; For the next version of similar state cannot meet the time limit to extend the data deadline for its validity; at the same time we using the optimistic concurrency control method, this method won't produce priority inversion and congestion; And it is the first time to solve the problem about temporal data of concurrency control. Improved the problem of which is discussed in

**Example 2.** The transaction and implementation in example 2 is the same with example 1, transaction T1: w1(x)r1(y); T2: w2(y) r2(z). The period of validity of T1 is t7, the period of

At time t5 when T2 access to validation phase, there is WS(Tv)∩RS(Ta)={y}≠Ø, according to

thus satisfying the conditions t v ti tv (VF (T ) 1) (tsd (T ) tsd (T )) ≥∧ > , Adjust the order of transaction execution to T2, T1. After the submit of T2, T1 can also meet the constraint of the period of validity, scheduling T2, T1 successfully, so use method RTCC-DD, can avoid

Serializability is one standard of correctness of concurrency control in the database. RTCC-DD can guarantee the concurrency control of temporal data, at the same time satisfy the serializability. We discuss the superiority and accuracy problems of RTCC-DD method as

**Lemma2** The traditional optimistic concurrency control methods can use RTCC-DD to

Because the time constraint of access to transaction will influence the scheduling and concurrency control, The traditional optimistic concurrency control methods only consider the case of the transaction deadline, not discuss the deadline for data on the effect to transaction concurrency control. In order to solve the problem, RTCC-DD take the optimistic method; if the scheduling data is not temporal constrain, RTCC-DD will degenerate to the traditional optimistic concurrency control methods, so the traditional optimistic concurrency

= => , 5t1 7 6 tsd (T ) t t = − , 5t2 6 6 tsd (T ) t t = − ,

the literature about the transaction scheduling problems of access to temporal data.

then adjusts the excute order to *Tv*, *Ti* else the execute order is *Ti*, *Tv*;

if t v ti tv (VF (T ) 1) (tsd (T ) tsd (T )) ≥∧ >

else if *WS*(*Ti*)∩*WS*(*Tv*)≠Ø then if t v tv ti (VF (T ) 1) (tsd (T ) tsd (T )) <∧ > then adjusts the execute order to *Ti*, *Tv*  else the execute order is *Tv*, *Ti*;

endif

validity of temporal data z is [t4, t6].

t v

transaction unnecessary restarts.

4 2 <sup>8</sup> VF (T ) <sup>1</sup> 7 4 7

control methods can use RTCC-DD to scheduling.

the RTCC-DD,

below.

schedule.

endif

Methods discussed in this chapter are based on the optimistic concurrency control strategy, when the transactions reading stage we use CHECKING Algorithm to guarantee access temporal data consistency. When transactions come into the verify stage, we make the reading and writing adjustment detection, at this stage the changes of the transactions of the database is readable and effective, conflict transactions can read the private cache of transactions to get the change. The transactions submit if all conflicts transactions are serializable. Specific adjustment rules are as follows.

**Rule1** At time t, when Lt(T)=0, assigned serial number for the transaction T ser(T) and enter the validation phase, the scope of ser (T) is 1, 2 . . .. to n. The number of the first transaction access the validation phase is 1, transactions access later cumulative.

**Rule2** At time t, avie(Xi)<Ct(T) and the value of the ith version of X is similar with the next version, then adjust the X temporal period to the next version, that temporal object is (value (Xi) , avi (Xi) ) , avi(Xi)=[avib(Xi), avie(Xi+1)].

**Rule3** At time t, VFt(T)<1 and tsdt(Tv) > tsdt(Ti), T CTS(T ) i v ∈ adjust the serialization order of transactions, ser(Ti)=ser(Tv), ser(Tv)=ser(Tv)+1. If RS(Tv)∩WS(Ti)≠Ø, Tv read the data of Ti from private cache.

**Rule4** At time t, submit transaction T, if only ∀ ∈ T CTS(T) <sup>i</sup> , i ser(T) ser(T ) < .

Rule1 ensures transactions enter into validation phase and distribute serial number after complete to access data. Rule2 ensures to extend the validity of temporal data valid interval if next version data similar with the current version, and reduces unnecessary transaction to restart. Rule3 ensures to run conflict transaction when the conflict of transaction is more nearer completion than validation transaction, and validation transaction can delay after the conflict transaction committed, and adjust the executive order, when verification transaction is conflict with other transaction, allow validation transaction to read data which conflict transaction update. Rule4 ensures that the submitted transactions are serializability.

To ensure the effectiveness of the temporal data, RTCC-DD method adopts the checking algorithm to check the access data set before transactions executing. And then, using an optimistic approach, adjust the rules of the transaction validation phase. When verify transaction and other transaction are conflict, to judge by the factor of authentication, priority to scheduling the transaction which will be finished; taking consider the state that verify the transaction when the delay time dynamic adjustment of transaction execution in order to ensure the transactions of temporal data scheduling to satisfy the temporal consistency. While it ensured the limit of the data and transaction, minimizing the unnecessary transaction restarts. RTCC-DD concurrency control methods are described below:

> if *Tv* conflicts with *Ti*, T CTS(T ) i v ∈ if *RS*(*Tv*)∩*WS*(*Ti*)≠Ø then if t v tv ti (VF (T ) 1) (tsd (T ) tsd (T )) <∧ > then adjusts the execute order to *Ti*, *Tv* else the execute order is *Tv*, *Ti*; else if *RS*(*Ti*)∩*WS*(*Tv*)≠Ø then

184 Real-Time Systems, Architecture, Scheduling, and Application

Methods discussed in this chapter are based on the optimistic concurrency control strategy, when the transactions reading stage we use CHECKING Algorithm to guarantee access temporal data consistency. When transactions come into the verify stage, we make the reading and writing adjustment detection, at this stage the changes of the transactions of the database is readable and effective, conflict transactions can read the private cache of transactions to get the change. The transactions submit if all conflicts transactions are

**Rule1** At time t, when Lt(T)=0, assigned serial number for the transaction T ser(T) and enter the validation phase, the scope of ser (T) is 1, 2 . . .. to n. The number of the first transaction

**Rule2** At time t, avie(Xi)<Ct(T) and the value of the ith version of X is similar with the next version, then adjust the X temporal period to the next version, that temporal object is (value

**Rule3** At time t, VFt(T)<1 and tsdt(Tv) > tsdt(Ti), T CTS(T ) i v ∈ adjust the serialization order of transactions, ser(Ti)=ser(Tv), ser(Tv)=ser(Tv)+1. If RS(Tv)∩WS(Ti)≠Ø, Tv read the data of

Rule1 ensures transactions enter into validation phase and distribute serial number after complete to access data. Rule2 ensures to extend the validity of temporal data valid interval if next version data similar with the current version, and reduces unnecessary transaction to restart. Rule3 ensures to run conflict transaction when the conflict of transaction is more nearer completion than validation transaction, and validation transaction can delay after the conflict transaction committed, and adjust the executive order, when verification transaction is conflict with other transaction, allow validation transaction to read data which conflict transaction update. Rule4 ensures that the

To ensure the effectiveness of the temporal data, RTCC-DD method adopts the checking algorithm to check the access data set before transactions executing. And then, using an optimistic approach, adjust the rules of the transaction validation phase. When verify transaction and other transaction are conflict, to judge by the factor of authentication, priority to scheduling the transaction which will be finished; taking consider the state that verify the transaction when the delay time dynamic adjustment of transaction execution in order to ensure the transactions of temporal data scheduling to satisfy the temporal consistency. While it ensured the limit of the data and transaction, minimizing the unnecessary transaction restarts. RTCC-DD concurrency control methods are described

> if t v tv ti (VF (T ) 1) (tsd (T ) tsd (T )) <∧ > then adjusts the execute order to *Ti*, *Tv* else the execute order is *Tv*, *Ti*;

serializable. Specific adjustment rules are as follows.

(Xi) , avi (Xi) ) , avi(Xi)=[avib(Xi), avie(Xi+1)].

submitted transactions are serializability.

if *Tv* conflicts with *Ti*, T CTS(T ) i v ∈ if *RS*(*Tv*)∩*WS*(*Ti*)≠Ø then

else if *RS*(*Ti*)∩*WS*(*Tv*)≠Ø then

Ti from private cache.

below:

access the validation phase is 1, transactions access later cumulative.

**Rule4** At time t, submit transaction T, if only ∀ ∈ T CTS(T) <sup>i</sup> , i ser(T) ser(T ) < .

 if t v ti tv (VF (T ) 1) (tsd (T ) tsd (T )) ≥∧ > then adjusts the excute order to *Tv*, *Ti* else the execute order is *Ti*, *Tv*; else if *WS*(*Ti*)∩*WS*(*Tv*)≠Ø then if t v tv ti (VF (T ) 1) (tsd (T ) tsd (T )) <∧ > then adjusts the execute order to *Ti*, *Tv*  else the execute order is *Tv*, *Ti*; endif endif

RTCC-DD method dynamically adjusts the data by checking the value of k, for each variable temporal data are calculated to ensure that the scheduling of variable data; For the next version of similar state cannot meet the time limit to extend the data deadline for its validity; at the same time we using the optimistic concurrency control method, this method won't produce priority inversion and congestion; And it is the first time to solve the problem about temporal data of concurrency control. Improved the problem of which is discussed in the literature about the transaction scheduling problems of access to temporal data.

**Example 2.** The transaction and implementation in example 2 is the same with example 1, transaction T1: w1(x)r1(y); T2: w2(y) r2(z). The period of validity of T1 is t7, the period of validity of temporal data z is [t4, t6].

At time t5 when T2 access to validation phase, there is WS(Tv)∩RS(Ta)={y}≠Ø, according to the RTCC-DD,

$$\text{VF}\_{\text{t}}(\text{T}\_{\text{v}}) = \frac{4}{7} \Big/ \frac{2}{4} = \frac{8}{7} > 1 \quad \text{tsd}\_{\text{t}\_{\text{g}}}(\text{T}\_{\text{1}}) = \text{t}\_{7} - \text{t}\_{6} \quad \text{tsd}\_{\text{t}\_{\text{g}}}(\text{T}\_{\text{2}}) = \text{t}\_{6} - \text{t}\_{6} \quad \text{t}\_{6}$$

thus satisfying the conditions t v ti tv (VF (T ) 1) (tsd (T ) tsd (T )) ≥∧ > , Adjust the order of transaction execution to T2, T1. After the submit of T2, T1 can also meet the constraint of the period of validity, scheduling T2, T1 successfully, so use method RTCC-DD, can avoid transaction unnecessary restarts.

Serializability is one standard of correctness of concurrency control in the database. RTCC-DD can guarantee the concurrency control of temporal data, at the same time satisfy the serializability. We discuss the superiority and accuracy problems of RTCC-DD method as below.

**Lemma2** The traditional optimistic concurrency control methods can use RTCC-DD to schedule.

Because the time constraint of access to transaction will influence the scheduling and concurrency control, The traditional optimistic concurrency control methods only consider the case of the transaction deadline, not discuss the deadline for data on the effect to transaction concurrency control. In order to solve the problem, RTCC-DD take the optimistic method; if the scheduling data is not temporal constrain, RTCC-DD will degenerate to the traditional optimistic concurrency control methods, so the traditional optimistic concurrency control methods can use RTCC-DD to scheduling.

Real-Time Concurrency Control Protocol Based on Accessing Temporal Data 187

a

b

The concurrency control method is one of the key problems in the database systems. The optimistic methods are widely used in database system because it is not exists deadlock and block. Unnecessary transactions restarting and nearing completing transactions missing its deadline are the key factor effecting optimistic concurrency control method performances.

a. Little Number of Temporal Data b. Much Number of Temporal Data

Fig. 2. Transactions Miss Percentage

**7. Conclusion** 

**Theorem 2** RTCC-DD can guarantee the serializability of the transactions scheduling

Proof, according to the rule 1, if L (T) 0 <sup>t</sup> = , assigned serial number for the transaction T ser(T), guarantee only when the transaction access into the validation phase we assigned serial number, and the serial number is only, according to rule 3 we dynamic adjust the conflict transaction, and guarantee the least serial number first submit. According to the rule 4, only when all the conflict transactions serialize after this transaction, submit this transaction, so submitting the transactions is constrain by serializability number, ensure the serializability.
