https://bugs.llvm.org/show_bug.cgi?id=35731

Jonas Hahnfeld <hah...@hahnjo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #19 from Jonas Hahnfeld <hah...@hahnjo.de> ---
(In reply to Jonas Hahnfeld from comment #18)
> I'll have to look up if sched_yield() guarantees you to switch threads [...]

sched_yield() is defined by POSIX [1] and its description says:
> The sched_yield() function shall force the running thread to relinquish the
> processor until it again becomes the head of its thread list.

"Scheduling Policies"[2] explains that there is one ordered thread list per
priority:
> There is, conceptually, one thread list for each priority. A runnable thread
> will be on the thread list for that thread's priority.
This matches the description on the Linux man page[3]:
> sched_yield() causes the calling thread to relinquish the CPU. The thread is
> moved to the end of the queue for its static priority and a new thread gets
> to run.

A thread's priority can be changed with calls to
 - pthread_setschedparam(), pthread_setschedprio()
 - sched_setscheduler(), sched_setparam()
 - apparently also setpriority()
The OpenMP runtime only calls sched_setscheduler() for the monitor thread
(disabled by default), but does not change the priority for the OpenMP worker
threads. I think this means that all OpenMP threads have the same (default)
priority and are therefore in the same thread list.
My conclusion would be that the PDS scheduler and thus any system using it are
not confirming to the POSIX standard. From an upstream perspective I'm closing
this bug as INVALID because there is nothing we can do in the library which
assumes to run on a POSIX system.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html
[2]
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_04_01
[3] http://man7.org/linux/man-pages/man2/sched_yield.2.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to