Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)

From: Howard Chu
Date: Thu Jan 26 2006 - 10:22:38 EST


Nick Piggin wrote:
Howard Chu wrote:
scheduling policy at all, the expectation is that the current thread will not continue to run unless there are no other runnable threads in the same process. The other important point here is that the yielding thread is only cooperating with other threads in its process. The 2.6

No I don't think so. POSIX 1.b where sched_yield is defined are the
realtime extensions, are they not?

sched_yield explicitly makes reference to the realtime priority system
of thread lists does it not? It is pretty clear that it is used for
realtime processes to deterministically give up their timeslices to
others of the same priority level.

The fact that sched_yield came originally from the realtime extensions is just a historical artifact. There was a pthread_yield() function specifically for threads and it was merged with sched_yield(). Today sched_yield() is a core part of the basic Threads specification, independent of the realtime extensions. The fact that it is defined solely in the language of the realtime priorities is an obvious flaw in the spec, since the function itself exists independently of realtime priorities. The objection I raised with the Open Group specifically addresses this flaw.

Linux's SCHED_OTHER behaviour is arguably the best interpretation,
considering SCHED_OTHER is defined to have a single priority level.

It appears that you just read the spec and blindly followed it without thinking about what it really said and failed to say. The best interpretation would come from saying "hey, this spec is only defined for realtime behavior, WTF is it supposed to do for the default non-realtime case?" and getting a clear definition in the spec.

--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc
OpenLDAP Core Team http://www.openldap.org/project/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/