From owner-freebsd-arch@FreeBSD.ORG Sun Nov 7 07:46:02 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 79BF616A4CE for ; Sun, 7 Nov 2004 07:46:02 +0000 (GMT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD0E543D41 for ; Sun, 7 Nov 2004 07:46:01 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.13.1/8.13.1) with ESMTP id iA77jxVI018155; Sun, 7 Nov 2004 08:45:59 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Garrett Wollman From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sat, 06 Nov 2004 19:15:13 EST." <200411070015.iA70FDxm015465@khavrinen.lcs.mit.edu> Date: Sun, 07 Nov 2004 08:45:59 +0100 Message-ID: <18154.1099813559@critter.freebsd.dk> Sender: phk@critter.freebsd.dk 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 07:46:02 -0000 In message <200411070015.iA70FDxm015465@khavrinen.lcs.mit.edu>, Garrett Wollman writes: >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.) Yes, but notice the "... when they operate on regular files." bit. It doesn't say anything about devices. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.