Group Title: Department of Computer and Information Science and Engineering Technical Reports
Title: Real-time transaction scheduling : a cost conscious approach
CITATION PDF VIEWER THUMBNAILS PAGE IMAGE
Full Citation
STANDARD VIEW MARC VIEW
Permanent Link: http://ufdc.ufl.edu/UF00095158/00001
 Material Information
Title: Real-time transaction scheduling : a cost conscious approach
Series Title: Department of Computer and Information Science and Engineering Technical Reports ; 92-043
Physical Description: Book
Language: English
Creator: Hong, D.
Chakravarthy, S.
Johnson, T.
Publisher: Department of Computer and Information Sciences, University of Florida
Place of Publication: Gainesville, Fla.
Copyright Date: 1992
 Record Information
Bibliographic ID: UF00095158
Volume ID: VID00001
Source Institution: University of Florida
Holding Location: University of Florida
Rights Management: All rights reserved by the source institution and holding location.

Downloads

This item has the following downloads:

199274 ( PDF )


Full Text








University of Florida
Computer and Information Sciences


SDepartment of Computer and Information Sciences
c"' Computer Science Engineering Building
SUniversity of Florida
Gainesville, Florida 32611


Real-Time Transaction Scheduling : A
Cost Conscious Approach

D. Hong T. Johnson S. Chakravarthy

email: {dh2, ted, sharma}@cis.ufl.edu

UF-CIS-TR-92-043
(Submited for publication)

(This work was supported by the National Science Foundation Research Initiation
Grant IRI-9011216 and in part by the Florida High Technology and Industry
Council.)










Abstract


Real-time databases are an increasingly important component of embedded real-
time systems. In a real-time database context, transactions must not only maintain
the consistency constraints of the database but must also satisfy the timing constraints
specified for each transaction. Although several approaches have been proposed to
integrate real-time scheduling and database concurrency control methods, none of them
take into account the dynamic cost of scheduling a transaction. In this paper, we
propose a new cost conscious real-time transaction scheduling algorithm which considers
both static and dynamic costs associated with a transaction. Our dynamic priority
assignment algorithm adapts to changes in the system load without causing excessive
numbers of transaction restarts. Our simulations show its superiority over EDF-HP
algorithm.


1 Introduction

The main focus of attention in the real-time systems area has been the problem of scheduling
tasks with time constraints, while the active area of research in databases has been concurrency
control and recovery to guarantee database consistency. In designing a transaction scheduling
policy for a real-time database system (RTDBS), an integrated approach is required to maintain
the consistency constraints and at the same time satisfy transaction timing constraints. This dual
requirement makes real-time transaction scheduling more difficult than task scheduling in real-time
systems or transaction scheduling in database systems. Scheduling algorithms [ZRS87b, ZRS87a]
used in current real-time systems assume apriori knowledge of tasks (arrival time, deadline, resource
requirement, worst case execution time). For database applications, however, only part of such
knowledge (arrival time, deadline, conservative data access pattern) is available. As a result,
transaction scheduling in real-time database systems needs a different approach than that used in
scheduling tasks in real-time systems.
In this paper, we view a real-time database system as a transaction processing system whose
workload is composed of transactions with individual timing constraints. A timing constraint is
expressed in the form of a deadline, and we schedule soft real-time transactions (i.e, they have
timing constraints, but catastrophic results do not occur if the transaction misses its deadline
[s7Z]). We assume that the transactions do not have firm deadlines [Har91], so transactions that
do not meet their deadlines are not dropped. We propose a cost conscious dynamic scheduling
algorithm to minimize the number of transactions that miss their deadlines and mean lateness.


2 Previous work

