Thanks Ted. The randomization should work well in this case.
On 23 February 2010 18:27, Ted Dunning <ted.dunn...@gmail.com> wrote:
> I think that the crux of Mahadev's suggestion is that you do as you say,
> you should try the resources in randomized order.
> That will have very robust properties, especially with more than a handful
> of resources and is easy to code and to analyze.
> It won't work if you really mean "lock first available from this sequence".
> On Tue, Feb 23, 2010 at 4:05 AM, Martin Waite <waite....@googlemail.com
> > For locking, I could loop through
> > the available ids, attempting to create a lock for that in the locked
> > directory. However this seems a bit clumsy and slow. Also, the locks
> > held for a relatively short time (1 second on average), and by time I
> > blundered through all the possible locks, ids that were locked at the
> > might be available by time I finished.
> Ted Dunning, CTO