ARTICLE

Transaction scheduling in ADO.NET

Posted by Wilson Articles | ADO.NET in VB.NET May 05, 2011
In this article, we will learn about the transaction and it's scheduling.
 
Reader Level:

Transaction Schedule or History:

when the transactions are executing concurrently in an interleaved fashion, the order of execution of instructions from the various transaction as transaction schedule.

A schedule S of n transactions t1,t2,t3......... tn, is an ordering of the operations of the transaction subject to consistent that, for each transaction t1 that participate in S, the operation of t1 in S must appear in the same order in which they occur in t1.

However, that operations from other transaction tj can be interleaved with the operations.

Schedule classification: The classification of schedule is given bellow:

Serial Schedule: A schedule s is serial if, for every transaction T participating in the schedule, all the operation of T are executed consecutively in the schedule.

  • suppose there two user submit their transaction T1 and T2 at approximately same time. if no interleaving is permitted, there are only two possible out comes:

    Execute all operations of transaction T1 and then execute all operations of transaction T2.
    OR
    Execute all operations of transaction T2 and then  Execute all operations of transaction T1.

  • In serial Schedule only one transaction at a time is active.

  • The commit or abort of the active transaction initiates execution of the next transaction.

  • No interleaving occur in a serial schedule.

  • serial Execution is so far simplest method to execute transactions. No extra work required to ensure consistency.

Non Serial Schedule: A Schedule is non serial if, for every transaction T participate in the schedule, the operation of T are executed in a interleaved manner with the operations of there transaction in the schedule.

Example:

Let us consider transaction T1 and T2
T1: R(X); w(X);R(y);W(Y); committed.
T2:R(X);W(X); committed.

Serializability of the schedule: The concept of serializability of a schedules used to identify which schedule are correct , when transaction execution have interleaving of there operations in the schedule.

  • Assumption: every serial schedule is correct.

  • Goal: Like to find non serial schedules which are also correct.

A schedule S of n Transaction is serializable. if it is equivalent to some serialize schedule of the same n transactions. when are two schedule equivalent?

  • They Lead same result (Result equivalent).

  • The order of any two conflicting operations is the same (Conflict Equivalent ).

Result equivalent:

Two Schedule are result equivalent if they produce the same final state of the database. In the following example Schedules S1 and Schedule s2are result equivalent for x=100but not in general :

S1                        S2
read_item(x)         read_item(x);
X=x-10;               X=X*1.1;
write_item(X)        write_item(X);

Conflict Equivalent:

Two schedule are said to be conflict equivalent if, the order of two conflicting operations is the same in both schedule. Example is given bellow: 

T1                       T2                                T1                             T2
read_item(A);                                             read_item(A);
write_item(A);                                            read_iteam(B);
read_item(B);                                             write_item(A);
write_item(B);                                                                             read_iteam(A);
                           read_item(A);                                                   write_item(A);
                           write_item(A);                  write_item(B); 
                           read_item(B);                                                    read_item(B);
                           write_item(B);                                                   write_item(B);

Serial Schedule (S)                                                Non Serial Schedule (S1)

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor