caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] More cores
Date: Fri, 19 Dec 2008 22:31:33 +0000	[thread overview]
Message-ID: <200812192231.33131.jon@ffconsultancy.com> (raw)
In-Reply-To: <157727.93194.qm@web111508.mail.gq1.yahoo.com>

On Friday 19 December 2008 14:04:22 Dario Teixeira wrote:
> Hi,
>
> > Is it time to start rethinking concurrency in OCaml?
> > (...)
>
> That's a recurrent topic in this list.  I'll summarise the arguments
> and save us all some time:
>
> i) Someone raises the issue that it's time for Ocaml to go multicore.
>
> ii) A few voices go "yeah!" and state that with a concurrent GC,
>     Ocaml can take over the world.  Their argument is as follows:
>
>     1) Ocaml gets a concurrent GC;
>     2) ...
>     3) Profit!

Or:

ii) People used to choose OCaml because it was fast but lack of support for 
multicores means that OCaml is no longer competitively performant for many 
tasks on today's computers.

> iii) A voice of reason notes that the devil is in step 2) above.
>      If your programming paradigm for concurrency is Threads+Mutexes,
>      then you are exposing yourself to a world of pain in race
>      conditions.  At this point someone usually links to Xavier's
>      standard speech on concurrency (which is a few years old, but
>      as poignant now as it was then).

iii) Your "voice of reason" also said that multicore computers "have never 
really taken off, at least in the general public":

http://caml.inria.fr/pub/ml-archives/caml-list/2002/11/64c14acb90cb14bedb2cacb73338fb15.en.html

> ...
> While I tend to agree with viewpoints iii) and v), I do think a healthy
> discussion on the subject of multicore is in order.  Though I suggest we
> focus the discussion on concurrency models that will allow us to take
> advantage of those multicores in a safe, sane manner: 

At this point, you need to distinguish between concurrency and parallelism.

OCaml can already handle concurrency reasonably well, particularly when CPU 
usage is low. Perhaps OCaml has a future in that specific domain but it is 
not my remit so I am not the best person to comment on this (ask Gerd).

OCaml is extremely bad at parallelism, even embarassingly parallel tasks 
because OCaml still has to marshall all the data in a gather operation or 
resort to manual memory management. However, the problems are entirely with 
the current implementation and not with the language at all. So a new 
implementation could address this problem.

> a) Could Jocaml be the future of Ocaml?

For concurrency perhaps but not for parallelism.

> b) How do we handle the global mutability issue?

Avoid mutation when it is likely to get out of control (e.g. Erlang-style 
concurrent applications) but keep it available because it gives huge 
performance improvements in many parallel applications. F# already has good 
solutions in both cases so we can just copy them.

I spent a lot of time thinking about the future of the ML family of languages 
in the open source world recently. I believe I have an another way forward 
that some people might find interesting. I think ML has proven its worth and 
it is time to begin developing a completely new open source ML 
implementation. There are various different ways to accomplish this and the 
goals are quite obvious (IMHO). However, finding a route that is likely to 
lead to those goals that is socially acceptable (i.e. not a fork) and 
technically feasible (i.e. incrementally adding useful features and garnering 
users) was not easy. I believe the best course of action is to develop an 
embedded DSL for OCaml (e.g. for higher-performance numerics) and evolve it 
into a completely new ML implementation.

I have actually already started this using the excellent LLVM project and I 
just obtained the first promising results yesterday: a simple benchmark where 
my compiler runs OCaml code 3x faster than ocamlopt does.

There are a *lot* of low hanging fruit here. So I think it should be 
relatively easy to create a tool that is useful for a significant number of 
people. The most interesting aspect is that developing this project as a DLL 
that is entirely accessible from within OCaml makes it possible to address 
many of OCaml's own problems for existing OCaml programmers.

If anyone has any ideas about this I'd love to hear them.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


  parent reply	other threads:[~2008-12-19 22:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 13:04 Mikkel Fahnøe Jørgensen
2008-12-19 14:04 ` [Caml-list] " Dario Teixeira
2008-12-19 15:06   ` Alexy Khrabrov
2008-12-19 15:54     ` The Axis of Eval (was: More cores) Dario Teixeira
2008-12-19 16:26       ` [Caml-list] " Paolo Donadeo
2008-12-19 17:01       ` Dario Teixeira
2008-12-19 18:01         ` Christophe Raffalli
2008-12-19 18:50     ` [Caml-list] More cores Ulf Wiger (TN/EAB)
2008-12-19 19:10   ` Richard Jones
2008-12-19 22:31   ` Jon Harrop [this message]
2008-12-19 22:36     ` Erik de Castro Lopo
2008-12-19 22:53       ` Jon Harrop
2008-12-22 17:00         ` [Caml-list] More Caml Jon Harrop
2008-12-22 21:44           ` Richard Jones
2008-12-23  6:07             ` Jon Harrop
2008-12-23  9:59               ` Jon Harrop
2008-12-23 15:32                 ` Ashish Agarwal
2008-12-23 17:33                   ` Jon Harrop
2008-12-24 13:12                 ` Mikkel Fahnøe Jørgensen
2008-12-24 16:47                   ` Jon Harrop
2008-12-23 10:04               ` Richard Jones
2008-12-23 10:38                 ` Jon Harrop
2008-12-23  9:43           ` Oliver Bandel
2008-12-23 11:53             ` Jon Harrop
2008-12-19 22:42     ` [Caml-list] More cores Richard Jones
2008-12-20 19:33     ` Mikkel Fahnøe Jørgensen
2008-12-20 19:41       ` Mikkel Fahnøe Jørgensen
2008-12-19 20:37 ` Oliver Bandel
2008-12-19 21:27   ` Richard Jones
2008-12-19 22:03     ` Hezekiah M. Carty
2008-12-19 22:47       ` Richard Jones
2008-12-19 23:00         ` Alexy Khrabrov
2008-12-19 23:56         ` prelude.ml as another standard extension to Pervasives? Alexy Khrabrov
2008-12-20  1:40           ` [Caml-list] " Mikkel Fahnøe Jørgensen
2008-12-20  4:50             ` Alexy Khrabrov
2008-12-20 10:53               ` Zheng Li
2008-12-20 12:37         ` [Caml-list] More cores Richard Jones

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=200812192231.33131.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@yquem.inria.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).