From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA10438; Tue, 1 Apr 2003 23:01:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA09898 for ; Tue, 1 Apr 2003 23:01:37 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h31L1a504297 for ; Tue, 1 Apr 2003 23:01:36 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Tue, 1 Apr 2003 15:02:08 -0600 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Tue, 1 Apr 2003 15:02:08 -0600 Date: Tue, 1 Apr 2003 15:03:33 -0600 (CST) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Ville-Pertti Keinonen cc: Ocaml Mailing List Subject: Re: [Caml-list] Bug? Printf, %X and negative numbers In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 01 Apr 2003 21:02:08.0369 (UTC) FILETIME=[F4F8D610:01C2F891] X-Spam: no; 0.00; qlogic:01 caml-list:01 bug:01 printf:01 intuitively:01 biased:01 inherently:01 threads:01 implicitly:01 allocating:01 incremented:01 86.:01 spinlock:01 increment:01 necessarily:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 1 Apr 2003, Ville-Pertti Keinonen wrote: > > > For structures 32 words or less, you can do it like (using x86 assembly > > language here): > > ...actual code snipped... > > Ok, that's not necessarily too bad. > > I guess I was just intuitively dismissing anything that felt like it > had more than a couple of instructions of "overhead". I'm probably > also biased by SMP-thinking - read-modify-write operations feel > inherently evil. ;-) > For SMP you want different minor heaps for every thread. Adding the lock prefix to an instruction costs ~100 clock cycles. Much better to simply give each thread it's own minor heap. 64K isn't that much memory. And there are stunts you can pull if you threads spend most of their life blocked to decrease the number of minor heaps you need. Note that you implicitly have a read-modify-write cycle already in your allocation. You need to read the top-of-heap pointer, save off the original pointer, increment by the size you are allocating, and write the incremented pointer back, all automatically. A wonderful application of load locked/store conditional, if only we had it in the x86. Without it, you basically need to grab a spinlock before updating. Thus the lock prefix. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners