[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] thread switching problem (SCHED_RR)



Hi,
I noticed the timeslice mechanism of SCHED_RR doesn't work correctly
together with poll_wait().
I currently use uclinux_dist&kernel CVS snapshot of October 2005 but exactly
the same problem is with an older version of December 2004 that I've used
before.

situation:
I use the thread scheduler with SCHED_RR, 3 threads are running in my app
started from /usr/bin.
Thread 1 has priority 9, thread 2 and 3 have priority 8 (but thread 3 is
inactive and sleeping on a semaphore)
Thread 1 sleeps on poll() with a timeout of 100ms. Function poll() is a call
to a ucLinux driver which calls the kernel function poll_wait(fd, waitqueue,
timeout). Thread 2 (with the lower priority) is running and is heavily
calculating some stuff.

problem:
Linux doesn't switch to thread 1 in time after 100ms, thread 2 is still
working even after 300ms. This shouldn't happen since thread 1 has the
higher priority. When thread 2 finishes before 100ms are over, thread 1
returns from poll_wait() in time.
It seems to me it's a bug in the ucLinux kernel that the timeout of
poll_wait() doesn't expire after the set 100ms. The scheduler should switch
from thread 2 to 1 and wakes up poll_wait() in time. Am I right? Has anybody
seen that too? Please, can anybody help? What can I do as a workaround?

Cheers
F@lk
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/