Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] gc question: thread stacks, fibers, etc.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] gc question: thread stacks, fibers, etc.
Chris Hecker wrote:

> 
> Fibers/Coroutines/Cooperative-Threads

> In C, you implement them by mallocing a stack and with a little snippet 
> of asm, or mucking with the jmpbuf fields.  They're pretty trivial to 
> get working fairly robustly


.. and fairly useless in most demanding applications due to the
impossibility of dynamically extending/shrinking the stack.
If that isn't a problem .. you might as well just use
real threads ..

Felix solves this problem by using heap allocated stack
frames .. there is a cost in that many procedure calls
must be done indirectly via a driver routine which
maintains the top of stack pointer for each thread.
It also preserves high efficiency by disallowing
blocking I/O (yields) in functional code, which use
the machine stack as usual.

BTW: I consider the technique a case of continuations,
but it is probably more correct to consider it
as a system of resumptions.



-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850


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