0% found this document useful (0 votes)
3 views4 pages

Exercises (Course: Database Management Systems) Concurrency Control Techniques

The document contains exercises related to concurrency control techniques in database management systems, specifically focusing on two-phase locking protocols and scenarios involving transaction scheduling. It includes tasks such as identifying transactions that follow specific locking protocols, drawing wait-for graphs, and explaining transaction aborts under different scheduling methods. Additionally, it addresses locking strategies for SQL queries involving a Movie database relation.

Uploaded by

ngonguyen037040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Exercises (Course: Database Management Systems) Concurrency Control Techniques

The document contains exercises related to concurrency control techniques in database management systems, specifically focusing on two-phase locking protocols and scenarios involving transaction scheduling. It includes tasks such as identifying transactions that follow specific locking protocols, drawing wait-for graphs, and explaining transaction aborts under different scheduling methods. Additionally, it addresses locking strategies for SQL queries involving a Movie database relation.

Uploaded by

ngonguyen037040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DBMS – HK1 2024-2025 Exercises – Chapter 6

Exercises
(Course: Database Management Systems)
Chapter 6
Concurrency Control Techniques

1. Identify transactions which are followed the two-phase locking protocol:


a.
T1 T2

Shared_lock(X)

Shared _item(X)

Shared_lock(X)

Read_item(X)

Exclusive_lock(Y)

Unlock(X)

Read_item(Y)

Unlock(X)

Write_item(Y)

Unlock(Y)

b.
T1 T2

Shared_lock(X)

Read_item(X)

Shared_lock(X)

Read_item(X)

Unlock(X)

Khoa Khoa học & Kỹ thuật Máy tính – Đại học Bách Khoa TP.HCM 1
DBMS – HK1 2024-2025 Exercises – Chapter 6

Exclusive_lock(Y)

Exclusive_lock(X)

Write_item(Y)

Unlock(Y)

Write_item(X)

Unlock(X)
c.
T1 T2

Shared_lock(X)

Read_item(X)

Shared_lock(X)

Read_item(X)

Exclusive_lock(Y)

Unlock(X)

Write_item(Y)

Unlock(X)

Exclusive_lock(X)

Write_item(X)

Unlock(Y)

Unlock(X)

d.
T1 T2

Shared_lock(X)

Read_item(X)

Khoa Khoa học & Kỹ thuật Máy tính – Đại học Bách Khoa TP.HCM 2
DBMS – HK1 2024-2025 Exercises – Chapter 6

Shared_lock(X)

Read_item(X)

Exclusive_lock(Y)

Unlock(X)

Write_item(Y)

Unlock(Y)

Write_item(X)

Unlock(X)

2. Consider the schedule shown in the following figure.


Draw the wait-for graph before and after the last action write_lock(A) of transaction T3.

T1 T2 T3 T4

read_lock(A)
read_item(A)
write_lock(B)
write_item(B)
read_lock(B)
read_lock(C)
read_item(C)
write_lock( C)
write_lock(B)

write_lock(A)

3. Consider the set of transactions accessing database element A shown in the following
figure. These transactions are operating under an ordinary timestamp-based scheduler.
Explain why the transaction T3 has to be aborted. What happens if these transactions are
operating under a multiversion timestamp-based scheduler?
(Note: In the figure r means read and w means write.)

Khoa Khoa học & Kỹ thuật Máy tính – Đại học Bách Khoa TP.HCM 3
DBMS – HK1 2024-2025 Exercises – Chapter 6

T1 T2 T3 T4 A

150 200 175 225 RT=0


WT=0

r1(A) RT=150
w1(A) WT=150
r2(A) RT=200
w2(A) WT=200
r3(A)
Abort
r4(A) RT=225

4. Consider the relation Movie(title, year, length, studioName)


Transaction T1 consists of the query:
SELECT * FROM Movie
WHERE title = ‘King Kong’
Transaction T2 consists of the query:
UPDATE Movie SET year = 1939
WHERE title = ‘Gone with the wind’
Assume that there are two records in relation Movie with the title ‘King Kong’ and there is one
record with the title ‘Gone with the wind’.
Suggest the collection of locks for this situation (Multiple Granularity Locking).

Khoa Khoa học & Kỹ thuật Máy tính – Đại học Bách Khoa TP.HCM 4

You might also like