caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: Damien Doligez <damien.doligez@inria.fr>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] The Bytecode Interpreter...
Date: Sat, 29 Oct 2005 13:29:02 +0200	[thread overview]
Message-ID: <1130585342.15589.124.camel@localhost.localdomain> (raw)
In-Reply-To: <ad8cfe7e0510281441o779e5ed6g2a283d72ee078153@mail.gmail.com>

Am Samstag, den 29.10.2005, 10:41 +1300 schrieb Jonathan Roewen:
> Hi,
> 
> I have a question about the vmthreads package. I've been looking at
> the source of schedule.c, and am making a small understanding of how
> it works.
> 
> Is it true that this supports true pre-emption of threads (e.g. even
> during a GC cycle)? 

No. Preemption can only happen in the main loop of the bytecode
interpreter.

> Also, would it be safe to build an ISR framework
> that could wake up a thread waiting on an interrupt to be triggered?

The problem is you need realtime behaviour. That means your ISR thread
must have a higher priority than other threads, i.e. you need a
realtime-aware scheduler.

Second, also memory management must be realtime-aware. This is the
difficult part. How to handle the case when the interrupt occurs within
a GC cycle?

The minor GC is not the problem, because it is very fast, and has an
upper limit on the time spent in it.

Major GC: In principle, you can stop it at any time. You should probably
do so when the interrupt occurs. And then? The ISR must not allocate
memory in this case, because the memory manager cannot give it to you in
this moment (major GCs are triggered from minor GCs, so the minor heap
is currently full). It is very difficult to write ISR code that does not
allocate any memory. Maybe a way out is to have further minor heaps only
for this purpose (one heap per realtime thread), but this raises further
questions (how to get it empty again when the ISR is over? What to do if
it becomes full? What to do if you still need a major heap block?)

Compactification: I think this GC mode is totally incompatible with real
time. You cannot stop it, and it takes a very long time.

Gerd

> Like if I somehow got it to act like a file descriptor...
> 
> Jonathan
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Telefon: 06151/153855                  Telefax: 06151/997714
------------------------------------------------------------


  reply	other threads:[~2005-10-29 11:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21 10:01 Jonathan Roewen
2005-10-21 11:27 ` David MENTRE
2005-10-21 22:24   ` Jonathan Roewen
2005-10-21 23:49     ` Oliver Bandel
2005-10-22 21:33       ` Jonathan Roewen
2005-10-22  0:32     ` Jon Harrop
2005-10-22  0:39     ` Jacques Garrigue
2005-10-23  1:03   ` Jonathan Roewen
2005-10-23 10:21     ` Gerd Stolpmann
2005-10-24  5:38       ` Jonathan Roewen
2005-10-24  6:13         ` Jacques Garrigue
2005-10-24  6:48           ` Jonathan Roewen
2005-10-22  0:39 ` Jonathan Roewen
2005-10-26  0:33   ` Jonathan Roewen
2005-10-26  9:56 ` Jonathan Roewen
2005-10-26 10:20   ` Jonathan Roewen
2005-10-27 14:12   ` Damien Doligez
2005-10-28 21:41     ` Jonathan Roewen
2005-10-29 11:29       ` Gerd Stolpmann [this message]
2005-10-29 15:22         ` skaller
2005-10-30  0:41           ` Jonathan Roewen
2005-11-10 10:26         ` Damien Doligez

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=1130585342.15589.124.camel@localhost.localdomain \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=damien.doligez@inria.fr \
    --cc=jonathan.roewen@gmail.com \
    /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).