Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2005 13:25:22 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Scott Long <scottl@samsco.org>
Cc:        Norbert Koch <NKoch@demig.de>, "Freebsd-Hackers@Freebsd. Org" <freebsd-hackers@freebsd.org>
Subject:   Re: await & asleep
Message-ID:  <Pine.GSO.4.43.0507271303001.3877-100000@sea.ntplx.net>
In-Reply-To: <42E7BD9F.6060401@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 27 Jul 2005, Scott Long wrote:

> Daniel Eischen wrote:
>
> >
> > My mistake then.  I thought they were deprecated when mutex and
> > CVs were introduced.  There is no need for them except for compatability,
>
> Incorrect.  A mutex is not a replacement for sleep.  CV's and semaphores
> implement some of what tsleep does, but tsleep is absolutely appropriate
> when you want to sleep for an event (like disk i/o completing) and don't
> need to worry about mutexes.  Not every inch of the kernel needs to be
> covered by mutexes, Giant or otherwise.

Traditionally, you did splXXX() then tsleep().  But splXXX() has been
deprecated and you need to use mutexes for protection.  If you are going
to sleep for an event, that is cv_wait() and friends and you use the
mutex for protection.  It's hard to imagine that queueing disk I/O
requests and their completions don't need mutexes (or lockmgr?) for
protection, but I'll take your word for it.

-- 
DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0507271303001.3877-100000>