Que5.2. What’s cinch? Explain different types of cinches. OR Describe cinch grounded locking ways. Answer Cinch A cinch is a variable associated with each data item that indicates whether read or write operation is applied. Different types of cinches are 1. double cinch i. A double cinch can be two countries or values locked and uncorked( or 1 and 0). ii. A distinct cinch is associated with each database itemX. , item X can not be penetrated by a If the value of the cinch on X is 1. database operation that requests the item. , the item can be penetrated when If the value of the cinch on X is 0. requested. v. We relate to the current value( or state) of the cinch associated with item X as cinch( X). vi. Two operations,lock_item andunlock_item, are used with double locking. still, every sale If the simple double locking scheme is used. must observe the following rules i. A sale T must issue the operationlock_item( X) before any ( X) orwrite_item( X) operations are performed inT. ii. A sale T must issue the operationunlock_item( X) after all ( X) andwrite_item( X) operations are completed inT. iii. A sale T won’t issue alock_item( X) operation if it formerly holds the cinch on itemX. iv. A sale T won’t issue anunlock_item( X) operation unless it formerly holds the cinch on itemX. 2. Shared/ Exclusive locks i. In this scheme there are three locking operationsread_lock( X), ( X), and unlock( X). ii. A cinch associated with an item X, cinch( X), has three possible countries read- locked, write- locked and uncorked. iii. A read- locked item is also called share- locked because other deals are allowed to read the item, whereas a write- locked item is called exclusive- locked because a single sale simply holds the cinch on the item. still, every sale If the participated/ exclusive locking scheme is used. must observe the following rules i. A sale T must issues the operationread_lock( X) or ( X) before anyread_item( X) operation is performed in ii. A sale T must issue the operationwrite_lock( X) before any ( X) operation is performed inT. iii. A sale T must issue the operation unlock( X) after all ( X) andwrite_item( X) operations are completed inT. iv. A sale T won’t issue aread_lock( X) operation if it formerly holds a read( participated) cinch or a write( exclusive) cinch on itemX. v. A sale T won’t issue awrite_lock( X) operation if it formerly holds a read( participated) cinch or write( exclusive) cinch on itemX. vi. A sale T won’t issue an unlock( X) operation unless it formerly holds a read( participated) cinch or a write( exclusive) cinch on itemX. Que5.3. What do you understand by cinch comity? Explain with illustration. Answer 1. Cinch comity determines whether cinches can be acquired on a data item by multiple deals at the same time. 2. Suppose a sale Ti requests a cinch of mode m1 on a data item Q on which another sale Tj presently holds a cinch of mode m2. 3. still, the request is incontinently If mode m2 is compatible with mode m1. granted, else rejected. 4. The cinch comity can be represented by a matrix called the comity matrix. 5. The term “ YES ” indicates that the request can be granted and “ NO ” indicates that the request can not be granted. Que5.4. How is locking enforced? How are requests to lock and unleash a data item handled? Answer perpetration of locking 1. The locking or unlocking of data particulars is enforced by a subsystem of the database system known as the cinch director. 2. It receives the cinch requests from deals and replies them with a cinch entitlement communication or rollback communication( in case of impasse). 3. In response to an unlock request, the cinch director only replies with an acknowledgement. In addition, it may affect in cinch entitlement dispatches to other staying deals. The cinch director handles the requests by the sale to lock and unleash a data item in the following way 1. Cinch request a. When a first request to lock a data item arrives, the cinch director creates a new linked list to record the cinch request for the data item. b. It incontinently grants the cinch request of the sale. , it includes the If the linked list for the data item formerly exists. request at the end of the linked list. d. The cinch request will be granted only if the cinch request is compatible with all the being cinches and no other sale is staying for acquiring cinch on this data item else, the sale has to stay. 2. unleash request a. When an unlock request for the data particulars arrives, the cinch director deletes the record corresponding to that sale from the linked list for the data item. b. It also checks whether other staying requests on that data item can be granted. , it’s granted by the cinch director, and If the request can be granted. the coming record, if any, is reused. , the cinch director deletes all staying cinch If a sale aborts. requests by the sale. e. In addition, the cinch director releases all cinches acquired by the sale and updates the records in the cinch table. Que5.5. Describe how a typical cinch director is enforced. Why must lock and unlock be infinitesimal operations? What’s the difference between a cinch and a latch? What are convoys and how should a cinch director handle them? Answer perpetration of cinch director 1. A typical cinch director is enforced with a hash table, also called cinch table, with the data expostulate identifier as the key. 2. A cinch table entry contains the following information a. The number of deals presently holding a cinch on the object. b. The nature of the cinch. c. A pointer to a line of cinch requests. Reason for cinch and unlock being infinitesimal operations Cinch and unlock must be infinitesimal operations because it may be possible for two deals to gain an exclusive cinch on the same object, thereby destroying the principles of 2PL. Convoy 1. Convoy is a line of staying deals. 2. It occurs when a sale holding a heavily used cinch is suspended by the operating system, and every other sale that needs this cinch is queued. Cinch director handle convoy by allowing a sale to acquire cinch only formerly. Que5.6. Write short notes on cinch grounded protocols. Answer 1. Cinch grounded protocol indicates when a sale may lock and unleash the data particulars, during the concurrent prosecution. It restricts the number of possible schedules. 2. It ensures that the data particulars must be penetrated in collective exclusive manner and for this we use different cinch modes. 3. There are two modes in which a data item may be locked Shared mode cinch If a sale Ti has attained a participated mode cinch on item Q also Ti can read but can not write Q. It is denoted byS. ii. Exclusive cinch If a sale Ti has attained an exclusive mode cinch on item Q also Ti can read and also writeQ. It’s denoted byX. Que5.7. Explain two- phase locking fashion for concurrency control. OR What’s two- phase locking( 2PL)? Describe with the help of illustration. OR Explain two phase locking protocol with suitable illustration. Answer 1. Two- phase locking is a procedure in which a sale is said to follow the two- phase locking protocol if all locking operations antecede the first unlock operation in the sale. 2. In 2PL, each sale cinch and unlock the data item in two phases Growing phase In the growing phase, the sale acquires cinches on the asked data particulars. Shrinking phase In the shrinking phase, the sale releases the cinches acquired by the data particulars. 3. According to 2PL, the sale can not acquire a new cinch, after it has uncorked any of its being locked particulars. 4. Given below, the two deals T1 and T2 that don’t follow the two- phase locking protocol. Que5.8. bandy strict 2PL. Answer 1. Slinging rollbacks can be avoided by a revision of two- phase locking called the strict two- phase locking protocol. 2. This protocol requires not only that locking be two phase, but also that all exclusive- mode cinches taken by a sale be held until that sale commits. 3. This demand ensures that any data written by an unattached sale are locked in exclusive mode until the sale commits, precluding any other sale from reading the data. 4. Strict two- phase is the most extensively used locking protocol in concurrency control. This protocol has two rules , it first requests If a sale T wants to read( modify) an object. a participated( exclusive) cinch on the object. b. All cinches held by a sale are released when the sale is completed. 5. still, cinches held by If strict two- phase locking is used for concurrency control. a sale T may be released only after the sale has been rolledback. 6. Once sale T( that is being rolledback) has streamlined a data item, no other sale could have streamlined the same data item, because of the concurrency control conditions. 7. thus, restoring the old value of the data item won’t abolish the goods of any other sale.