cvs commit: src/sys/kern sched_4bsd.c

Bruce Evans bde at zeta.org.au
Sun Feb 1 18:35:59 PST 2004


On Sun, 1 Feb 2004, Jeff Roberson wrote:

> On Sun, 1 Feb 2004, Bruce Evans wrote:
>
> > On Sat, 31 Jan 2004, Don Lewis wrote:
> >
> > > On 31 Jan, Jeff Roberson wrote:
> > > > jeff        2004/01/31 18:46:47 PST
> > > >
> > > >   FreeBSD src repository
> > > >
> > > >   Modified files:
> > > >     sys/kern             sched_4bsd.c
> > > >   Log:
> > > >    - Keep a variable 'sched_tdcnt' that is used for the local implementation
> > > >      of sched_load().  This variable tracks the number of running and runnable
> > > >      non ithd threads.  This removes the need to traverse the proc table and
> > > >      discover how many threads are runnable.
> >
> > Traversing the run queues in sched_load() every 5 seconds might be more
> > efficient than maintaing the count.
>
> It might be cheaper, but it is less scalable.

Er, I want it because it is similarly scalable and probably cheaper on all
scales.  Maintaining the count is O(n) in the number of run queue
operations, while traversing the run queues is O(n) in the total length
of the queues.  The total length of the queues (divided by the number of
CPUs) should be much smaller than the number of run queue operations (else
the machine is overloaded).  Traversing the queues is O(n) in the number
of CPUs, but that doesn't matter since if there are enough CPUs for it to
take very long then there are enough CPUs to spare one for long enough to
run it.

Bruce


More information about the cvs-src mailing list