Re: How-to write soft real-time programs Kernel-2.6.x

From: Chris Friesen
Date: Fri Apr 16 2004 - 08:19:05 EST

abhinav singh wrote:

So how-to write a simple program(may be a Hello world
program) which has real-time capabilities.

Something like the following will put you into one of the "realtime" scheduling classes, and you will take priority over the normally scheduled tasks.

struct sched_param p;
if (sched_setscheduler(getpid(), SCHED_RR, &p) < 0) {
perror("error while setting scheduler class");
printf("continuing anyways, but results may not be as good\n");

The whole issue of soft-realtime is a complicated one, and there are many other things that should be done to maximise predictability.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at