Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 2003 09:15:13 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Jeff Roberson <jroberson@chesapeake.net>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: Patches for threads/scheduler abstraction.
Message-ID:  <3E9ED311.1BC9610D@mindspring.com>
References:  <20030417042350.X76635-100000@mail.chesapeake.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Jeff Roberson wrote:
> On Wed, 16 Apr 2003, Julian Elischer wrote:
> > For a start the simple one would be queueing threads on the run queues.
> > A system compiled with that scheduelr would have no KSEs anywhere
> > in the entire kernel.
> > The kse one would be queueing KSEs. I don't see how you can do this
> > with a shared file.
> 
> You're missing the point.  The scheduler shouldn't be tied to the
> threading implementation.

I think you will lose CPU affinity and negaffinity, if you do this.

I agree that the scheduler shouldn't know about threads, but it
has to know about scheduling entities, given that it's, well, a
scheduler, after all.

Right now, there are too many locks taken in the scheduler path,
as it is, and I don't see how concurrency will be improved by
doing what you suggest.

There is also no clustering support -- for migration of a process
from one node to another -- something that can't be done with a
scheduler that snoops shared memory, since the memory in question
isn't shared.

> This way you will not duplicate code and you will keep the two tasks
> independant.  Essentially the sched_*.c files decide system scope
> contention while the threading implementation determines the process scope
> contention which may include some concurrency limits imposed by KSE or
> some other structure.
> 
> Do you see?  This way we could get KSEs out of the entire kernel other
> than kern_kse.c and still support them with the sched_4bsd and sched_ule
> scheduler.  Otherwise we're going to have a copy of each scheduler for
> each threading implementation and we wont be able to support two threading
> implementations simultaneously.

I think this is premature optimization; you're complaining about
a multiplicy problem, but the most glaringly obvious multiplicy
problem in the scheduling context is the fact that the 4BSD and
ULE schedulers can't coexist in the same kernel.  I know ULE is
your baby, but what is needed is a cleaner abstraction than you
are currently suggesting.

I think if you go forward with a half-abstraction, which is going
to end up setting in concrete the non-coexistance of schedulers,
that it would be just as big a mistake as not doing the part that
you are talking about.

If you want to rename the terminology, you should go ahead and
rename it.  Mach calls the container abstraction for a process
for a scheduler a "task".  If you want to call it that instead
of "KSE" (or "KSEGRP", which I personally don't like), then go
ahead -- BUT there needs to be some type of container, and it
needs to be common to all scheduler implementations, or a given
implementation won't be able to provide CPU affinity and negaffinity
for all the objects in the container class.


> > Anyhow, the following hack (totaly unoptimised.... notice the
> 
> I think this describes the whole project so far.

8-) 8-).

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E9ED311.1BC9610D>