Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Nov 2004 04:15:22 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        David Xu <davidxu@freebsd.org>
Cc:        David Schultz <das@freebsd.org>
Subject:   Re: cvs commit: src/sys/vm vm_zeroidle.c
Message-ID:  <20041106121522.GE24892@elvis.mu.org>
In-Reply-To: <418C88C5.9010803@freebsd.org>
References:  <200410311932.i9VJWvmo058193@repoman.freebsd.org> <20041101045331.GP16728@cs.rice.edu> <20041101105113.GS24892@elvis.mu.org> <200411011441.33067.jhb@FreeBSD.org> <20041106062955.GA1986@VARK.MIT.EDU> <418C844E.3030403@freebsd.org> <20041106081147.GA1419@VARK.MIT.EDU> <418C88C5.9010803@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* David Xu <davidxu@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@mu.org cell: 408-480-4684



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041106121522.GE24892>