Re: PROBLEM: The round robin scheduling policy doesn't work

From: Julian Anastasov (ja@ssi.bg)
Date: Tue Aug 21 2001 - 20:32:57 EST


        Hello,

lucho wrote:

> The round robin scheduling policy does not work.

        Yes, I tested it too and I see the same problems on UP and
on 2.2.19. But your example is wrong, see the appended one. In your
example the processes can block. May be this is the reason Richard to
generate different results. In the below example the child terminates
after the parent and is not scheduled for 2 seconds. I tested it with
more childs too but the showed is with one child. The scheduler looks
broken for SCHED_RR.

        For the kernel gurus: may be this is off-topic but isn't
possible the SCHED_FIFO semantic (schedule after process block) to
be implemented for these thread groups in 2.4. This will allow threads
that run in one group to use the SCHED_FIFO scheduling in their group but
not to block the other SCHED_OTHER processes. This will allow the
threads implementations to use something like spinlocks plus something
like postwait calls and will avoid the signal notifications that I see in
some of them. Why this semantic is allowed only for the real time
processes which usually block the normal SCHED_OTHER processes. I know
that the standards talk about scheduling contention scopes and two-level
scheduling models but it sounds too complex as a change. Is there
something working-in-progress for Linux that will allow such sched_fifo
semantics for normal non-realtime threads? How these thread groups
will be extended?

Regards

--
Julian Anastasov <ja@ssi.bg>

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

int child=0;

void sig (int a) { time_t t;

time(&t); printf("%s terminated - %ld\n", child? "child" : "parent", t); exit(1); }

int main() { struct sched_param sp;

printf("Start: %ld\n", time(0)); fflush(stdout); signal(SIGALRM, sig); sp.sched_priority = 1; sched_setscheduler(0, SCHED_RR, &sp);

if (fork() == 0) { child = 1; sig(0); } else { alarm(2); while(1) { sched_yield(); } }

return 0; }

- 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:46 EST