Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: A quota based lock Date: Mon, 08 Aug 2011 11:57:30 -0700 Organization: A noiseless patient Spider Lines: 19 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 18:57:37 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="18413"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pGQcb5g6WylGZpnxfCnCZZlVQ2XOZMME=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: Cancel-Lock: sha1:rKBTO3wDYwt/7hPQhXTkybpB9vs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6875 On 8/8/2011 11:39 AM, Knute Johnson wrote: > No priority scheme will ever be truly fair. I'll bet you could get > pretty close without being too complicated. I'll think about it some more. A simple priority system might involve multiple queues, where the high priority queues are serviced X times more than the lower ones. E.g., two queues. Queue A gets 10 jobs executed for each 1 job that queue B gets executed. But because queue B is always guaranteed to be serviced eventually, there is no starvation. This is a simple step up from round-robin service (which is what Eric proposed). There are many algorithms existing. Check out any text on OSs and job scheduling.