[lkml]   [2006]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRE: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)

    > > So you cannot write an application that can tell the difference.

    > Not true. The code for the relinquishing thread could indeed
    > tell the difference.
    > -ml

    It can tell the difference between the other thread getting the mutex first
    and it getting the mutex first. But it cannot tell the difference between an
    implementation that puts random sleeps before calls to 'pthread_mutex_lock'
    and an implementation that has the allegedly non-compliant behavior. That
    makes the behavior compliant under the 'as-if' rule.

    If you don't believe me, try to write a program that prints 'non-compliant'
    on a system that has the alleged non-compliance but is guaranteed not to do
    so on any compliant system. It cannot be done.

    In order to claim the alleged compliance, you would have to know that a
    thread waiting for a mutex did not get it. But there is no possible way you
    can know that another thread is waiting for the mutex (as opposed to being
    about to wait for it). So you can never detect the claimed non-compliance,
    so it's not non-compliance.

    This is definitive, really. It 100% refutes the claim.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-01-26 04:33    [W:0.021 / U:1.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site