From owner-freebsd-arch@FreeBSD.ORG Sun Nov 7 00:15:16 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38C8E16A524 for ; Sun, 7 Nov 2004 00:15:16 +0000 (GMT) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [128.30.28.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB0AD43D31 for ; Sun, 7 Nov 2004 00:15:15 +0000 (GMT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.9/8.12.9) with ESMTP id iA70FEaa015466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK CN=khavrinen.lcs.mit.edu issuer=SSL+20Client+20CA); Sat, 6 Nov 2004 19:15:14 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.9/8.12.9/Submit) id iA70FDxm015465; Sat, 6 Nov 2004 19:15:13 -0500 (EST) (envelope-from wollman) Date: Sat, 6 Nov 2004 19:15:13 -0500 (EST) From: Garrett Wollman Message-Id: <200411070015.iA70FDxm015465@khavrinen.lcs.mit.edu> To: phk@phk.freebsd.dk X-Newsgroups: mit.lcs.mail.freebsd-arch In-Reply-To: <10847.1099784360@critter.freebsd.dk> Organization: MIT Laboratory for Computer Science X-Spam-Score: -6.6 () IN_REP_TO,QUOTED_EMAIL_TEXT X-Scanned-By: MIMEDefang 2.37 cc: arch@FreeBSD.org Subject: Re: Multi-threading access to device drivers. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2004 00:15:16 -0000 In article <10847.1099784360@critter.freebsd.dk> you write: >Assume a process with two threads on two CPUs, both >doing read(fd, buf, len) at the same time. > >Should we let both reads into the driver at the same time ? > >If so, which uio_offset do we hand them ? POSIX is quite clear on the matter: > All of the functions chmod (), close (), fchmod (), fcntl (), fstat > (), ftruncate (), lseek (), open (), read (), readlink (), stat (), > symlink ( ), and write ( ) shall be atomic with respect to each other > in the effects specified in IEEE Std 1003.1-2001 when they operate on > regular files. If two threads each call one of these functions, each > call shall either see all of the specified effects of the other call, > or none of them. (One of the "specified effects" is advancing the file offset.) -GAWollman -- Garrett A. Wollman | As the Constitution endures, persons in every wollman@lcs.mit.edu | generation can invoke its principles in their own Opinions not those of| search for greater freedom. MIT, LCS, CRS, or NSA| - A. Kennedy, Lawrence v. Texas, 539 U.S. ___ (2003)