Subject: Re: Scheduling Threads With Differing Priorities
To: Matt Thomas <matt@3am-software.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 10/09/2003 14:28:49
Matt Thomas <matt@3am-software.com> writes:

> Now that NetBSD has a (mostly) working pthreads implementation, one
> of the things needed to make it complete is the ability to schedule
> individual threads at independent priorities.  Because NetBSD's
> pthread is a n:m scheduler, this is a non trivial amount of work.
> 
> Some issues to think about:
> 
>      if you have two threads at different priorities, do you give a
>      priority boost when delivering SA upcalls?
>
>      Do you keep a lwp per priority (at a minimum)?
>
>      Do we add kernel support for SCHED_* types?

Remember that the SA model doesn't timeslice LWPs, and doesn't bind
threads to LWPs for any particular duration. There should be no need
for more LWPs to support more priorities, and SA upcalls don't need a
priority boost because nothing competes with them (within a process).

The place where kernel support may be necessary is for "system
contention scope" threads, where you want to make a particular thread
in a process have a priority relative to other processes, not just
other threads in the same process.

        - Nathan