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/
This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:27 EST