There are several classes of real-time database (time-critical database) scheduling algorithms in
which various properties of time-critical schedulers are combined with properties of concurrency
control algorithms [AC:.!-.. AC;:.I--. AC;:.19, BMH89, CBB+89, Har91, 'i,. SRSC91, 5Z'8,
HSRT91]. Priority scheduling without knowing the data access pattern is presented as a rep-
resentative of algorithms with incomplete knowledge of resource requirements. The works in
[AC:.--.., AC;:.--I. AC;.I'9, HSRT91, Har91, s7Z] fall into this category. Earliest Deadline
First (EDF), Least Slack First (LSF) priority assignment policy with High Priority (HP) concur-
rency control method and Conditional Restart with estimated execution time on the main memory
resident databases were proposed in [AC;.I--., AC:.I--!.] [AC;:.I9] extends the above to disk










resident database environments. An optimistic concurrency control scheme with a deadline and
transaction length based priority assignment scheme [HSRT91] and an optimistic concurrency con-
trol with Adaptive EDF have also been proposed [Har91]. Optimistic concurrency control scheme,
however, shows better performance only for firm real-time transactions.
Priority scheduling with transaction pre-analysis is introduced as another approach with more
knowledge of resource requirements [BMH89, si."- SRSC91]. Conflict avoiding nonpreemptive
method and Hybrid algorithms which use conflict avoiding scheme in the non-overload case and
Conditional Restart conflict resolution method in the overload case have been proposed in [BMH89].
Static priority assignment based Priority Ceiling protocol using priority inheritance with exclusive
lock and read/write Priority Ceiling protocol have been proposed in [Sha"-] and [SRSC91].
In this paper we propose a new transaction pre-analysis based real-time transaction scheduling
algorithm which includes a novel transaction analysis scheme and a cost conscious dynamic prior-
ity assignment policy. Our approach overcomes the problems inherent to pessimistic transaction
analysis methods and non-adaptive EDF algorithms.
The rest of the paper is structured as follows: Section 3 provides motivation for our approach
and presents details of transaction pre-analysis and the scheduling algorithm that uses the dynamic
priority assignment policy. Sections 4 and 5 compare our approach to EDF-HP (EDF priority
assignment policy with High Priority conflict resolution method [AC .1'--1]) for main memory and
disk resident database respectively through a simulation. Section 6 contains conclusion and future
research.


3 Cost Conscious Approach (CCA)

A static priority assignment is not adequate in a real-time transaction processing system because
it cannot consider the urgency of deadline. The standard transaction pre-analysis method also is
inadequate because it is too pessimistic to use in real-time systems. The EDF and LSF priority
assignment policies are restrictive for real-time transaction scheduling because they ignore the
blocking among transactions, the rollback, and restart effects. To the best of our knowledge, the
effects of transaction rollback and restart overhead have not been used in conjunction with finer
analysis of conflicts among transactions, which is the main contribution of this paper.

3.1 Assumptions

We assume that our system contains a single CPU that manages disk or main memory resident
data. All transactions that the system executes are instances of one of a number of transaction
types. We assume that we know the programs of these transactions and have pre-analyzed them.
We allow only write locks in our current analysis (shared locks will make the dynamic cost an even
more important factor in real-time transaction scheduling). When a transaction arrives, we assume
that we know its deadline.

3.2 Motivation

Consider the well known real-time priority assignment policies, EDF and LSF. In the context of
real-time task scheduling, these policies are known to be acceptable [XP90, ZRS87b, ZRS87a].
However, these policies are not acceptable in the context of real-time transaction scheduling.
LSF is not appropriate for RTDBS because it is not easy to estimate the worst case execution
time of a transaction, due to the existence of disk IO and branches in the transaction programs.










In addition priority reversal may happen if we use LSF as a dynamic priority assignment with
continuous evaluation policy.
The weakness of EDF under high level of resource and data contention is that this policy causes
most transactions to miss their deadlines since they receive high priority only when they are close
to missing their deadline [Har91]. If EDF is combined with High Priority (HP) conflict resolution
method, the transaction restart and rollback easily makes the system heavily loaded. Thus EDF-HP
causes too many transaction aborts.
In order to solve the problem of too many transaction aborts of EDF-HP, EDF-WP (EDF prior-
ity assignment policy with Wait Promote conflict resolution method [AC;:.I 9]) has been proposed.
However, EDF-WP causes too much waiting due to its nonabortive conflict resolution method,
furthermore EDF-WP has deadlock problems.
Several hybrid methods that use combinations of abortive and nonabortive methods have been
proposed [AC;I .1-"., S"-] These methods make decisions about transaction blocking and rollback
using additional information like slack time or estimated execution time. However, they still have
deadlock problems.
In this paper, we introduce the cost conscious approach (CCA) to real-time transaction pro-
cessing. The CCA includes the cost of aborted transactions in its priority calculation to solve
EDF-HP's problem of excessive aborts. Furthermore CCA uses a transaction pre-analysis to avoid
the deadlock problems of the hybrid methods.

3.2.1 Dynamic cost

It is difficult to anticipate the finishing time of a real-time transaction due to the transaction
blocking and restarts. The transaction response time consists of the time needed to execute a
transaction in an isolated environment, Tstatic, and the blocking (both IO and concurrency related)
and restart overhead, Tdynamic- Tstatic is dependent on the semantics (data value and branches)
in the transaction application program. Tdynamic is dependent on the current status of the system
and on future events, i.e, on the transactions that are currently in the system and the transactions
that will arrive in the future.
The total execution Ttotal = Tstatic + Tynamic
In the real-time database context Tdynamic is very difficult to compute because we don't know
the future events. Even if we consider transaction in an isolated environment, the static transaction
response time, Tstatic, is also difficult to compute due to the existence of branches in the transac-
tion program. However it would help to improve the performance of RTDBS if we could use an
appropriate approximation dynamic cost.
If a newly arrived transaction, T,, has earlier deadline than that of the currently running
transaction, T,, and does not cause rollback (and restart) of partially executed transactions, then the
newly arrived transaction is a good choice for immediate execution. If Ta has earlier deadline than
that of the running transaction and conflicts with some or all of the partially executed transactions,
we have to consider several choices. If we use EDF priority assignment policy, several partially
executed transactions that conflict with Ta might have to be rolled back. If we consider the
dynamic cost, we might find that we lose too much time for the execution of the highest priority
transaction.
In order to calculate the approximate dynamic cost which will be used in our priority assignment
policy, we analyze transaction programs.










3.2.2 Transaction Pre-analysis

The set of data items that a transaction of some transaction type ,iilht access is called its data set.
A particular execution of a transaction is likely to actually access only a small fraction of its data set.
If we have no information about a transaction's execution, we must make the pessimistic assumption
that it will access all items in its data set. In order to make a finer analysis of the conflict relations
between transactions, we assume that as the transaction executes, it makes decisions that restricts
the set of data items that it will access. Consider, for example, the two transaction programs in
Figure 1:


A B


access w ....
If(w > 100) ..
access II, 12, 13 access II, 12, 13
else
access 14, IS, 16




Figure 1: Transaction programs

Suppose that TA1 executes program A and TB1 executes program B. If TA1 executes the If
statement and finds w > 100, TA1 and TB1 conflict. Otherwise, TA1 finds that w <= 100, TA1
and TB1 don't conflict. Before TA1 executes the If statement, TA1 and TB1 might conflict, so
we must make the pessimistic assumption that they do conflict. We call the statements in the
transaction program where the transaction commits itself (by executing a conditional statement)
to accessing a subset of its data set the decision points. We can model each transaction as a tree,
(i.e, the transaction tree) with the root labeled by the name of the transaction program. At each
decision point, the tree branches, and those nodes are given unique labels related to the program
name. These nodes represent refinements of what we know about the transaction's execution, and
in particular about the data set it accesses. The decision points in a program can be identified by a
programmer, or by a compiler. Figure 2 shows the transaction trees of transaction programs A and
B. Program A's decision point splits the transaction tree into node Aa and node Ab, which have
different data sets. Since program B contains no decision points, its transaction tree consists of a
single vertex. When we analyze the transaction programs, we find that TA1 superscriptt represents
the identifier of a transaction and subscript represents its label) conflicts with TB1, TAa conflicts
with Tf1, but that T?1 doesn't conflict with Tf1.
In the Figure 2, before node A reaches the decision point, it might conflict with node B (if
node A takes the branch to node Aa), or it might not conflict with node B (if node A takes the
other branch). Suppose node A makes the branch to node Aa. At this point we are certain that
node A conflicts with node B. So, our pre-analysis system has several different flavors of data
conflict. We say that two transactions don't conflict if, given their current state, they won't access
overlapping data sets for all possible execution paths. Two transactions conflict if, no matter what

1Although, a loop-free program is a directed acyclic graph, we use a tree representation for the sake of simplicity











B {11, 12,13}


program A program B

Figure 2: Transaction Tree

their execution paths, they will access overlapping datasets. If two transactions might or might not
conflict based on their future execution, then they conditionally conflict.
Suppose that transaction TJN conflicts with transaction TM, and TN is scheduled to execute. If
T" has not yet accessed any data items that THN might access, then there is no need to roll back
T", we only need to block it. In this case, we say that T is safe with T)N. If T has accessed
a data item that TJN will access, then T"' is unsafe with TJN and need to be rolled back. Finally,
T~" is conditionally unsafe with TJN if T might be safe or unsafe with Tp, depending on T 's
execution. We will soon define these concepts rigorously.
If we know what data items a transaction accesses between decision points, we can calculate
the conflict and safety relations in a straightforward manner. Towards this end, we define:
Leaf The label of a transaction that will execute no further decision points.
accesses(TJN) Set of data items that a transaction N of label P accesses before it reaches its next
decision point.
hasaccessed(TJN) Set of data items that a transaction N of label P has accessed up to this point.
mightaccess(TN) Set of data items that a transaction N of label P might access.
leaves(TJN) Set of leaves of the subtree rooted at label P of a transaction N.
We now give precise definitions of the conflict and safety relationships, which also provide a
method to calculate the relations. Suppose we are given accesses(Tp) for every node P in the
transaction tree. If K is the set of nodes on the path from the root to P, inclusive, then

hasaccessed(Tp) = UkIK accesses(Tk)
mightaccess(Tp) = hasaccessed(Tp) P a leaf
S UC a child of P mightaccess(Tc) P not a leaf

With mightaccess and hasaccessed calculated at every node, we can calculate the conflict and
safety relations:
Leaf transactions Tp, T&' conflict iff mightaccess(TNy) n mightaccess(T ')
Transactions TN, T" conflictiffVleaves(TN) Vqeaves(TM ) mightaccess(T) n mightaccess(T")


Transactions TN T" conditionally conflictiff ije leaves(TN)p m,nEleaves(TM) such that mightaccess(T )
n mightaccess(T>M) 5 p and mightaccess(T7) n mightaccessC(Tj) = .
Transactions TpN, T" don't conflict iff they neither conflict nor conditionally conflict.


A {11, 12, 3,14,15, 16}


Aa Ab
{11, 12, 13} {14,15,16}










T21 {


{A} 22 T2{B}


T24 T25 T26 T27
{C} {D} {C} {D}
accesses


A BC D

AC D BCD
A B


AC BC B D AC I A D

hasaccessed mightaccess

Figure 3: Auxiliary Transaction Tree


Transaction TH is safe wrt T14 iff hasaccessed(T ) n mightaccess(T14) = 4.

Transaction Tpj is unsafe wrt T~' iff V er lres(T, hasaccessed(TpN) n mightaccess(T") # 9.

Transaction Tpj is conditionally unsafe wrt Tc iff hasaccessed('Tp) n mightaccess(T14) # 9,
and 3qGZeaves(TQ) such that hasaccessed(TH) n mightaccess(T'A) .

Note that safety relationships are computed based on the assumption that a transaction ac-
cesses its data items when it begins and immediately after its decision points. These transaction
relationships will be used to calculate transaction priorities more accurately in the following section.
Even though maintaining the transaction relationship information requires additional space, it is a
reasonable approach for RTDBS to trade-off space for better performance.

3.3 Scheduling Algorithm

A real-time transaction scheduling algorithm consists of one or more priority assignment policies
and conflict resolution methods. The system might use different priority assignment policies for
different resource types. Whenever a resource conflict occurs, a priority is used to resolve the
conflict. In [ACG.I1--. 7Z'] they use different priority assignment policies for CPU and data
conflict in order to cope with their different restrictions. But if we use different priority assignment
policies for different resource types we might have a priority reversal that causes deadlock problems
[BMH89].
In CCA we use only one priority assignment policy for CPU and data conflicts.

3.3.1 Priority Assignment

A priority assignment policy is classified as being a static assignment policy if it is based on static
information (e.g, estimated execution time) or as a dynamic assignment policy if it is based on
dynamic information (e.g, relative deadline, effective service time). A dynamic priority assignment










policy can use a static evaluation method which evaluates the priority only once (e.g. EDF),
or a continuous evaluation method which evaluates the priority several times (e.g, LSF) during
the execution of a transaction. Even though several static priority assignment policies have been
proposed [LL73], they do not capture all the dynamic features of database transactions.
If the transaction Ta which is selected to be run next conflicts with m transactions that are
unsafe or conditionally unsafe with T,, we might lose
T s, = EtEM rollbackt + exect) where
M = {t I transaction t is unsafe or conditionally unsafe with Ta}
where exect is the effective service time of Tt and rollback is the time required to roll back Tt.
If the value of T s, is large, executing Ta wastes system resources. We characterize the time lost
as the penalty of conflict.

penalty of conflict is the value TL,, which is the sum of the effective service time and rollback
time of the transactions that must be rolled back to execute Ta to its commit point without
interruption.

The notion of the penalty of conflict, described above, can be introduced into the our CCA
dynamic priority computation formula. If Pr(Ti) is the priority of transaction Ti and di is the
deadline of transaction Ti, then


Pr(Ti) = -(di + wTJ)
The value of w will be i ....1-l -. accordingly to get the best performance.

3.3.2 High Priority Preference Conflict Resolution

There are 3 types of resources in the system: CPU, disk and data. The main active resources
in real-time database systems are the CPU and disk, and the passive resource is the data. They
require different scheduling disciplines because of their different restrictions [Har91].

Data conflict If there is a data conflict between two transactions, a priority-based wound-wait
strategy [BMH89] is the simplest to implement. The Conditional Restart algorithm with an
estimated execution time [AC;.I".i] has been proposed to avoid needless aborts and roll-
back. The algorithm, however, has unpredictable blocking of high priority transactions due
to deadlock, arrival of intermediate priority transactions, and chain blocking. The problem of
unpredictable blocking due to arrival of intermediate priority transaction and chain blocking
can be solved with priority inheritance [Sha"-] But if a set of transactions are deadlocked
(they access the same data items in different order), the Conditional Restart method can
degrade performance. The idea of HP [AC;."I.-1 AC;.S19], which is the same as the priority-
based wound-wait strategy [BMH89], is to resolve a conflict in favor of the transaction with
the higher priority. In our approach, whenever a data conflict occurs, the running transaction
aborts the conflicting transactions. The priority of the running transaction is always higher
than that of the conflicting transactions because only the highest priority transaction (main
memory database) or the transaction that doesn't have the highest priority but is compatible
with partially executed transactions (disk resident database) gets the CPU.
CPU conflict If we assume that we have a single CPU system, there are many opportunities
for CPU scheduling. Whenever a new transaction arrives or a running transaction finishes,
the scheduler is invoked. If the scheduler cannot be invoked immediately for several reasons
(e.g Real-time UNIX [FF91]), the highest priority transaction can be selected from among










transactions that are in the ready queue or are currently running. When a running transaction
finishes, all transactions blocked by the resources that currently running transaction hold wake
up and move to ready queue. Then, the highest priority transaction is chosen as the next one
for execution. In our approach we assume that whenever a new transaction arrives, a running
transaction finishes, IO wait occurs the scheduler is invoked immediately.
IO conflict If the real-time database contains disk resident data, a transaction might perform
many IO waits during its execution. Several real-time IO scheduling methods have been
proposed [AC; .IS9, CBB+89] in order to reduce IO wait. Disk IO introduces new problems in
real-time transaction scheduling. Consider the following scenario: Transaction T1 is blocked
and is waiting for an IO completion. The next highest priority transaction, T2, gets the CPU
and starts executing so as not to waste the CPU. If T2 conflicts with Ti, then T2 performs a
o,,, .... ../'I,, 'i ,I execution because it must be rolled back when Ti unblocks.
noncontributing execution Lower priority transaction's execution during the 10 wait of
higher priority transactions that is rolled back when a higher priority transaction finishes
IO.
This situation is worse than the situation in which no transaction is selected to execute during
TI's IO wait time, because of the cost incurred in rolling T2 back. If the third highest priority
transaction, T3, accesses a data set disjoint with that of Ti and T2, then T3 is the better
choice. In our approach we select T3 rather than T2 during Ti's IO wait using the pre-analyzed
information.

3.3.3 Algorithm

The following is the pseudo code for the scheduling algorithm proposed in this paper and is based on
the notion of cost incurred due to conflicts. The procedure "IOwait-- 1 .1n1.1 is invoked whenever a
transaction blocks waiting for 10 completion. This function reduces the noncontributing execution
and hence avoids rollback by using transaction conflict relations.

Procedure IOwait-schedule
BEGIN
IF ready queue is empty
THEN
return NIL;
ELSE
IF there are transactions in the ready queue
that don't conflict or conditionally conflict
with partially executed transactions
THEN
return the one with the highest priority among them;
ELSE
return NIL;
END


The procedure "tr-arri.1--, 1, ..11. is called whenever a new transactions arrives and the pro-
cedure "tr-fni;-1,-- l. 111. is invoked whenever the running transaction finishes. These two pro-
cedures use the penalty of conflict (approximation of dynamic cost) of transactions in order to










improve the performance of RTDBS. The sleep queue holds transactions that are blocked and the
partially executed transaction list (P list) links all transactions that are executed partially. We in-
troduce a parameter penalty-weight (w in our previous priority formula) that can be used to weigh
the contribution of penalty of conflict on the value of the priority value computed. By assigning
different values to penalty-weight, different scheduling policies can be obtained. For instance, if
the parameter penalty-weight is assigned 0, it produces the EDF-HP for main memory database.
If penalty-weight is oo (i.e a value large enough so that transaction abort may not happen), it
produces the EDF-Wait for main memory database. We use a value of penalty-weight between 0
and oo for our algorithm.

Procedure Pr
BEGIN
calculate (deadline + (penalty-weight penalty of conflict));
take negative value;
END


Procedure penaltyofconflict
BEGIN
FOREACH transaction in the P list
IF unsafe or conditionally unsafe
THEN
add its effective service time;
END


TA is a new transaction and TH is the highest priority transaction in the following procedures.

Procedure tr-arrival-schedule
BEGIN
IF Pr(TH) < Pr(TA)
THEN
make TA as a new TH;
schedule TH;
ELSE
add TA to the ready queue;
schedule TH;
END


Procedure tr-finish-schedule
BEGIN
FOREACH transaction in the ready queue
BEGIN
assign new priority;
Choose the highest priority transaction and make it TH;
END
END










3.3.4 Properties of CCA


CCA uses a dynamic priority assignment with continuous evaluation method in order to adapt to
the changes of systems load effectively. However a dynamic priority assignment with continuous
evaluation method might have two potential problems: deadlock and circular abort.
The HP conflict resolution scheme is a deadlock prevention mechanism if it is combined with a
fixed or dynamic with static evaluation priority assignment. If it is combined with some dynamic
assignment with a continuous evaluation methods (e.g., LSF) it can cause deadlock due to priority
reversal. Our approach uses a dynamic priority assignment with a continuous evaluation method
and HP conflict resolution scheme. However CCA is still deadlock free because there is no lock
wait in CCA.

Theorem 1 There exist no deadlock under CCA scheduling.

In order to prove Theorem 1 we define following terms;
A primary transaction is defined as the transaction TH that is scheduled by the procedure "tr-
arril.,1 -- 1,.1 '1. or "tr-f ii-l-1,- ,. .1.11 ". Only one primary transaction exists in the system.
Although it is possible to have more than one transaction that have the highest priority value,
only one is designated as TH.
A secondary transaction is defined as the transaction Ts that is scheduled by the procedure
"IO-wait--, 1,. .1. ". By definition, the transaction Ts doesn't conflict or conditionally conflict
with any partially executed transaction. During the IO wait, only Ts can be executed.
Proof :
case The transaction TH accesses the data item that is held by some transaction in the P
list then the transaction in P list will get aborted.
case2 The transaction Ts accesses the data item that is held by a transaction in P list. This
case cannot happen by the definition of Ts.

Lemma 1 There exist no priority reversal between TH and any other transaction in the system
under CCA scheduling.

Proof : Note that when Ts is being executed the priority of any transaction in the system does
not change by definition (as it does not conflict with any transaction in the P list). Now
when TH (either an incoming transaction or a transaction picked from the ready queue) is
running Pr(TH) is greater than or equal to any transaction in the ready queue. Without loss
of generality, if TH aborts any transaction (say Tx), then the priority of TH increases (because
the penalty of conflict decreases by the effective service time of Tx) and so will the priority of
any transaction Ty in the ready queue that conflicts with Tx by the same amount.2 Also, the
priority of any transaction in the ready queue that doesn't conflict with Tx does not change.
Hence the priority relationship between TH and every other transaction in the ready queue
that is not aborted remains the same. Hence there is no priority reversal. However there could
be priority reversal between non-conflicting transactions.

Theorem 2 There exist no circular abort under CCA.

Proof : Only the primary transaction aborts conflicting transactions and conflicting transactions
cannot have higher priority than that of the primary transaction. Thus from Theorem 2 there
is no priority reversal and an abort occurs between conflicting transactions only.
If both Tx and Ty are aborted by TH then it does not pose any problem for maintaining the priority order either.










4 Simulation of main memory database


In order to evaluate the performance of the CCA algorithm we wrote a simulation of real-time
transaction scheduler using C language and SIMPACK simulation package [Fis92]. In this sim-
ulation we have single processor and memory resident database. We assume that whenever we
assign new priorities we can decide whether the relationship is safe or unsafe with the help of our
transaction pre-analysis method. This assumption is very optimistic because it doesn't include the
effect of conditionally unsafe.
Transactions enter the system according to a Poisson process with arrival rate A (i.e., expo-
nentially distributed inter-arrival times with mean value 1/A), and they are ready to execute when
they enter the system (i.e., release time equals arrival time). Every transaction is one instance of
50 transaction types and the transaction type for arriving transaction is chosen uniformly from
the range of types. The number of objects updated by a transaction type is chosen from a normal
distribution and the actual database items are chosen uniformly from the range of database size.
These items and the number are regenerated at each runs and the time to access data item is always
the same. The assignment of a deadline is controlled by the resource time of a transaction and two
parameters Min-slack and Max-slack which set a lower and upper bound of percentage of slack time
compared to the execution time respectively. A deadline is calculated by summing resource time
and slack time which is calculated by multiplying slack percent and resource time. Slack percent
is chosen uniformly from the range of Min-slack and Max-slack.

Deadline = arrival time + resource time x (1 + slack percent)

We ran the simulation with the same parameter for 10 different random number seeds and 1000
transactions are executed at each run. For each algorithm the result were collected and averaged
over the 10 runs. We varied parameters shown in Table 1 in order to see the behavior of CCA on
various environment.

Arrival-rate The average arrival rate of new transactions entering the system.
Update-time The variation of time needed to update one item.
DBsize The number of objects in the database.
Penalty-weight The portion of penalty of conflict compared to that of deadline in priority calcu-
lation.


4.1 Effect of Arrival Rate

In this experiment, we varied arrival rate from 1 tr/sec to 10 trs/sec with the base parameters
shown in Table 1. With the base parameters the capacity of the system (assuming no aborts) is:

4 ms 20 update 80 ms
x = 12.5 transactions/second
update transaction transaction

We plot our results to 10 trs/sec, because past this point more than 20 miss their deadlines.
The 20 miss rate indicates an overload condition [HCL90] requiring specialized mechanisms.
Figure 4.a shows the effect of arrival rate. Figure 4.b shows the improvement of CCA over EDF-
HP in term of lateness and the number of transactions that have missed their deadlines. CCA
shows upto 30 and 20 improvement in terms of mean lateness and miss percent respectively.
The improvement of CCA over EDF-HP is calculated by:











Parameter Value
Transaction type 50
Update per transaction(mean, std) (20, 10)
Computation/update(ms) 4
Database size 30
Min-slack as fraction of total runtime 20( .)
Max-slack as fraction of total runtime 800( .)
abort cost(ms) 4
weight of penalty of conflict 1


Table 1: Base parameters



EDF CCA
improvement = ED 1III1'
EDF

We observe that with the base parameters in Table 1, the number of restarts climbs steeply up
to arrival rate 8 and then declines sharply from the peak point in Figure 4.c. The reason for sharp
decline is that when the arrival rate is high, it is less likely that an arriving transaction will have
an earlier deadline than the currently running transaction. After the peak, it is usually the case
that the currently running transaction arrived a long time ago, but could not get system services
due to the heavy load on the system. Thus, fewer transactions are preempted and there are fewer
opportunities for restarts [ACG.1I".,] The improvement graph of CCA over EDF-HP is almost the
same shape as the graph of transaction abort. Before this peak point, CCA makes better decisions
about transaction aborts and restarts than EDF-HP, which improves performance.
The average number of partially executed transactions in the experiment with base parameters
is 1 to 2 with the changes of arrival rate from 1 tr/sec to 10 trs/sec. Thus scheduling overhead of
the CCA does not cause a problem.

4.2 Effect of Variation of Update Time

In this experiment, we classified the 50 transaction types into 3 classes and assigned the computation
time per update as 0.4, 4 and 40 according to their classes. The capacity of the system (disregarding
aborts) is:
0.4+4+40 20 296 ms
3 x t s = 3.37 transaction/second
update transaction transaction

The transaction classes create a lot of variance in the transaction execution time (the execution
time of transaction varies from 4 ms to 1200 ms). Therefore, there will be more chances for
transaction preemption. Figure 4.d and Figure 4.e show the results of the experiment. With the
variation of update time there is higher possibility that an arriving transaction will have an earlier
deadline than the currently executing transaction. Thus the improvement of CCA over EDF-HP
is a little higher in term of miss percent and mean lateness.










4.3 Effect of Database Size


In this experiment, we fixed every parameter except database size. When the database size in-
creases, system load decreases. Figure 4.f shows the effect of DB size on arrival rate 10. The
experiment shows that CCA performs better than EDF-HP in the situation where many transac-
tion aborts occur due to heavy data contention among transactions. Thus we can see that CCA can
adapt to changes on the system load caused not by transaction arrival rate but by data contention
among transactions.

4.4 Effect of Penalty-Weight

Figure 5.a shows the stability of penalty-weight. This is desirable property because the performance
of the system is not sensitive to the selection of penalty-weight within some range. This value is
largely dependent on the lengths of transactions that are run on the system.


5 Simulation of Disk resident database

In order to see the performance of our algorithm on disk resident database we extended the sim-
ulation program of real-time database system. In this simulation we assumed that we have single
processor, single disk and FCFS IO scheduling. We assume that whenever we assign new priorities
we can decide whether the relationship is safe or unsafe and that whenever we try to find a non-
conflicting transaction during the IOwait we can decide whether the relationship is conflict or don't
conflict with the help of our transaction pre-analysis method. This assumption is very optimistic
because it doesn't include the effects of conditionally unsafe nor conditionally conflict.
If a transaction is aborted during its wait on the disk queue, the transaction is deleted from the
disk queue immediately. However, if a transaction is aborted during its IO access it is not deleted
until it releases the disk.


Parameter Value
Transaction type 50
Update per transaction(mean, std) (20, 10)
Database size 30
Min-slack as fraction of total runtime 20( .)
Max-slack as fraction of total runtime 800( .)
abort cost(ms) 5
weight of penalty of conflict 1
Computation/Update time(ms) 4
Disk access time(ms) 25
Disk access probability 1/10


Table 2: Base parameters for disk resident database

The base parameters in this simulation program was selected to avoid the bottleneck at the
disk access. With the base parameters in the Table 2 the capacity of the system is:

20 items 4 80 ms
St a- im t = 12.5 trs/second
transaction item transaction










This calculation is very optimistic because it doesn't include abort cost nor the cost of re-
executing transactions. When the load of the system reaches its capacity the utilization of the disk
is:

12.5 x 20/10 x 25
x 100 = 62.5
1000 ms

We ran the simulation with the same parameter in Table 2 for 30 different random number
seeds and 300 transactions are executed at each run. The number of transaction is chosen to avoid
bottleneck at disk access without introducing new long term scheduling (job scheduling). In our
experiment the utilization of the disk within arrival rate from Itr/sec to 7trs/sec is below 62.5 .
which is maximum possible when we schedule only compatible transactions. For each algorithm
the results were collected and averaged over the 30 runs.
The average number of partially executed transactions is from 1 to 2 with the changes of arrival
rate from 1 tr/sec to 7 trs/sec. This value is the same as that of previous simulation on main
memory database. Thus the transaction scheduling overhead still does not cause a problem.

5.1 Effect of Arrival Rate

In this experiment, we varied arrival rate from 1 tr/sec to 7 trs/sec with the base parameters shown
in Table 2. Figure 5.b shows the effect of arrival rate and Figure 5.d shows the improvement of
CCA over EDF-HP. CCA shows upto 95 and 40 improvement in terms of mean lateness and
miss percent respectively. The improvement of CCA over EDF-HP in terms of mean lateness is
remarkable for soft real-time transactions. The improvement is better than that of main memory
resident case. The reason for better result is that CCA not only makes better decision about
transaction blocking and restart but also prevents ,,,, .,,Il, 7,'1,l, executions effectively.
Figure 5.c shows the number of transaction restarts in CCA and EDF-HP with the increase of
arrival rate. The plot of CCA restart is almost the same as that of main memory database. However
the restart in EDF-HP increases monotonically with the increase of arrival rate. This phenomenon
is different from previous simulation on main memory database. The reason for monotonic increase
in EDF-HP is that when the arrival rate is high, the possibility of restarting the partially executed
transactions which are selected during the IO wait is very high, while the possibility of restart of
partially executed transactions which are selected by procedure "tr-arri.,1--.1.. 1n1. or "tr-finish-
-. 1,. .11. is very low. With the longer IO wait time the more transactions are scheduled and that
makes the IO wait time longer and longer. Thus the possibility of restarting the partially executed
transactions increases monotonically.

5.2 Effect of DBsize

In this experiment, we fixed every parameters except database size. Figure 5.e shows the effect of
DB size on arrival rate 4. The experiment shows that CCA performs better than EDF-HP in the
situation where many transaction aborts occur due to heavy data contention among transactions
on disk resident database also.

5.3 Effect of Penalty-Weight

Figure 5.f shows the stability of penalty-weight. The performance of the system is not sensitive to
the selection of penalty-weight within a wide range in this experiment.










6 Conclusion and future work


To the best of our knowledge, all previous methods of real-time transaction scheduling that use
transaction abort have not considered the dynamic cost, the cost of rolling back and restarting
transactions. This perhaps is not a key consideration in real-time task scheduling that only consider
timing correctness. But in real-time transaction scheduling, the cost incurred at run time to keep
the database consistent should be considered as a key factor.
EDF-HP and Priority Ceiling Protocol are the extreme methods that use abort and wait re-
spectively in order to solve data conflicts. Even though Conditional Restart method [AC;.I1--.]
and Stankovic's two protocols [Z7'] have been ir-:-. -I as a compromise between abort and wait
method, they all have deadlock problems.
In this paper, we have proposed a new real-time transaction scheduling algorithm that has a cost
conscious dynamic priority assignment policy. Our approach uses dynamic priority assignment with
continuous evaluation method to adapt system to the changes of load effectively and resolves the
excessive restart problem of EDF-HP encounters in high data contention. Figure 4.c and Figure 5.c
show the reduction in the number of restart per transaction of CCA over EDF-HP on main memory
and disk resident database, respectively.
The distinctive features of our approach are:
First, our dynamic priority assignment policy synthesizes deadline and penalty of conflict to-
gether. The amount of effective service time of a transaction is implicitly taken into account as it
is a part of the penalty of conflict computed for conflicting transactions.
Second, our approach is deadlock free. Whenever data conflict occurs, running transaction gets
the CPU and aborts conflicting transaction.
Third, there is no circular abort in our approach. Even though we use a dynamic priority
assignment policy with a continuous evaluation method we do not have circular abort problems.
Fourth, our priority assignment policy easily adapts to the changes of system load which is
caused by data contention using penalty of conflict and works well in a high data contention.
Fifth, there is no starvation in our approach. If we consider the deadline of a transaction when
calculating the transaction priority then we avoid starvation. When all transactions access disjoint
data sets or when system is lightly loaded, there is no starvation problem because the priority
assignment policy proposed here is the same as EDF-HP. When the system is heavily loaded,
transactions that have large penalty of conflict usually are delayed because of their low priority.
But the effect of deadline prevent those transactions from going into starvation when the urgency
of deadlines of the transactions compensate the effect of their penalties, those transactions get high
priority.
In this paper we assumed that we only have exclusive locks and same criticalness in the system.
The effect of shared locks in transactions and multiple criticalness will affect the performance
of RTDBS. In addition we didn't simulate the effects of conditionally unsafe and conditionally
conflict. These effects primarily depends on the semantics of the transaction programs. The
complex transaction programs even make the deadline assignment to transactions very difficult.
The effect of recovery cost is included in previous simulations in very simple ways. We assumed
that we could recover a transaction very quickly within a fixed amount of time regardless of its
execution time. If the recovery cost is propotional to the execution of a transaction or several disk
10 operations are required in transaction recovery then our approach is very attractive because
CCA shows fewer number of transaction restarts over EDF-HP in Figure 4.c and Figure 5.c.
Current trend of real-time system is tightly or loosely coupled multiprocessor which have more
resources, computational power and reliability and parallelism. Extending our approach to mul-










tiprocessor environment is more promising than simple EDF-HP approach because our approach
shows better performance than EDF-HP when data contention is high and EDF-HP which only
uses deadline information looks almost impossible to get better performance on multiprocessors
systems. Currently we are developing a combination of CCA and EDF-HP for shared memory
multiprocessors and shared nothing multiprocessors systems.


References

[ACG.I-".i] Robert Abbot and Hector Garcia-Molina. Scheduling real-time transactions. SIC( I[OD
RECORD, 17(1):71-81, 1I''-
[ACG:. I'.] Robert Abbot and Hector Garcia-Molina. Scheduling real-time transactions: a perfor-
mance evaluation. In Proceedings of the 14th Very Large DataBase Conference, pages
1-12. AC':.I 1'"-
[AC;.I189] Robert Abbot and Hector Garcia-Molina. Scheduling real-time transactions with disk
resident data. In Proceedings of the 15th Very Large DataBase Conference, pages ;'".
396. AC'.I, 1',-"
[BMH89] A. Buchmann, D.R. McCarthy, and M. Hsu. Time-critical database scheduling: A
framework for integrating real-time scheduling and concurrency control. In Proceedings
of the Fifth Conference on Data Ei..'i i pages 470-480, Feb 1','-
[CBB+89] Sharma Chakravarthy, Barbara Blaustein, Alejandro Buchmann, Michael Carey,
Umeshwar Dayal, David Goldhirsch, Meichun Hsu, Rivka Ladin Rajiv Jauhari, Miron
Livny, Dennis McCarthy, Richard McKee, and Arnon Rosenthal. Hipac: A research
project in active, time-constrained database management. Final technical report xait-
89-02, XEROX, July 1'l'i
[FF91] Borko Furht and Borivoje Furht. Real-time UNIX systems: .1. ', and application
guide. Kluwer Academic, Boston, 1991.
[Fis92] Paul A. Fishwick. SIMPACK:C-based Simulation Tool Package Version 2. University
of Florida, 1992.
[Har91] Jayant Ramaswamy Haritsa. Transaction scheduling in firm real-time database systems.
Technical Report TR1036, University of Wisconsin-Madison, 1991.
[HCL90] Jayant R. Haritsa, Michael J. Carey, and Miron Livny. On being optimistic about
real-time constraints. AC If SIC( IOD, 1990.
[HSRT91] Jiandong Hyang, John A. Stankovic, Krithi Ramamritham, and Don Towsley. Experi-
mental evaluation of real-time optimistic concurrency control schemes. In Proceedings
of the 17th Very Large DataBase Conference, pages 35-46. AC'..I, 1991.
[LL73] C.L. Liu and J.W. Layland. Scheduling algorithms for multiprogramming in a hard
real-time environment. JAC 11, pages 46-61, 1973.
[si,."--] Lui Sha. Concurrency control for distributed real-time databases. SIC I[OD RECORD,
17(1):82-98, 1',--
[SRSC91] Lui Sha, Ragunathan Rajkumar, Sang Hyuk Son, and Chun-Hyun Chang. A real-time
locking protocol. IEEE Transactions on Computers, 40(7):793-800, 1991.
[Z"--] John A. Stankovic and Wei Zhao. On real-time transactions. SI( IfOD RECORD,
17(1):4-18, l',--










[XP90] Jia Xu and David R. Parnas. Scheduling processes with release times, deadlines, prece-
dence, and exclusion relations. IEEE Transactions on Software E,-i',.. ','i 16(3):360
369, 1990.
[ZRS87a] Wei Zhao, Krithi Ramamritham, and John A. Stankovic. Preemptive scheduling under
time and resource constraints. IEEE Transactions on Computers, 36(8):949-960, 1i' 7.
[ZRS87b] Wei Zhao, Krithi Ramamritham, and John A. Stankovic. Scheduling tasks with re-
quirement in hard real-time systems. IEEE Transactions on Software E, -i',.. '.-i
13(5):225-236, 1' 7.


















EDF, CCA (base parameters)


1 2 3 4 5 6 7 8 9 10
Arrival Rate(trs/sec)



(a) Miss percent of EDF,CCA




Restarts per tr (base parameters)


1 2 3 4 5 6 7 8 9 10
Arrival Rate(trs/sec)



(c) Restart per transaction




Improvement (high variance)

Miss Percent
Mean Lateness -,--

JW











0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
Arrival Rate(trs/sec)



(e) Improvement (high variance)


Improvement (base parameters)
35

30

25

20

15 / "

10 Miss Percent
Mean Lateness
5

0
'"*

1 2 3 4 5 6 7 8 9 10
Arrival Rate(trs/sec)



(b) Improvement of CCA




EDF,CCA(high variance:DBsize=30,etime=0.4,4,40)
30

25


20
EDF -
15 CCA -*--

10


5

0
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
Arrival Rate(trs/sec)



(d) Effect of high variance




EDF, CCA (base parameters,Arrival rate=10)

40

35

30
3 0 .. ....... . ....


25

20 EDF
CCA -*--
1 5


100 200 300 400 500 600 700 800 9001000
DBsize



(f) Effect of DB size


Figure 4: SimlPation Result 1

















Effect of penalty-weight (base parameters)
12
5 TPS -
10 8 TPS --

8 "

-* - -- *-------- ----- - - - - -
6

4

2

0
0 ----- --------------
0 5 10 15 20
Penalty-weight



(a) Effect of penalty-weight




Restarts per tr (base parameters)


1 2 3 4 5 6 7
Arrival Rate(trs/sec)



(c) Restart per tr (disk resident)




EDF,CCA (base parameters, Arrival rate=4)

12

10


100 200 300 400 500 600
DBsize



(e) Effect of DB size (disk resident)


EDF, CCA (base parameters)


1 2 3 4 5 6 7
Arrival Rate(trs/sec)



(b) Miss percent of EDF, CCA (disk resident)




Improvement (base parameters)
100
----------- ---------

80


60


40 --


20 Miss Percent
Mean Lateness -

0
1 2 3 4 5 6 7
Arrival Rate(trs/sec)



(d) Improvement of CCA (disk resident)




Effect of penalty-weight (base parameters)

12 4 TPS

10

8

6

4

2

0
0 ----- -------------
0 5 10 15 20
Penalty-weight



(f) Effect of penalty-weight(disk resident)


Figure 5: Sim nation Result 2




University of Florida Home Page
© 2004 - 2010 University of Florida George A. Smathers Libraries.
All rights reserved.

Acceptable Use, Copyright, and Disclaimer Statement
Last updated October 10, 2010 - - mvs