cvs commit: src/sys/vm vm_zeroidle.c

Alfred Perlstein alfred at freebsd.org
Sat Nov 6 04:15:22 PST 2004


* David Xu <davidxu at freebsd.org> [041106 00:18] wrote:
> David Schultz wrote:
> 
> >On Sat, Nov 06, 2004, David Xu wrote:
> >[...]
> > 
> >
> >>It is legal to call cv_signal() without a locked mutex.
> >>   
> >>
> >
> >Not according to the manpage or the comments in the code.
> >What you say is true about pthreads, but pthreads is broken
> >in this respect.
> >
> >
> > 
> >
> I don't think it is broken, calling cv_signal with mutex locked
> just introduce ping-pong problem.

Being able to rely on an external mutex will effectively halve the
number of mutex operations needed on CVs.

It seems to make sense to enforce that the associated mutex is held.

The external mutex should be dropped as soon as possible, and that
means it'll only add the time of a couple of more cycles to the
race for contesting on the external mutex.



-- 
- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright at mu.org cell: 408-480-4684


More information about the cvs-all mailing list