Subject: Re: Real time scheduling
To: Brett Lymn <blymn@awadi.com.au>
From: Eduardo E. Horvath <eeh@one-o.com>
List: tech-kern
Date: 02/28/1997 11:29:57
On Fri, 28 Feb 1997, Brett Lymn wrote:

> According to Erik E. Fair:
> >
> >At 21:39 -0800 2/27/97, HARAWAT.IN.ORACLE.COM wrote:
> >>	Has anyone tried to implement Real time scheduling ( of SVr4 ) into
> >>NetBsd.
> >
> >What API & service elements for Real Time scheduling did SVr4 provide?
> >

There's the entire POSIX realtime API that has the prioctl stuff
as well as realtime timers, realtime signals, nanosleeps, realtime
priorities, etc.

> 
> From what I can see on the Solaris 2 boxes at work - not a lot in
> terms of API.  A couple of calls that allow a process to manipulate
> it's own priority (priocntl) and manipulate the priority on a set of
> running processes (priocntlset).  There also a kernel table you can
> change (needs to be compiled and loaded into the kernel on Sol 2) that
> affects the scheduling priorities.  That is about it from the quick
> look I had.

Solaris is *not* SVR4.  Solaris has a fully pre-emptable multi-threaded
kernel (one of the reasons it's so slow).  SVR4 has pre-emption points.
The scheduler (what a piece of %$#%) is the same and results in the 
timeshare class having semi-random scheduling behavior.  

> Most of the hard work on this one, I suspect, is making the scheduler
> pay attention to the new priority classes and ensure that RT processes
> are not preempted when they are running

Most of the work is a complete re-write of the kernel so kernel threads
can be pre-empted.  SVR4 will run the scheduler at well defined places
in the kernel.  Solaris will run the scheduler on every event that can
possibly cause a re-schedule:  interrupts, lock release, etc.

To do this properly, all the spl() calls used to protect critical sections
of code will need to be re-written using locking primitives.  You then
need to add support for deadlock detection and prevention.  It would be
easier to throw the old kernel away and start the whole thing from
scratch.

=========================================================================
Eduardo Horvath				eeh@btr.com
"Cliffs are for climbing.  That's why God invented grappling hooks."
					- Benton Frasier