SCHED_RR

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue Aug 21 2001 - 14:48:52 EST


To whomever said that sched RR doesn't work, I added some diagnostics
to your code and it seems to work okay with linux 2.4.1.

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

int main()
{
    struct sched_param sp;
    int ch, pr;
    ch = pr = 0;
    memset(&sp, 0x00, sizeof(sp));
    sp.sched_priority = 1;
    sched_setscheduler(0, SCHED_RR, &sp);

    if(fork() == 0) {
        while(1) {
            ch++;
            printf(" child %d\n", ch);
            sched_yield();
        }
    }
    else {
        while(1) {
            pr++;
            printf("parent %d\n", pr);
            sched_yield();
        }
    }
    return 0;
}

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.

-
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 : Thu Aug 23 2001 - 21:00:45 EST