From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610AbXDNX0H (ORCPT ); Sat, 14 Apr 2007 19:26:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751623AbXDNX0H (ORCPT ); Sat, 14 Apr 2007 19:26:07 -0400 Received: from x35.xmailserver.org ([64.71.152.41]:4682 "EHLO x35.xmailserver.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbXDNX0F (ORCPT ); Sat, 14 Apr 2007 19:26:05 -0400 X-AuthUser: davidel@xmailserver.org Date: Sat, 14 Apr 2007 16:26:04 -0700 (PDT) From: Davide Libenzi X-X-Sender: davide@alien.or.mcafeemobile.com To: William Lee Irwin III cc: Ingo Molnar , Linux Kernel Mailing List , Linus Torvalds , Andrew Morton , Con Kolivas , Nick Piggin , Mike Galbraith , Arjan van de Ven , Thomas Gleixner Subject: Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] In-Reply-To: Message-ID: References: <20070413202100.GA9957@elte.hu> <20070413222151.GD8915@holomorphy.com> X-GPG-FINGRPRINT: CFAE 5BEE FD36 F65E E640 56FE 0974 BF23 270F 474E X-GPG-PUBLIC_KEY: http://www.xmailserver.org/davidel.asc MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 14 Apr 2007, Davide Libenzi wrote: > Haven't looked at the scheduler code yet, but for a similar problem I use > a time ring. The ring has Ns (2 power is better) slots (where tasks are > queued - in my case they were som sort of timers), and it has a current > base index (Ib), a current base time (Tb) and a time granularity (Tg). It > also has a bitmap with bits telling you which slots contains queued tasks. > An item (task) that has to be scheduled at time T, will be queued in the slot: > > S = Ib + min((T - Tb) / Tg, Ns - 1); ... mod Ns, of course ;) - Davide