From owner-freebsd-arch@FreeBSD.ORG Sun Nov 7 07:48:49 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 8A09816A4CE for ; Sun, 7 Nov 2004 07:48:49 +0000 (GMT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9C6943D2F for ; Sun, 7 Nov 2004 07:48:48 +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 iA77mdbI018263; Sun, 7 Nov 2004 08:48:39 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Matthew Dillon From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sat, 06 Nov 2004 19:57:36 PST." <200411070357.iA73vaqU040765@apollo.backplane.com> Date: Sun, 07 Nov 2004 08:48:39 +0100 Message-ID: <18262.1099813719@critter.freebsd.dk> Sender: phk@critter.freebsd.dk cc: arch@freebsd.org cc: John-Mark Gurney 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:48:49 -0000 In message <200411070357.iA73vaqU040765@apollo.backplane.com>, Matthew Dillon writes: >:As was quoted POSIX, the update should be atomic.. so my reading of >:that is that you lock the fd, when you read the offset from the fd, >:you need to also update the offset with the number of bytes read, so >:that a racing read both doesn't drop any data, nor duplicate any data.. >: >:i.e. single file with fixed records, it should be perfectly safe to >:throw five threads looping doing a read processing of the records w/o >:fear of duplicate records, or dropped records... >: >:And if we handle it in this manner, then you can allow multiple reads >:into the driver... >: >:-- >: John-Mark Gurney Voice: +1 415 225 5579 > > If it's a regular file [...] BZZZT! Wrong, but thanks for playing. (We are talking devices here) -- 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.