• Keine Ergebnisse gefunden

a) Write the sequence of actions for each transaction t1, t2 and t3

N/A
N/A
Protected

Academic year: 2022

Aktie "a) Write the sequence of actions for each transaction t1, t2 and t3"

Copied!
5
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Quiz Sheet No. 3 for Architecture and Implementation of Database Systems Prof. Rudolf Bayer, Ph. D.

Institut für Informatik SS 2003

Exercises for Chapters 4.2 – 4.7: Serializability and Synchronization

1. Let H: r1(y), r3(n), r2(y), w1(y), r1(x), w1(x), r2(x), r2(z), w2(z), r3(x), w3(x)

be a schedule of three transactions t1, t2 and t3 that are accessing objects n, x, y and z.

a) Write the sequence of actions for each transaction t1, t2 and t3.

Answer:

t1 = (bot, r(y), w(y), r(x), w(x), eot) t2 = (bot, r(y), r(x), r(z), w(z), eot) t3 = (bot, r(n), r(x), w(x), eot)

b) Determine the conflict relation confH.

Answer:

confH = { (r2(y), w1(y)), (r1(x), w3(x)), (w1(x), r2(x)), (w1(x), r3(x)), (w1(x), w3(x)), (r2(x), w3(x)) }

c) Sketch the corresponding conflict graph using the “follow relation” (defined in chapter 4.3 on page11).

Answer:

t1 t2

t3

d) Is schedule H conflict serializable?

Answer:

Conflict graph is cyclic ⇒ H is not conflict serializable

(2)

2. Let t1, t2 and t3 be three transactions that are defined in the following way:

t1 = (bot, r(u), r(y), w(y), r(z), w(z), w(u), eot) t2 = (bot, r(z), r(u), r(y), w(z), eot)

t3 = (bot, r(z), r(y), r(u), w(u), eot)

a) Compute conf for the set of operations in t1, t2 and t3.

Answer:

conf = { (w1(y), r2(y)), (w1(y), r3(y)), (w1(z), r2(z)), (w1(z), w2(z)), (w1(z), r3(z)), (w1(u), r2(u)), (w1(u), r3(u)), (w1(u), w3(u)), (w2(z), r1(z)), (w2(z), r3(z)), (w3(u), r1(u)), (w3(u), r2(u)) }

b) Consider the following schedule H1:

timeline

Determine the relation confH1 for schedule H1.

Answer:

confH1 = { (r1(u), w3(u)), (r2(z), w1(z)), (r2(u), w1(u)), (r2(u), w3(u)), (w1(y), r2(y)), (w1(y), r3(y)), (r3(z), w1(z)), (r3(z), w2(z)), (r1(z), w2(z)), (w1(z), w2(z)), (r3(u), w1(u)), (w3(u), w1(u)) }

t1 t2 t3

r(u) r(y)

r(z) r(u) w(y)

r(z) r(y) r(y)

r(z) w(z)

r(u) w(u) w(u)

w(z)

(3)

c) Consider a second schedule H2:

t1 t2 t3

r(u)

r(z) r(y)

r(u) r(y) w(y)

w(z) r(z)

w(z)

r(z) r(y) w(u)

r(u) w(u)

Show that H2 is conflict serializable.

Answer:

confH2 = { (r1(u), w3(u)), (r2(z), w1(z)), (r2(u), w1(u)), (r2(u), w3(u)), (r2(y), w1(y)), (w1(y), r3(y)), (w2(z), r1(z)), (w2(z), w1(z)), (w2(z), r3(z)), (w1(z), r3(z)), (w1(u), r3(u)), (w1(u), w3(u)) }

Consider serial execution of the three transactions in H2’: t2; t1; t3.

confH2’ = { (r2(z), w1(z)), (r2(u), w1(u)), (r2(u), w3(u)), (r2(y), w1(y)), (w2(z), r1(z)), (w2(z), w1(z)), (w2(z), r3(z)), (r1(u), w3(u)), (w1(y), r3(y)), (w1(z), r3(z)), (w1(u), r3(u)), (w1(u), w3(u)) } = confH2

⇒ H2 is conflict serializable

conflict graph of H2 is acyclic:

t1 t2

t3

(4)

d) Describe some possibilities for modifying H2 to a new schedule H3, so that H3 is also serializable.

Answer:

A variety of answers are possible, e.g.

the order of the first 5 read operations in H2 can be chosen freely

w1(y) and w2(z) do not affect each other, so H3: …, w2(z), w1(y), … is possible

e) List the lock requests for each transaction t1, t2 and t3 according to the (R,A,X) protocol.

Answer:

Lock requests at the time of transaction commit:

t1: (t1, u, A), (t1, y, A), (t1, z, A) t2: (t2, z, A), (t2, u, R), (t2, y, R) t3: (t3, z, R), (t3, y, R), (t3, u, A)

3. Assume optimistic concurrency control (OCC) regarding this schedule:

t1 t2

bot

bot r(x)

r(y)

r(z) w(x)

w(z) eot

r(x) eot

a) Determine the ReadSet and WriteSet of each transaction.

Answer:

ReadSet WriteSet

t1 x, y x

t2 z, x z

(5)

b) What will happen to transaction t2 in this execution order? Why?

Answer:

ReadSett2 ∩ WriteSett1 = {x}, i.e. ≠Ø

? t2 will be aborted and must be repeated (although it is serializable).

Referenzen

ÄHNLICHE DOKUMENTE

1. c) Sketch the corresponding conflict graph using the “follow relation” (defined in chapter 4.3 on page11).. d) Describe some possibilities for modifying H2 to a new schedule

a) Determine the different states of the database, the cache and the safe along the timeline from timestamp 1 to 13 using the following schema. For each step fill in the appropriate

Sketch an operator graph using semi- joins for executing this query on the distributed DBS...

Exercise 3, Ch.4: How large is the hierarchically aggregated cube (without base table) for an aggregation up to the levels of the prefixes of calls, geographic 100*100 m squares

Reduce the dimensionality of the fact table by exploiting the fact that the location of a mobile phone user usually can only be determined by the current cell.. Make sure that

Technische Universität Braunschweig Institut für Informationssysteme http://www.ifis.cs.tu-bs.de Wolf-Tilo Balke, Silviu Homoceanu!. Exercises for DW & DM Sheet 4

The busy time of a thread strongly depends on the executed tasks and therefore is a metric that gives less information about the thread pool itself. In contrast, the waiting time is

However using ERP systems (e.g. SAP Green 2.0) to account for substance flows in production processes involves significant manual effort to enter and manage the