[SOURCE] RT monitor (Was: Re: Problem with the O(1) scheduler in 2.4.19)

From: Roger Larsson (roger.larsson@skelleftea.mail.telia.com)
Date: Tue Sep 03 2002 - 19:34:46 EST


On Tuesday 03 September 2002 14.23, Tobias Ringstrom wrote:
> I see three simple ways to solve the problem without changing the
> scheduler. Either run the process with nice -20, use SCHED_RR, or use a
> dedicated server with no other processes (such as crond, httpd, etc).
> The first two might be OK, but you need root privilegies to run renice and
> to change the scheduler policy. The third one is not an option for all
> users, and definately not for the video playback case.
>

Here comes some code that works as a RT requester/monitor and
an small utility to try it out.

With this monitor any process can request RT priorities.
If those (or other) processes overloads the system,
all will be returned to normal priorities.

Note:
* this code is still experimental. I had a situation where
   a previous monitor reduced its own priority... (rendering it useless)
* It does probably not work on SMP - I have not given that
   much of a thought yet...

compile the source:
        gcc -Wall rt.c -o rt
        gcc -Wall rt_monitor.c -o rt_monitor

then as root:
        mkfifo -m 622 /var/named/rt-request
        ./rt_monitor

start another shell (as a normal user - not root)
to check the function of the monitor (sleeps 3 s then loops,
the monitor should reduce the priority in about 4 seconds)
        ./rt -c

to set RT priority on any process do
(note: this should be quite safe since the monitor does the raising
so it has to be running :-)
        ./rt -p anypid

/RogerL

-- 
Roger Larsson
Skellefteċ
Sweden



- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:19 EST