Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-10-12 (16:33)
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,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: