[Info-vax] counting-lock ?

Peter Weaver info-vax at weaverconsulting.ca
Thu Oct 22 15:02:46 EDT 2009


>...
> database. these queries are resource consuming and I don't want more
> than (say) n=5 of them of the same type to run at the same time. I
> want the other one to be queued up for further processing.
> 
> I first thought of using the lock manager. this would have work with
> an exclusive lock for n=1 but n>1...
>...

Let me prefix this by saying that I never tried this but many, many years
ago I heard of this technique from someone who was rather proud of what he
did.
 
What I recall him saying is that he has X number of locks. Each new process
tries to get lock 1, if it fails then it tries lock 2, if it fails then it
tries lock 3, etc. When the process gets to X then it loops around to the
first lock and walks the locks again. The problem with this is if you have 3
processes walking through the locks and one process releases the lock you
have no way to make sure that the oldest waiting process gets the just
released lock. In other words, if process A was waiting 5 minutes for a
lock, process B was waiting 3 minutes and process C was just created it is
possible that process C will be the first one to grab the lock that was just
released.


Peter Weaver
www.weaverconsulting.ca
Winner of the OpenVMS.org Readers' Choice Award for System
Management/Performance
http://www.linkedin.com/in/peterweaver






More information about the Info-vax mailing list