On Wed, Mar 13, 2013 at 9:40 AM, ishare <june.tune.sea@xxxxxxxxx> wrote:
On Tue, Mar 12, 2013 at 06:18:02PM +0530, Prabhu nath wrote:> *mutex* is used to serialize access to a shared resource among competing
> I guess we should not mix mutex and condition variable. Both have their own
> respective semantics.
> threads.
> *condition variable* is used to notify a* state change* of a resource to
> the interested thread.After pthread_mutex_unlock() is called , the mutex is release , then ,which stuff
>
> In case of condition variable there is provision to explicitly notify a
> single thread(pthread_cond_signal) or all the threads waiting on a
> condition (or a state change) (pthread_cond_broadcast)
>
> Question was on pthread_mutex_unlock() that whether this function
> invocation will trigger the movement of all the threads in the wait queue
> to the ready queue.
will reshcedule the threads in the waitqueue ?
If do pthread_cond_signal() after each pthread_mutex_unlock() ,does it raise up the performence ?
thanks!
I think you are missing something in your understanding. Please refer "Programming with POSIX threads" - David R. Butenhof
> If all the threads are of equal priority, then the first thread waiting for
> the lock will be put to READY queue.
> If there are variable priority threads waiting for the lock, then the
> thread with highest priority would be woken up
--
Regards,
Prabhunath G
Linux Trainer
Bangalore
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies