lkml.org 
[lkml]   [2001]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSCHED_RR

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/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:2.294 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site