From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 27 17:25:25 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2699416A41F for ; Wed, 27 Jul 2005 17:25:25 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1FC543D55 for ; Wed, 27 Jul 2005 17:25:24 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.4/8.13.4/NETPLEX) with ESMTP id j6RHPMxL007032; Wed, 27 Jul 2005 13:25:22 -0400 (EDT) Date: Wed, 27 Jul 2005 13:25:22 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Scott Long In-Reply-To: <42E7BD9F.6060401@samsco.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: Norbert Koch , "Freebsd-Hackers@Freebsd. Org" Subject: Re: await & asleep X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2005 17:25:25 -0000 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