unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <marius.vollmer@uni-dortmund.de>
Cc: guile-devel@gnu.org
Subject: Re: doco scm_remember_upto_1
Date: 30 May 2003 15:26:39 +0200	[thread overview]
Message-ID: <lj65nspnu8.fsf@troy.dt.e-technik.uni-dortmund.de> (raw)
In-Reply-To: <87r86rqa6m.fsf@raven.i.defaultvalue.org>

Rob Browning <rlb@defaultvalue.org> writes:

> Hmm.  So what level of preemption are we planning to support, or
> rather for what kind of preemption should we be coding defensively?

Well, the situation in CVS HEAD right now is this

   Multiple threads can use Guile concurrently but must follow some
   rules.  A thread can either be in 'Guile mode' or not.

    - When it is not in Guile mode it can not make any calls to
      libguile functions (other than those that explicitely allow
      this)

    - When it is in Guile mode, it can use libguile functions but it
      must cooperate with all other threads that are in Guile mode.
      This means that it must call libguile functions (that do
      consing?)  'regularily' since the global GC can only run from
      within such a function.  When long computations are to be done
      that don't require calls into libguile, either drop out of Guile
      mode or call SCM_TICK at reasonable intervals.

    - Local variables that are created while not being in Guile mode
      are not scanned by the GC.  However, local variables that are
      created while being in Guile mode are continued to being scanned
      also when the thread leaves Guile mode.  Local SCM variables
      that have been created in Guile mode must not be modified while
      being in non-Guile mode.

      That is, you can imagine the stack of a thread to be partitioned
      into alternating Guile mode and non-Guile mode segements.  Only
      SCM references in the Guile segments are being found and they
      must remain constant.  (Requiring them to remain constant is no
      big constraint: threads shouldnot be manipulating SCM objects
      anyway when not being in Guile mode.)

    - When being in Guile mode, all the strange control flow things
      can happen, like exceptions, continuations, asyncs, etc.  Be
      prepared.  This can not happen in non-Guile mode.


I think this is reasonable and it is not necessary to make the GC more
preemptive and then remove the SCM_TICK requirement.  Such a SCM_TICK
is good for asyncs and amybe other things.  When a thread doesn't want
this, it should drop out of Guile mode.

(There are no functions for entering/leaving Guile mode yet...)

So the take-home point is probably that one should deal with whole SCM
objects whenever possible.  When peeking into smobs, care must be
taken, but not on a instruction-by-instruction level, but only from
libguile-function to libguile-function.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


      parent reply	other threads:[~2003-05-30 13:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21 23:15 doco scm_remember_upto_1 Kevin Ryde
2003-05-22  7:07 ` Rob Browning
2003-05-22  9:42   ` Marius Vollmer
2003-05-22 15:21     ` Rob Browning
2003-05-24  1:19       ` Kevin Ryde
2003-05-30  0:04         ` Kevin Ryde
2003-06-01 21:41           ` Marius Vollmer
2003-06-11 23:07             ` Kevin Ryde
2003-06-18 23:36               ` Marius Vollmer
2003-06-21 23:02                 ` Kevin Ryde
2003-07-27 14:49                   ` Marius Vollmer
2003-05-30 13:26       ` Marius Vollmer [this message]

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lj65nspnu8.fsf@troy.dt.e-technik.uni-dortmund.de \
    --to=marius.vollmer@uni-dortmund.de \
    --cc=guile-devel@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).