caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chris Hecker <checker@d6.com>
To: John Max Skaller <skaller@ozemail.com.au>, caml-list@inria.fr
Subject: Re: [Caml-list] gc question: thread stacks, fibers, etc.
Date: Sat, 12 Oct 2002 11:54:07 -0700	[thread overview]
Message-ID: <4.3.2.7.2.20021012114058.02ec19e0@mail.d6.com> (raw)
In-Reply-To: <3DA84EE0.806@ozemail.com.au>


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

Hmm, not sure I understand the last sentence there.

If you care about not having a fixed stack, you can handle it in the same 
way a thread handles its stack if you're willing to write os-dependent code 
(set guard pages, catch exceptions, etc.).  In ocaml, you can probably 
realloc in a non-os-dependent way fairly effectively, because you've got 
all the stack frames around in the frame tables and there are no pointers 
into the stack (well, except if you've called C functions in the middle...hmm).

Ignoring that, one reason you want fibers instead of threads is that you 
don't want preemption for some problems because it complicates your code to 
handle the asynchrony.  If you're saying you should just use non-preemtive 
threads (or make them non-preemptive with mutexes), well that's what I'm 
calling fibers.

Chris

-------------------
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:[~2002-10-12 18:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04 10:25 Chris Hecker
2002-10-06 18:13 ` [Caml-list] Coroutines Jerome Vouillon
2002-10-06 19:46   ` Chris Hecker
2002-10-12 15:58   ` John Max Skaller
2002-10-12 16:33 ` [Caml-list] gc question: thread stacks, fibers, etc John Max Skaller
2002-10-12 18:54   ` Chris Hecker [this message]
2002-10-13  8:32 ` Xavier Leroy
2002-10-14  7:18   ` Chris Hecker

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=4.3.2.7.2.20021012114058.02ec19e0@mail.d6.com \
    --to=checker@d6.com \
    --cc=caml-list@inria.fr \
    --cc=skaller@ozemail.com.au \
    /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).