Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: A quota based lock Date: Mon, 08 Aug 2011 09:48:35 -0700 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: <83f81158-8aee-486d-a51b-c0f7dfdbb0da@h25g2000prf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 8 Aug 2011 16:48:15 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="mz/LDSJwiWnk3Jnnqg7x+Q"; logging-data="20426"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JAcGeZjghsjcjirZBxKym" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: Cancel-Lock: sha1:CGAIPDk5Xj8VEd0GQWHAsFsG03E= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6869 On 8/8/2011 4:58 AM, Eric Sosman wrote: > Failing that, I'd suggest keeping things as simple as possible. > Start with an ordinary queue, with each worker joining the end of > the queue when it wants the resource and then getting the resource > when it reaches the front. If Worker A holds the resource (and > eventually releases it), all the other workers will get a crack at > it (if they want it) before A gets it again. Don't mess around with > quotas or priorities or whatnot until and unless the simple solution > is found wanting. I like that idea with a twist, have the higher priority jobs get put in the queue closer to the top. -- Knute Johnson