[Info-vax] counting-lock ?
H Vlems
hvlems at freenet.de
Thu Oct 22 11:36:47 EDT 2009
On 22 okt, 14:33, Pierre <pierre.... at gmail.com> 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.
Pierre, my memory is weak but ISTR that a decnet object (at least with
NCP) uses a DCL file to make it happen. Example, if you request a
directory listing on a remote node, FAL is used and FAL.COM is the
command procedure that gets executed. If your object works the same
way you can define a logical name to control the number of instances,
or use a file to store counters.
Hans
More information about the Info-vax
mailing list