Professional Documents
Culture Documents
Group A
1. Attempt all the questions:
1 10
3 5 = 15
3+2
1+1+1+2
5
2+3
1
1
1
1
Group C
Answer any three questions.
3 15 = 45
7. What is concurrency control? What is lock based protocol? Explain. What is validation
based protocol? Write insert and delete operations.
2+3+4+(3+3)
8. (a) Define query graph.
1
(b) Given the following relations and the query:
EMP = (eno, ename, title)
ASG = (eno, pno, responsibility, duration)
PROJ = (pno, pname, budget, loc)
Query: "Find the names and responsibilities of programmers who have been working
on the CAD/CAM project for more than 36 months"
i)
ii)
iii)
1
3
3
1
2+4
9. Write the basic 2 phase commitment protocol, assuming there is no failure. What are
different types of 2PC protocol based on communication paradigm? Explain each of them
briefly.
6+9
10. What is concurrent transaction? Define dirty read, non-repeatable or fuzzy read and
phantom. Explain distributed transaction execution with the help of a diagram.
1+3+3+3+5
11. How data dictionary management is done in distributed environment? What is 2PL
protocol? Briefly explain centralized, distributed and primary copy 2PL protocols. 4+2+9
Answer Key:
Group A Question 1:
i) A
vi) A
ii) C
vii) B
iii) C
viii) C
iv) D
ix) B
v) B
x) B
Group B Question 2:
Relational algebraic query:
name, duedate
Member.memno = Lending.memno bookno = '81-203-1257-0'
Membe
r
Lendin
g
Group B Question 3:
Horizontal fragmentation: Definition - mark & Explanation - mark
Vertical fragmentation: Definition - mark & Explanation - mark
Mixed fragmentation: Definition - mark & Explanation - mark
Derived fragmentation: Definition - 1 mark & Explanation - 1 mark
Group B Question 5:
2PL cannot produce cycles: Without loss of generality, let us assume that the following cycle
exists in the precedence graph: T0 T1 T2 ...Tn1 T0. Let i be the time at which Ti
obtains its last lock (i.e. Tis lock point). Then for all transactions such that Ti Tj , i < j .
Then for the cycle we have
0 < 1 < 2 < ... < n1 < 0
Since 0 < 0 is a contradiction, no such cycle can exist.
Yes, 2PL ensures serializability.
Suppose two-phase locking does not ensure serializability. Then there exists a set of transactions
T0, T1 ... Tn1 which obey 2PL and also produce a non-serializable schedule. A nonserializable schedule implies a cycle in the precedence graph, and we know that 2PL cannot
produce such cycles.
Hence 2PL cannot produce non-serializable schedules. Because of the property that for all
transactions such that Ti Tj , i < j , the lock point ordering of the transactions is also a
topological sort ordering of the precedence graph. Thus transactions can be serialized according
to their lock points.
Group B Question 6:
4
(c) WAIT-DIE rule: If Ti requests a lock on a data item that is already locked by Tj, Ti is
permitted to wait and if only if Ti is older than Tj. If Ti is younger than Tj,
then Ti is aborted and restarted with the same timestamp.
(d) WOUND-WAIT rule: If Ti requests a lock on a data item that is already locked by Tj, Ti is
permitted to wait if and only if it is younger than Tj; otherwise Tj is
aborted and the lock is granted to Ti.
Group C Question 8:
(b) SQL:
SELECT
FROM
WHERE
Ename, Responsibility
EMP, ASG, PROJ
EMP.Eno = ASG. Eno AND
ASG.Pno = PROJ.Pno AND
Pname = 'CAD/CAM' AND
Duration >= 36 AND
Title = 'Programmer'
Query graph:
Dur >= 36
AS
G
EMP.Eno = ASG.Eno
Title = 'Programmer'
ASG.Pno = PROJ.Pno
Resp
EM
P
Ename
Resul
t
PRO
PnameJ = 'CAD/CAM'
Ename
PROJ, ASG, EMP
ASG.Eno = EMP.Eno AND
ASG.Pno = PROJ.Pno AND
Ename != 'J. Doe' AND
PROJ.Pname = 'CAD/CAM AND
(Duration = 12 OR Duration = 24)
Operator tree:
Ename
Dur = 12 Dur = 24
Pname = 'CAD/CAM'
Ename != 'J. Doe'
Pno
Eno
PROJ
ASG
EMP
Pno Eno
ASG
PROJ
EMP
Group C Question 9:
The basic 2 phase commitment protocol (assuming no failure)
Coordinator : Write "prepare" record in the log
Send PREPARE message and activate timeout
Participant
Coordinator : Wait for ANSWER message (READY or ABORT) from all participant or timeout
If timeout expired or at least one answer message is ABORT then
Begin
Write global_abort record in the log
Send ABORT command message to all participants
End
Else // all the sites are READY
Begin
Write global_commit record in the log
Send COMMIT command message to all participants
End
Participant
2nd part
Explain Centralized 2PC, Linear 2PC and Distributed 2PC with diagram.