• No results found

Figure 19.1 Interleaved processing versus parallel processing of concurrent transactions.

N/A
N/A
Protected

Academic year: 2021

Share "Figure 19.1 Interleaved processing versus parallel processing of concurrent transactions."

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

CPU

1

CPU

2

A

A

B

B

C

D

Time

t

1

t

2

t

3

t

4

Figure 19.1

Interleaved processing versus parallel

(2)

read_item (X );

X:=X-N;

write_item (X );

read_item (Y );

Y:=Y+N;

write_item (Y );

read_item (

X );

X:=X+M;

write_item (

X );

(a)

T

1

(b)

T

2

Figure 19.2

Two sample transactions. (a) Transaction T

1

.

(3)

(a) (b) read_item(X); X:=X-N; write_item(X ); read_item(X ); X:=X+M; write_item(X ); read_item(X ); X:=X-N; write_item(X ); read_item(Y ); Y:=Y+N; write_item(Y ); read_item(X ); X:=X+M; write_item(X ); Time Time T1 T2 T1 T2

Item X has an incorrect value because its update by T1 is "lost" (overwritten)

Figure 19.3

Some problems that occur when concurrent

execution is uncontrolled. (a) The lost update problem.

(b) The temporary update problem.

(4)

read_item(X );

X:=X-N;

write_item(X );

read_item(Y);

Y:=Y+N;

write_item(Y);

sum:=0;

read_item(A);

sum:=sum+A;

read_item(X );

sum:=sum+X;

read_item(Y);

sum:=sum+Y;

T

3

reads X after N is subtracted and reads

Y before N is added; a wrong summary

is the result (off by N ).

(c)

T

1

T

3

Figure 19.3

Some problems that occur when concurrent

(5)

ACTIVE

PARTIALLY

COMMITTED

FAILED

COMMITTED

TERMINATED

BEGIN

TRANSACTION

END

TRANSACTION

READ,

WRITE

COMMIT

ABORT

ABORT

Figure 19.4

State transition diagram illustrating

(6)

read_item(X ); X:=X-N; write_item(X ); read_item(Y ); Y:=Y+N; write_item(Y ); read_item(X ); X:=X+M; write_item(X ); read_item(X ); X:=X-N; write_item(X ); read_item(Y ); Y:=Y+N; write_item(Y ); read_item(X ); X:=X+M; write_item(X );

(c)

read_item(X ); X:=X-N; write_item(X ); read_item(Y ); Y:=Y+N; write_item(Y ); read_item(X ); X:=X+M; write_item(X ); read_item(X ); X:=X-N; write_item(X ); read_item(Y ); Y:=Y+N; write_item(Y ); read_item(X ); X:=X+M; write_item(X );

(b)

(a)

Schedule A

Schedule B

Schedule C

Schedule D

Time Time

T

1

T

2

T

1

T

2

T

2

T

1

T

2

T

1 Time

Figure 19.5

Examples of serial and nonserial schedules involving transactions T

1

and T

2

. (a) Serial schedule A: T

1

followed by T

2

. (b) Serial schedule B: T

2

followed by

(7)

read_item(X );

X:=X+10;

write_item(X );

read_item(X );

X:=X*1.1;

write_item(X );

S

1

S

2

Figure 19.6

Two schedules that are result equivalent for the initial value

(8)

(a)

(b)

(c)

(d)

T

1

T

2

T

1

T

1

T

1

T

2

T

2

T

2

X

X

X

X

X

Figure 19.7

Constructing the precedence graphs for schedules A to D from

Figure 19.5 to test for conflict serializability. (a) Precedence graph for serial schedule A.

(b) Precedence graph for serial schedule B. (c) Precedence graph for schedule C (not

serializable). (d) Precedence graph for schedule D (serializable, equivalent to schedule A).

(9)

tr ansaction T2 read_item (Z ); read_item ( Y ); wr ite_item ( Y ); read_item ( X ); wr ite_item ( X ); tr ansaction T1 read_item ( X ); wr ite_item ( X ); read_item ( Y ); wr ite_item ( Y ); tr ansaction T3 read_item ( Y ); read_item (Z ); wr ite_item ( Y ); wr ite_item (Z ); ansaction T1 tr ansaction T2 tr ansaction T3 read_item (Z ); read_item ( Y ); wr ite_item ( Y ); read_item ( X ); wr ite_item ( X ); read_item ( Y ); read_item (Z ); wr ite_item ( Y ); wr ite_item ( Z ); Y ); ite_item ( Y ); X ); ite_item ( X ); ansaction T1 tr ansaction T2 tr ansaction T3 read_item ( Y ); wr ite_item ( Y ); read_item ( X ); wr ite_item ( X ); read_item (Z ); read_item ( Y ); read_item (Z ); wr ite_item ( Y ); wr ite_item ( Z ); Y ); ite_item ( Y ); X ); ite_item (X); Schedule E Schedule F

Figure 19.8

Another example of serializability testing.

(a) The

READ

and

WRITE

operations of three transactions T

1

, T

2

, and T

3

.

(10)

X,Y X Y

Equivalent serial schedules

Equivalent serial schedules (d)

(e)

(f)

Equivalent serial schedules

Reason None T3 T3 T3 T2 T2 T2 T2 T3 T3 T1 T1 T1 T1 T1 T1 T2 T2 T3 cycle X (T1➝T2), Y(T2➝T1) cycle X (T1➝T2), YZ (T2➝T3), Y(T3➝T1) Y, Z Y, Z Y Y

Figure 19.8

Another example of serializability testing.

(d) Precedence graph for schedule E. (e) Precedence graph for

References

Related documents

chawla/ 5 garima is married to suresh and has three children rata,sonu,raju how ravi related to ashok amaternal uncle bcousin cbrother in law... dfather in law 11.1.gita, ravi

Manendo, Anderson, de Braga, Perkins, Arberry, Dini, Price, Chowning, Bache, Carpenter, Humke, Close, Cegavske, Tiffany, Buckley, Sandoval, Mortenson, Parks, Segerblom,

1) Provide taskforce members with a handout showing what the City would be losing in revenue and total participants if the exemption thresholds would have decreased during

Thomas Leich, Gunter Saake Transaction Processing Last updated: 25.10.2020 1–1.. Introduction Transactions in the Architecture of

Given that the transaction processing is deterministic to the to- tal transaction ordering and that data are migrated alongside dis- tributed transactions, a transaction

For instance, a higher than expected decline in economic growth in China together with increases in interest rates set by the United States may lead to a

CVS Caremark suggests a plan consider the following pharmacy-related recommendations when developing its coverage under these provisions. CVS Caremark notes that previous HHS

3) Database-level dependency with row-level tainting (database-row): This policy implements previously pro- posed recovery methods [19]. It propagates taints when queries read