Shachar Shemesh wrote:
Hi all,

In principle, a mutex needs to satisfy two conditions:
1. It should never ever ever allow two threads/processes in
simultaneously (exclusion)
2. A blocked process/thread should know that, sooner or later, and
assuming that other threads are occasionally releasing the threads, it
will be allowed in (fairness).

If condition number 1 is not met, we will say that the mutex is
non-exclusive (read - horrendously broken).
If condition number 2 is not met, we will say that the mutex does not
prevent starvation.

and why do we really care about fairness here?

I have circumstantial evidence that pthread_mutex_lock on 2.6.18, at
least on a single CPU machine, does not prevent starvation.

lets assume this is correct. why does it matter?

if your program relies on "fairness" with mutexes - your program should be re-designed. mutexes were not meant for such 'fairness' - they were meant for mutual exclusion.

do you have a case where this breaks your code?

--guy


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to