From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id CFFD3820A1 for ; Fri, 16 Aug 2013 03:28:30 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jfc@MIT.EDU) identity=pra; client-ip=18.7.68.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="jfc@MIT.EDU"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jfc@mit.edu designates 18.7.68.34 as permitted sender) identity=mailfrom; client-ip=18.7.68.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="jfc@mit.edu"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@dmz-mailsec-scanner-5.mit.edu) identity=helo; client-ip=18.7.68.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="postmaster@dmz-mailsec-scanner-5.mit.edu"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwBAAF/DVISB0Qim2dsb2JhbABbgztQrGqSK4EkFg4BAQEBAQgJCwkUKIIkAQEEASwpGRALCyEEIQ8SJBIZEodsAwkGAwmxIgMKV4gHjVWDAhaDfAOVe4FogS6KfoNYhQY X-IPAS-Result: AmwBAAF/DVISB0Qim2dsb2JhbABbgztQrGqSK4EkFg4BAQEBAQgJCwkUKIIkAQEEASwpGRALCyEEIQ8SJBIZEodsAwkGAwmxIgMKV4gHjVWDAhaDfAOVe4FogS6KfoNYhQY X-IronPort-AV: E=Sophos;i="4.89,890,1367964000"; d="scan'208";a="29469971" Received: from dmz-mailsec-scanner-5.mit.edu ([18.7.68.34]) by mail2-smtp-roc.national.inria.fr with ESMTP; 16 Aug 2013 03:28:29 +0200 X-AuditID: 12074422-b7ef78e000000935-08-520d803d44ef Received: from mailhub-1.mit.edu ( [18.9.21.34]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 74.12.02357.D308D025; Thu, 15 Aug 2013 21:28:29 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-1.mit.edu [18.9.28.12]) by mailhub-1.mit.edu (8.13.8/8.9.2) with ESMTP id r7G1SSOn023532 for ; Thu, 15 Aug 2013 21:28:28 -0400 Received: from webmail-4.mit.edu (webmail-4.mit.edu [18.9.23.14]) ) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7G1SRt3027372 for ; Thu, 15 Aug 2013 21:28:28 -0400 Received: from webmail-4.mit.edu (webmail-4.mit.edu [127.0.0.1]) by webmail-4.mit.edu (8.13.8) with ESMTP id r7G1SRdE002186; Thu, 15 Aug 2013 21:28:27 -0400 Received: (from nobody@localhost) by webmail-4.mit.edu (8.13.8/8.13.8/Submit) id r7G1SQ5r002185 for caml-list@inria.fr; Thu, 15 Aug 2013 21:28:26 -0400 X-Authentication-Warning: webmail-4.mit.edu: nobody set sender to jfc@mit.edu using -f Received: from cpe-76-88-27-72.san.res.rr.com (cpe-76-88-27-72.san.res.rr.com [76.88.27.72]) (User authenticated as jfc@ATHENA.MIT.EDU) by webmail.mit.edu (Horde MIME library) with HTTP; Thu, 15 Aug 2013 21:28:26 -0400 Message-ID: <20130815212826.7sz760lhs0c00k84@webmail.mit.edu> Date: Thu, 15 Aug 2013 21:28:26 -0400 From: John F Carr To: caml-list@inria.fr References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTURjHObvXeTZ28266dpyGeNEPGdOKwiQNBYtEgjSwsA91dSd3cW/c u4n6ITXpzQxLimiuTMhKIVMptChrQ0JdQkUEFtmMKSVKOEjQ1Lp38+3b/zn/5/d/zhskNN4I PeSsDsxbWTMjV5IahZYxZNVShTungop9wf5uMhscbv7pJY+CYmWmEZu5CsynHTitNPln/srs 7VGV3ombZC1oUzUABUT0HtQz/iwyrLei9+NP5A1ACTX0c4BGGruIcPEGoMDS8qozCNC73osg XNwFyOVZDPEaugWgAXdeOKsITfr9q8QPgB698IWaKDoLBb7fl0uapJPRU/dHIGk5nYAW/H0h HSNuxNX6iWwAEEbTB9HXX8fC+QWo4+1QKEZBF6Jbra9XI9Vo+HaAlDRB56Dlq/VyCSXoOPRw BYaXE1DfrJuQtJZOR/5X/eAa0Lo20a5NtGuDdm2i7wGyE2wzWqoNFpYzC7jUIJSyVivmDXtT LZwjFRudvUB6kshcph8seBgvoCFgVNQYQxVqItgKocriBbFQxmipD4K4tKXEZqwysYLpFO80 Y8ELECSYGKorSfQoI1tVjXnbmhUHSUZHTU2OFmjoMtaByzG2Y37NjYeQQdSOGhFU87gMV57h zI4NWwYVUrhKDE+UeijBzloErizsj4AMuHKlUbyzpY47QQBvDLUFgYa02qxYr6PkEkBLgMlp Xc9c+3rTQCceMZqaOyt2qcSPuZ46LQ6UiQOzy5XSQAe7YelrAStw+02L3Z/TCfVg9nh1VH5N +2NbXXHaifi+Q0Ud805D/kn8xfPv3Pn5HBc7u5jYolQe2Z6W7tFa8i59ayopcudzsWPlXh3l 841ONP1JyNUn/561DyTNzac4mlSOzOQ830zgOBx40NNT/xKU1l2/rJ4Y3r3AXqhvrusczYhm SMHE7koheIH9Dz67pElVAwAA Subject: Re: [Caml-list] Threads and "transaction isolation" in OCaml Do you mean allocation or garbage collection? Generational garbage collectors can collect without allocation when you assign a young object to a field of an older object. There is (or may be) a list of intergenerational (older to younger) references. When that list exceeds a threshold, the GC may do a minor collection. I have not checked what the current implementation of OCaml does in this case. let x = ref (ref 0) in let y = ref 1 in (* allocation triggers GC; x is old and y is young *) ... work here ... x := y (* may cause GC *) > Hi, > > I just wondered how much we can rely on current OCaml-semantics where > context-switches are impossible as long as there are no allocations. > > E.g. pattern-matches, array and record field assignments, etc., can be > safely chained together in one "transaction" without having to fear > that another thread will interrupt them. This is extremely useful for > optimizing certain applications where lock acquisitions might just be > too expensive. > > There already are some corner cases where things may be > platform-dependent, e.g. calling functions tail-recursively that take > more arguments than there are available CPU-registers. In that case > the compiler may pass arguments by allocating blocks on the heap. But > I think people that care about such obviously brittle semantics know > where to be careful. > > Anyway, is it considered reasonably future-safe to write code of that > sort? I'd rather not have new compiler optimizations, etc., interfere > with these assumptions in the near future. > > Regards, > Markus > > -- > Markus Mottl http://www.ocaml.info markus.mottl@gmail.com > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >