db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: DERBY-800, lock scheduling issue?
Date Sat, 11 Feb 2006 16:49:34 GMT
> When a thread tries to create a table, it will first get a shared lock 
> on the dictionary (DataDictionaryImpl.startReading).  This is released 
> before it tries to lock the dictionary exclusively.  The way 
> DataDictionaryImpl.startwriting works is that it first checks whether 
> someone is holding a lock on the dictionary. If so, it will sleep for a 
> while a then try again.  This goes on for a while until it gets 
> impatient and actually requests an exclusive lock and enters the lock 
> queue.  In the mean time, a lot more threads have acquired a shared lock 
> and the updating thread will have to wait for all of them to release it. 

This sounds like there is a lock scheduling fairness issue.

Your description makes it sounds like this:
  - One or more transactions get shared locks on a resource
  - A transaction requests an exclusive lock on a resource, and blocks
  - Additional transactions arrive, requesting shared locks, and their
    locks are granted.

It is possible to implement a lock scheduling policy such that those
later locks, even though they are compatible with all currently granted
locks, are not immediately granted, but instead are placed onto the
resource queue behind the pending exclusive request.

Perhaps we should consider whether there is an opportunity to enhance
the locking policies to be more fair to writers?

thanks,

bryan



Mime
View raw message