Re: [patch] O(1) scheduler, -D1, 2.5.2-pre9, 2.4.17

Mark Hahn (hahn@physics.mcmaster.ca)
Wed, 9 Jan 2002 17:34:09 -0500 (EST)


> no wonder, it should be 'nice -n -20 vmstat -n 1'. And you should also do

I keep a suid setrealtime wrapper around (UNSAFE!) for this kind of use:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sched.h>

int main(int argc, char *argv[]) {
static struct sched_param sched_parms;
int pid, wrapper=0;

if (argc <= 1)
return 1;

pid = atoi(argv[1]);

if (!pid || argc != 2) {
wrapper = 1;
pid = getpid();
}

sched_parms.sched_priority = sched_get_priority_min(SCHED_FIFO);
if (sched_setscheduler(pid, SCHED_FIFO, &sched_parms) == -1) {
perror("cannot set realtime scheduling policy");
return 1;
}
if (wrapper) {
setuid(getuid());
execvp(argv[1],&argv[1]);
perror("exec failed");
return 1;
}
return 0;
}

regards, mark hahn.

-
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/