From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D73EBBB81 for ; Tue, 7 Mar 2006 20:03:43 +0100 (CET) Received: from outmail.freedom2surf.net (outmail1.freedom2surf.net [194.106.33.237]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k27J3hpM011072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Mar 2006 20:03:43 +0100 Received: from [10.0.0.1] (i-195-137-83-147.freedom2surf.net [195.137.83.147]) by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id k27J3e5K030289 for ; Tue, 7 Mar 2006 19:03:41 GMT Message-ID: <440DD982.8080800@asfandyar.cjb.net> Date: Tue, 07 Mar 2006 19:05:38 +0000 From: Asfand Yar Qazi User-Agent: Mozilla Thunderbird 1.0.7 (X11/20060217) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] STM support in OCaml References: <440DB255.1030701@asfandyar.cjb.net> <1141751708.20944.355.camel@budgie.wigram> In-Reply-To: <1141751708.20944.355.camel@budgie.wigram> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 440DD90F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 haskell:01 afaik:01 bounded:01 combinator:01 simonpj:01 simonpj:01 cjb:98 2006:98 wrote:01 wrote:01 caml-list:01 variables:02 variables:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=DNS_FROM_RFC_WHOIS autolearn=disabled version=3.0.3 skaller wrote: > On Tue, 2006-03-07 at 16:18 +0000, Asfand Yar Qazi wrote: > >>Hi, >> >>I've temporarily decided to leave off learning OCaml (although I still intend >>to learn it at some point) and start learning Haskell due to its support for >>Software Transactional Memory and lock-free concurrent programming. > > > AFAIK STM is not lock free. It simply limits the locking period > to a bounded time, at the expense of the whole transaction > taking unbounded time. The final compare/write/retry must > be atomic and is therefore protected by a mutex under the hood. > > Sebastian Egner said in another post the main advantage > of STMs: they have a combinator form, that is, they > can be composed. > > However, despite the lack of safety in a bolt on > addition for Ocaml .. the real problem is that STM > isn't that useful unless you have > > (a) a lot of processors > (b) a lot of variables > > so that the risk of contention is low and the cost > of long exclusions is high. Ocaml fails to satisfy > property (a) since it doesn't support multi-processing. > You make several claims: STM is not lock free. STM is not useful on a small number of processors With all due respect, these papers refutes these claims: http://research.microsoft.com/~simonpj/papers/stm/index.htm http://research.microsoft.com/~simonpj/papers/stm/lock-free.htm (That's right - the premier research on STM is being done by Micro$oft - yuck.) As for claim 1. "Lock-free" doesn't mean what you think it does. Quote from first paper, page 11: "The STM implementation guarantees that one transaction can force another to abort only when the first one commits. As a result, the STM implementation is lock-free in the sense that it guarantees at any time that some running transaction can successfully commit." As for claim 2, note the two-processor performance graphs of their tests (second paper, "lock-free.htm", pages 14-15): STM blows the hell out of conventional lock-based parallel processing. As for the lot of variables bit, I intend to have a lot of the buggers :-)