NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthreads condition variables



On Thu, Nov 19, 2009 at 11:28:50AM +0000, raymond.meyer%rambler.ru@localhost 
wrote:
> However when you pass 'lock_mutex' set to 0, then when the thread wakes
> up, the mutex will be UNLOCKED. The rationale for this is to avoid the
> 'thundering herd' problem and to wake up as many threads in parallel as
> possible.

I'm sorry but this is just incorrect paralisation of an application:
1.) Either all the worker threads are the same in which case you
    only need to wake up one of them.
2.) If they are not the same (like in your model) they should have
    seperate locks and condition variables. Otherwise you will only
    slow down the application because all worker threads have to
    wait for all partitions to be created. With locks per partition
    or no fixed relation between worker threads and partitions
    you can start them independently.

        Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/


Home | Main Index | Thread Index | Old Index