[Info-vax] counting-lock ?
Pierre
pierre.bru at gmail.com
Thu Oct 22 08:33:02 EDT 2009
hi,
I have a DECnet object which can serve various known queries on a
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...
I then thought of using counting-semaphores but the problem with
semaphores is that if the server process unexpectedly die before
signaling the its done with the resource, the slot it was using is
never freed.
as unfortunately the DLM does not have "counting-locks" I had the idea
of creating a null lock for every possible query type and as many
exclusive sub-lock as needed, one for every possible instance of that
particular query. for each new request of that type, the newly created
object instance enqueue one exclusive lock on every sub-lock. as soon
as one is granted, it first dequeue the unneeded ones and starts its
job.
do you see any flow in this algorithm ? do you see any other way of
doing it ?
TIA,
Pierre.
More information about the Info-vax
mailing list