From: Jonathan Bryant <jtbryant@valdosta.edu>
To: Benedikt Grundmann <benedikt@cardexpert.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Faking concurrency using Unix forks and pipes (ray tracing results)
Date: Mon, 4 Jun 2007 12:13:47 -0400 [thread overview]
Message-ID: <1B7A6678-6C9E-4356-802C-5CA5168A27CC@valdosta.edu> (raw)
In-Reply-To: <9b415f950706040850v586a285ax1448d23c0c78a375@mail.gmail.com>
On Jun 4, 2007, at 11:50 AM, Benedikt Grundmann wrote:
> Hi Jonathan,
>
> 2007/6/4, Jonathan Bryant <jtbryant@valdosta.edu>:
>>
>> On Jun 4, 2007, at 6:56 AM, Jon Harrop wrote:
>>
>> >
>> > When you apply this map to an array, a new process is forked for
>> > each element.
>> > As forking is time consuming, you should only apply this to short
>> > arrays.
>>
>> It might be worth your while to implement a process pool. I said
>> before that I fork of one base process from which to fork the others,
>> and it's not possible to make that process just a controller for a
>> pool of waiting processes.
>>
>> --Jonathan
>>
>
> Do you also do that in your work for the OSP? I'm asking cause you
> mentioned previously that you want to stay compatible to the ocaml
> threads library... and I just can not figure out how you want to
> implement Thread.create using that base process...
I'm staying with the feel of the threads library, but I'm going to
have to make it incompatible. My API uses functors to build
everything up and then resembles the existing API. I know there has
been some talk on this list about performance issues with that, but I
prefer a clean design over speed (at least at the moment). Mainly
this is because Marshal is not trustworthy, so every message type
needs to have to_ and of_ string functions:
module type Message =
sig
type 'a t
val to_string : 'a t -> string
val of_string : string -> 'a t
end
From there it builds up. I'm actually trying to design it in such a
way that channels aren't limited to UNIX/TCP sockets, and that the
on-wire protocol can be changed as well. Hopefully that will go as
planned.
As for threads, there are actually 3 levels: concurrent (the
existing threads), parallel (forked processes), and remote (forked
process on another machine). The level of concurrency is specified
at thread creation either by using a special version of Thread.create
(such as Thread.concurrent or Thread.parallel) or by an optional
parameter to Thread.create. This allows the programmer to use the
mechanism needed (threads/processes) in the same manner. One
additional change is that threads can either be attached (return a
value), or detached (like they are now and return unit), allowing for
a future-esque usage of threads. Also, since it's internally just
HOFs filled in by the runtime, it allows programs written to run on a
cluster (using remote threads) to run in a single process for testing
(using just concurrent threads), and then moved to a multi-core /
multi-machine environment without any recoding or recompilation.
> BTW: Maybe we should subscribe each others project's mailing list? So
> tha twe can help and learn from each other?
>
I'm already on yours :).
Mine's http://groups.google.com/group/osp2007-northpole
From what you've said, I think we might be covering a lot of the
same ground.
>
> Here is the link to mine:
>
> http://groups.google.com/group/osp2007-econcurrency
>
> Cheers,
>
> Bene
>
>
> --
> Calvin: I try to make everyone's day a little more
> surreal.
>
> (From Calvin & Hobbes)
next prev parent reply other threads:[~2007-06-04 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-04 10:56 Jon Harrop
2007-06-04 15:33 ` [Caml-list] " Jonathan Bryant
2007-06-04 15:39 ` Jonathan Bryant
[not found] ` <9b415f950706040850v586a285ax1448d23c0c78a375@mail.gmail.com>
2007-06-04 16:13 ` Jonathan Bryant [this message]
[not found] ` <9b415f950706040933r22e1560fhc088368ccb8444fa@mail.gmail.com>
2007-06-04 16:53 ` Jonathan Bryant
2007-06-04 18:00 ` Brian Hurt
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=1B7A6678-6C9E-4356-802C-5CA5168A27CC@valdosta.edu \
--to=jtbryant@valdosta.edu \
--cc=benedikt@cardexpert.net \
--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).