caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* CML Discussion (was: Smart ways to implement worker threads)
@ 2010-07-15 17:50 Rich Neswold
  2010-07-15 18:24 ` [Caml-list] " David McClain
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Neswold @ 2010-07-15 17:50 UTC (permalink / raw)
  To: caml-list; +Cc: Romain Beauxis

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

On Thu, Jul 15, 2010 at 11:19 AM, David McClain <
dbm@refined-audiometrics.com> wrote:

> That is not the same as OCaml's architecture, and so OCaml can implement
> about 90% of CML but that last 10% might kill your dreams. CML likes to
> spawn potential handlers, of which only one will get the go ahead. The
> others are expected to die, after possibly cleaning up state.
>

So which 10% of the Event module is poorly implemented? Or is it that the
Event module doesn't have a spawn function and relies on the Thread module?
Is it fixable (could a CML module be created for OCaml that faithfully
implements the run-time described in Reppy's book)?

I thought I read some details, recently, which described CML threads
implemented as continuations rather than system threads, which made them
inexpensive (relative to OS threads) to create. I'll have to go through my
blog lists to see where I read that.

Thanks for your insights!

-- 
Rich

Google Reader: https://www.google.com/reader/shared/rich.neswold
Jabber ID: rich@neswold.homeunix.net

[-- Attachment #2: Type: text/html, Size: 1690 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] CML Discussion (was: Smart ways to implement worker threads)
  2010-07-15 17:50 CML Discussion (was: Smart ways to implement worker threads) Rich Neswold
@ 2010-07-15 18:24 ` David McClain
  0 siblings, 0 replies; 2+ messages in thread
From: David McClain @ 2010-07-15 18:24 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]

Hi,


> So which 10% of the Event module is poorly implemented? Or is it  
> that the Event module doesn't have a spawn function and relies on  
> the Thread module? Is it fixable (could a CML module be created for  
> OCaml that faithfully implements the run-time described in Reppy's  
> book)?
>
That 10% was a figure of speech. I cant know how much the missing  
functionality affects the final application. Continuations are just  
another way of stating "spaghetti stacks", since they represent the  
entire "future" of the program -- i.e., the stacked contexts to be  
returned to later.

My point was that OCaml's runtime is modeled against the use of a  
single machine stack - hence the great speed. Spaghetti stacks  
require explicit handling in the heap memory, and so would be slower.  
But the great thing about spaghetti stacks is that a "continuation"  
can be created as a first-class object, and easily reclaimed by the  
GC. [Examples: CML, Smalltalk, Erlang, others?]

Technically, you can do anything in any language... so OCaml is  
technically "fixable" in this regard. But is it practical? feasible?  
I doubt it.

Whether the shortcomings are important to you depends on your  
expectations and performance requirements. I have successfully used  
the notion of Reppy Channels in OCaml, Lisp, Scheme, and elsewhere.  
Only you can decide if the overhead of thread creation, the lack of  
GC thread reclamation, and the act of throwing new threads at every  
decision point, is too much, or inconsequential.

Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750

email: dbm@refined-audiometrics.com
phone: 1.520.390.3995
web: http://refined-audiometrics.com


[-- Attachment #2: Type: text/html, Size: 6076 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-15 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15 17:50 CML Discussion (was: Smart ways to implement worker threads) Rich Neswold
2010-07-15 18:24 ` [Caml-list] " David McClain

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