[Info-vax] counting-lock ?
Jim Duff
spam.this at 127.0.0.1
Thu Oct 22 15:31:30 EDT 2009
Pierre wrote:
> 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.
You might find this to be of interest:
<http://www.eight-cubed.com/examples/framework.php?file=sys_enqw.c>
Cheers,
Jim.
--
www.eight-cubed.com
More information about the Info-vax
mailing list