Le 24/07/2016 22:31, Rainer Weikusat a écrit :
> Didier Kryn <kryn@???> writes:
>> Le 22/07/2016 18:21, Brian Nash a écrit :
>>> For example, when I discovered multithreading, all my programs used it
>>> in some way, even when it was unnecessary.
>> I sometimes use multithreading, but never mutexes. Mutex can be
>> harmless if there's only one. Otherwise better use select()/poll() or
>> you'll waste time or even dead-lock. It's amazing how the old select()
>> paradigm is so much better than the modern mutex. I see mutex as an
>> invention to relieve the programmer from thinking.
> One of the advantages of having more than one thread of execution
> running in the same address space is that these can communicate with
> each other without going through the kernel. And 'a mutex' is just a
> basic primitive for implementing this.
>
I thought mutexes were implementing through a kernel object known
as futex. Certainly optimised for speed, I agree. But the gain is
significant only if you use it intensively, which might denote a badly
written program, and you soon incur the risk of loosing a huge amount of
time as soon as a thread contains more than one of those.
Didier