<br><br><div class="gmail_quote">On Wed, Mar 13, 2013 at 9:40 AM, ishare <span dir="ltr"><<a href="mailto:june.tune.sea@gmail.com" target="_blank">june.tune.sea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">On Tue, Mar 12, 2013 at 06:18:02PM +0530, Prabhu nath wrote:<br>
> I guess we should not mix mutex and condition variable. Both have their own<br>
> respective semantics.<br>
</div>> *mutex* is used to serialize access to a shared resource among competing<br>
> threads.<br>
> *condition variable* is used to notify a* state change* of a resource to<br>
<div class="im">> the interested thread.<br>
><br>
> In case of condition variable there is provision to explicitly notify a<br>
> single thread(pthread_cond_signal) or all the threads waiting on a<br>
> condition (or a state change) (pthread_cond_broadcast)<br>
><br>
> Question was on pthread_mutex_unlock() that whether this function<br>
> invocation will trigger the movement of all the threads in the wait queue<br>
> to the ready queue.<br>
<br>
</div> After pthread_mutex_unlock() is called , the mutex is release , then ,which stuff<br>
will reshcedule the threads in the waitqueue ?<br>
<br>
If do pthread_cond_signal() after each pthread_mutex_unlock() ,does it raise up the performence ?<br>
<br>
thanks! <br></blockquote><div>I think you are missing something in your understanding. Please refer "Programming with POSIX threads" - David R. Butenhof<br></div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="HOEnZb"><div class="h5">
<br>
<br>
<br>
<br>
<br>
> If all the threads are of equal priority, then the first thread waiting for<br>
> the lock will be put to READY queue.<br>
> If there are variable priority threads waiting for the lock, then the<br>
> thread with highest priority would be woken up<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Prabhunath G<br>Linux Trainer<br>Bangalore<br>