Posts

Image
  AKU UNIVERSITY EXAM QUESTION  2019 Discuss the various approaches for handling the deadlocks in DBMS. Sol: Deadlock occur in concurrent execution of transactions. Below fig shows there are transaction T1 and T2 executing concurrently. So, there is a chance to occur deadlock. Transaction T1 apply exclusive lock on data item B  because T1 performing read and write operation on data item B. After that transaction T2 starts and apply shared lock on data item A because transaction T2 performing read operation on data item A. Now same transaction ask for exclusive lock on data item B but it won't be granted because this item is already locked by transaction T1 but it request and its request is waiting. Here transaction T2 is waiting so transaction T1 will proceed now. Here transaction T1 request  for exclusive lock on data item A which will not be granted because A is already  locked by transaction T1 . Although it is shared locked so we can only grant shared lock but we can grant excl
Image
AKU EXAM 2019 DBMS What is two-phase locking protocol ? Explain its working in detail. How can it guarantee serializability ? Let us first understand What is transaction ? A transaction is an executing program that forms a logical unit of Database Processing. A transaction can include one or more database operation like insertion, deletion, modification or retrieval operation. What is schedule ? A schedule is a list of actions like reading, writing, aborting or committing which form a set of transactions and the order in which two actions of a transaction T appear in a schedule must be the same as the order in which they appear in T. As name indicates read operation means it read data item  For Example, Read operation in schedule represented as R(A) means read operation performed on data item A. Similarly, Write operation can be represented by W(B) means write operation performed on item B. Abort operation in schedule is used to cancel performed operation in schedule. Similarly, commi