All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
To: John Levon <levon@movementarian.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	xen-devel <xen-devel@lists.xensource.com>,
	"George S. Coker, II" <gscoker@alpha.ncsc.mil>,
	Patrick Colp <pjcolp@cs.ubc.ca>,
	Alex Zeffertt <Alex.Zeffertt@eu.citrix.com>,
	Samuel Thibault <samuel.thibault@eu.citrix.com>
Subject: Re: ocaml?? why??
Date: Mon, 06 Apr 2009 16:08:30 +0100	[thread overview]
Message-ID: <49DA1AEE.7070108@eu.citrix.com> (raw)
In-Reply-To: <20090406135155.GA7928@movementarian.org>

John Levon wrote:
>> OCaml has been great to use. Programming the same functional tree store 
>> with advanced transaction merging capability in the C version would have 
>> been a major pain, compared to how (almost) easy it was in OCaml.
>>     
>
> So, I'm interested: why?
>   
The initial reason was getting rid of the on-disk database that also 
work as the mechanism for transaction  merging (a language with a GC is 
good for that). However it became quite clear, that we could also solve 
the problem of transaction stalling through the immutable tree and also 
making transactions cheap (the tree representation is shared over all 
transactions) compare to copying the whole database over filesystem of 
the C version.

at this point, making the transaction cheap is almost a given because of 
the language good GC (not referenced base !). the merging mechanism is 
something like 50 lines at this point too, with minimum code 
modifications on operations since that's the normal tree operations. 
(the C version has the same "normal operation" policy by  copying the 
whole database and just changing which database is actually being 
referenced)

So now the reason, why not to modify the C version .. first getting rid 
of disk database to the memory, is quite annoying to do (but relatively 
easy so far) .. then you need to solve the problem of transaction stalling.
there's lots of ways i guess, but i haven't imagine a solution where the 
same thing that the ocaml code does become trivial in C. either you need 
to modify every operation to understand some kind of modification list 
so that the tree get modified only at commit time (compare to now, at 
every operations), or you need to implement some kind of immutable tree 
(careful the C language doesn't prevent you for modifying it) which 
*requires* a GC that you need to implement too (or take one of those 
implementation from somewhere ..).

there's lots of other small reasons too, like the static type system 
that protect a lot during development phase (xenstored is very annoying 
to test, since it requires for full testing, to reboot the machine), and 
it's still an asset when i need to prove that no unexpected type are 
going to appears somehow (try to do the same thing in python and have 
fun :).

But surely xenstored could be implemented in any language, but I 
certainly wouldn't want to be the one fixing the C one, or implementing 
a python xenstored !

-- 
Vincent

  reply	other threads:[~2009-04-06 15:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 14:38 caml stubdom crashes Alex Zeffertt
2009-04-02 16:22 ` Patrick Colp
2009-04-02 17:19   ` George S. Coker, II
2009-04-02 19:39     ` ocaml?? why?? (was: caml stubdom crashes) Dan Magenheimer
2009-04-02 21:38       ` Samuel Thibault
2009-04-02 22:13         ` Dan Magenheimer
2009-04-02 22:31           ` Samuel Thibault
2009-04-02 23:36           ` Ian Pratt
2009-04-03  0:40             ` Dan Magenheimer
2009-04-03  1:21               ` Ian Pratt
2009-04-02 23:46           ` Anil Madhavapeddy
2009-04-06 10:33       ` John Levon
2009-04-06 13:51         ` ocaml?? why?? Vincent Hanquez
2009-04-06 13:51           ` John Levon
2009-04-06 15:08             ` Vincent Hanquez [this message]
2009-04-06 15:29               ` Patrick Colp
2009-04-06 15:38               ` John Levon
2009-04-06 16:44                 ` Vincent Hanquez
2009-04-03  8:53     ` caml stubdom crashes Alex Zeffertt
2009-04-03 14:53       ` George S. Coker, II
2009-04-03 21:07         ` Patrick Colp
2009-04-06 13:42           ` Alex Zeffertt
2009-04-03  8:31   ` Alex Zeffertt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49DA1AEE.7070108@eu.citrix.com \
    --to=vincent.hanquez@eu.citrix.com \
    --cc=Alex.Zeffertt@eu.citrix.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=gscoker@alpha.ncsc.mil \
    --cc=levon@movementarian.org \
    --cc=pjcolp@cs.ubc.ca \
    --cc=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.