caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: james woodyatt <jhw@wetware.com>
To: The Trade <caml-list@inria.fr>
Subject: Re: [Caml-list] native threads not parallel?
Date: Thu, 20 Feb 2003 17:56:03 -0800	[thread overview]
Message-ID: <A21836F4-453F-11D7-B0E1-000393BA7EBA@wetware.com> (raw)
In-Reply-To: <j64r6yqxrq.fsf@explicit.atdesk.com>

On Thursday, Feb 20, 2003, at 16:32 US/Pacific, Chris Uzdavinis wrote:
>
> Here's the best/most detailed answer to your question that I've seen:
> <http://groups.google.com/ 
> groups?selm=fa.dlqoshv.1a66ho7%40ifi.uio.no&output=gplain>

On Mon, 25 Nov 2002 10:04:54 GMT, Xavier Leroy <xavier.leroy@inria.fr>  
wrote:
> It seems that the annual discussion on threads started again.  Allow
> me to deliver again my standard lecture on this topic.
>
> Threads have at least three different purposes:
>
> 1- Parallelism on shared-memory multiprocessors.
> 2- Overlapping I/O and computation (while a thread is blocked on a  
> network
>    read, other threads may proceed).
> 3- Supporting the "coroutine" programming style
>    (e.g. if a program has a GUI but performs long computations,
>     using threads is a nicer way to structure the program than
>     trying to wrap the long computation around the GUI event loop).
>
> The goals of OCaml threads are (2) and (3) but not (1) (for reasons
> that I'll get into later), with historical emphasis on (2) due to the
> MMM (Web browser) and V6 (HTTP proxy) applications.
> [...]
> In summary: there is no SMP support in OCaml, and it is very very
> unlikely that there will ever be.  If you're into parallelism, better
> investigate message-passing interfaces.

And I'm not sure that (2) is better done with threads and shared memory  
than with message passing and processes-- especially if you've a got a  
good solution for just doing (3) with a userland continuation  
scheduler.  (Now that I've learned a few more things about FP, I'm  
working on another pass at this that will hopefully not suck wind like  
my previous offering did.)

If you have a good userland scheduler, i.e. something that just throws  
around continuations in a reasonable way, and you're willing to go to  
message passing to get overlapping I/O and computation, then you can  
get parallelism on MP machines by just passing messages around between  
processes in the kernel.

However, I can think of a fourth purpose for SMP support: to permit  
OCaml functions to be usable as plugins to multi-threaded application  
programming frameworks in other languages, e.g. C, C++, Obj-C, Java,  
C#, etc. without having to make the OCaml runtime environment a  
critical section for every thread in the application.  I'm hard pressed  
to think of a good example where this might be worth doing, though...

Personally, I'm happy to continue expecting to get parallelism from  
message passing between distributed processes.  Fifteen years of coding  
under VxWorks (and Solaris with POSIX threads) has cured me of the  
desire for more preemptive multithreading with shared memory.


-- 
j h woodyatt <jhw@wetware.com>

-------------------
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


  reply	other threads:[~2003-02-21  1:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20 23:10 Shivkumar Chandrasekaran
2003-02-21  0:15 ` Jacques Garrigue
2003-02-21  4:24   ` shivkumar chandrasekaran
2003-02-21 10:43     ` Markus Mottl
2003-02-21 15:11     ` Jacques Garrigue
2003-02-21 17:57       ` Markus Mottl
2003-02-24 17:39       ` Shivkumar Chandrasekaran
2003-02-21  0:32 ` Chris Uzdavinis
2003-02-21  1:56   ` james woodyatt [this message]
2003-02-21  4:43   ` shivkumar chandrasekaran
  -- strict thread matches above, loose matches on Subject: below --
2001-06-15 16:49 Markus Mottl
2001-06-15 17:10 ` Xavier Leroy
2001-06-15 18:42   ` Markus Mottl
2001-06-15 21:33     ` Markus Mottl
2001-06-21 13:43       ` Markus Mottl

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=A21836F4-453F-11D7-B0E1-000393BA7EBA@wetware.com \
    --to=jhw@wetware.com \
    --cc=caml-list@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).