Re: sched_setscheduler() problem

From: Roger Larsson (roger.larsson@norran.net)
Date: Thu Mar 30 2000 - 16:26:14 EST


I am sorry to say that you wont get soft RT with only rising priority.
Due to some latency problems in the kernel. But you can get it if you
first apply some patches from Ingo Molnar.

    http://www.redhat.com/~mingo/lowlatency-patches/lowlatency-2.2.15-C0

(There are versions for some other kernels too)

With them you could even try to run without SCHED_FIFO or SCHED_RR
a well behaved process/thread not consuming little CPU would get high
normal prio.

All SCHED_FIFO/RR ranges are higher than the highest SCHED_OTHER.

/RogerL

"Portugali, Ellie" wrote:
>
> I am trying to set FIFO scheduling to a few processes I am running, to
> achieve a soft real time performance. I run into 2 problems
> 1. There is no clear distinction/ducumentation of the difference between the
> [-20, 20] priority range used in SCHED_OTHER versus the [1, 99] range in
> SCHED_FIFO or SCHED_RR.
> 2. The call to sched_setscheduler works ONLY in su mode. Is there a way to
> do it from a user mode?
>
> I have attached the simplest example to clarify my point.
>
> ------------------------------
> The Test program
> ------------------------------
> #include <sched.h>
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/time.h>
> #include <sys/resource.h>
>
> int sched_setpriority(pid_t pid, int priority) /* int given_priority)*/
> {
> struct sched_param p;
> int min_pri, range_pri;
>
> p.sched_priority = priority;
>
> return sched_setscheduler(pid, SCHED_FIFO, &p);
> }
>
> int sched_getsched(pid_t pid)
> {
> return sched_getscheduler(pid);
> }
>
> int sched_getpriority(pid_t pid)
> {
> return getpriority(PRIO_PROCESS, pid);
> }
>
> void main ()
> {
> int i, j;
>
> i = sched_getsched(0);
> j = sched_getpriority(0);
>
> printf("My current sched is %d\nMy current pri is %d\n\n", i, j);
>
> i = sched_setpriority(0, j + 10);
>
> printf("The response for sched_setpriority was %d\n\n", i);
>
> i = sched_getsched(0);
> j = sched_getpriority(0);
>
> printf("My new sched is %d\nMy new pri is %d\n\n", i, j);
>
> }
> -----------------
>
> Ellie portugali.
> ==
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

--
Home page:
  http://www.norran.net/nra02596/

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:27 EST