Shachar Shemesh wrote:
Gilad Ben-Yossef wrote:
I think the real program is that the test program was meanigless to
begin with. The situation it creates is equel to a single threaded
for() loop - zero parralelism outside the critical section.
Ok, here's the important question, then.
Supposing the program did a 0.1 second sleep inside the mutex, and a 0.9
sleep outside. Now suppose that we have more than 10 threads (i.e. - we
are still fighting over a shared resource of which we have too little).
Let's say we have 30 threads. Under these conditions, is the mutex fair?
As far as I udnerstand, if you sleep between mutex unlock and lock (not a tight
loop),
the fairness should be depedant on the task scheduler. The mutex is then as fair as the scheduler is fair. Whether the
Linux scheduler is fair or not is a completly different question :-)
But yes, I'd expact it to work as you want it to work in that case. Does it?
Gilad
--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
http://www.codefidence.com
Phone: +972.3.7515563 ext. 201 | Cellular: +972.52.8260388
SIP: [EMAIL PROTECTED] | Fax: +972.3.7515503
Lacking fins or tail
the gefilte fish swims with
great difficulty.
-- A Jewish Haiku
=================================================================
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]