05_labexercisetransactions

Upload: upcursor

Post on 29-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 05_LabExerciseTransactions

    1/2

    Exercise: Transactions

    Name: ___________________________________Section: ___________________________________

    1. Consider the following transactions:

    T1: read(A) T2: read(B)read(B) read(A)

    if A = 0 then B := B + 1 if B = 0 then A := A + 1write(B) write(A)

    Let the consistency requirement be A = 0 or B = 0, with A = B = 0 as the initial values.

    a. Does every serial schedule involving these two transactions preserve the consistency of

    the database? Yes No (Encircle only one answer.)b. Is there a concurrent execution of T1 and T2 that produces a serializable schedule?

    Yes No (Encircle only one answer.)

    2. Consider the precedence graph below.

    Is the corresponding schedule conflict serializable?

    Yes No (Encircle only one answer.)

    If you answered yes to the question above, write downthe equivalent serial schedule(s) on the space below.

  • 8/9/2019 05_LabExerciseTransactions

    2/2

    3. Consider the following schedule:

    T1 T2 T3

    read(X)

    read(Z)

    read(Z)

    read(X)

    read(Y)

    write(X)

    write(Y)

    read(Y)

    write(Z)

    write(Y)

    Draw the precedence graph for the schedule onthe space below.

    Is the schedule conflict serializable?

    Yes No (Encircle only one answer.)

    If you answered yes to the question above,write down the equivalent serial schedule(s) on

    the space below.