This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
newbie: threads and sched_yield ?
- From: Mark Hounschell <dmarkh at cfl dot rr dot com>
- To: GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Sat, 19 Mar 2005 09:48:42 -0500
- Subject: newbie: threads and sched_yield ?
- Reply-to: dmarkh at cfl dot rr dot com
I have a threaded application that uses process affinity and real-time
priorities (SCHED_FIFO). Each of my thread-groups run at a unique
real-time priority. Thread groups are dispersed over the available
processors. To my question/problem. When any of my threads, even the one
running at the lowest priority, gets into a loop like
while (!something)
sched_yield();
The whole machine freezes. When running a 2.6 kernel and NPTL I can
replace the sched_yield with a very short pthread_cond_timedwait and all
is fine, but on a 2.4 kernel using LinuxThreads this does not help. It
appears that sched_yield used in a thread nor pthread_cond_timedwat do
what I would expect it to do while running a 2.4 kernel and
LinuxThreads. On my alpha ES45 I can use pthread_yield here and all is
fine. There does not appear to be a pthread_yield for Linux. What is the
proper way to do this on a 2.4 kernel using LinuxThreads? Surely
sched_yield is not broken?
Also, when no process affinity or real-time scheduling is used this
problem does not show its self at all.
I am already using most all the pthread calls and this part of the code
is not where I can use any of the normal sleep/wakeup methods used
elsewhere in my threads.
Thanks for any suggestions.
Regards
Mark