The Gateway to Computer Science Excellence
0 votes

In Navathe the operations of read/write or shared/exclusive locks are given below....

In the unlock(X) operation...if no.of reads = 0...then lock(X)="unlocked"; and wake up  one of the waiting transactions if any

My question is if it is read lock then why any transaction will wait in a queue? We can have a read lock even if other transaction is holding a read lock on same data item......Please explain

in Databases by Active (3.8k points) | 1.3k views

1 Answer

+1 vote

In read lock we can accept all read item in sheared lock mode. But in that time if any write item come it cannot accept in shared mode. So, it have to wait till the last read item exits and then it access the data in exclusive lock mode

So, we can say read item is shared mode when it is read item only , but for write item it have to wait for getting exclusive lock

by Veteran (119k points)
I got it....but in the unlock(X) operation...when LOCK(X)="unlocked" then it is saying to wake up a transaction.....but how to understand that from which queue we have to wake up? read_lock(X) queue or write_lock(X) queue?

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,397 answers
105,452 users