From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 13 00:07:26 2003 Return-Path: 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 6FD9B16A4BF for ; Mon, 13 Oct 2003 00:07:26 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F7B143FAF for ; Mon, 13 Oct 2003 00:07:24 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h9D76f311546; Mon, 13 Oct 2003 09:06:41 +0200 (MEST) Date: Mon, 13 Oct 2003 09:06:41 +0200 (CEST) From: Harti Brandt To: Tim Kientzle In-Reply-To: <3F8663AA.4010707@acm.org> Message-ID: <20031013090323.P45269@beagle.fokus.fraunhofer.de> References: <20031009194644.50B9116A4BF@hub.freebsd.org> <20031010091003.Q95881@beagle.fokus.fraunhofer.de> <3F8663AA.4010707@acm.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: Dynamic reads without locking. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2003 07:07:26 -0000 On Fri, 10 Oct 2003, Tim Kientzle wrote: TK>Harti Brandt wrote: TK>> Yes. When I read the C standard TK>> foo = data & mask; TK>> wouldn't also help, because there is no sequence point in this statement TK>> except at the ;. TK> TK>Before anyone takes this particular line of reasoning seriously, TK>I feel compelled to point out that sequence points have nothing to TK>do with this. TK> TK>a) Sequence points are an "as if" requirement. The TK> program must produce the same results "as if" it TK> strictly obeyed sequence points. It doesn't have TK> to really operate that way. (And, in fact, well-optimized TK> programs running on modern processors rarely do.) And that means, that at the semicolon the value of foo should be "as if" the compiler really compiled the expression as written. This does not mean, that he has to and this does mean, that while executing this expression "foo" can have any value. TK>b) Sequence points say NOTHING about how multiple TK> threads or processors interact. TK> TK>Sorry, but the C standard doesn't help here. The TK>C standard does not address multi-threading at all. But it addresses signal handling which suffers from the same problem of atomic access to variables. harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org