[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interrupting a running jitter program

From: Luca Saiu
Subject: Re: Interrupting a running jitter program
Date: Fri, 29 Nov 2019 20:24:22 +0100
User-agent: Gnus (Gnus v5.13), GNU Emacs 27.0.50, x86_64-pc-linux-gnu

Hello José.

On 2019-11-29 at 20:01 +0100, Jose E. Marchesi wrote:

> In poke we have a SIGINT handler for the repl.  However, we would like
> to be able to stop a running PVM program using Ctrl-C.
> It follows we would need a way for Jitter to check for a global every N
> instructions, and call 'exitvm' with an error state when the global
> indicates the program shall be terminated.
> Does Jitter support something like this?
> Would it be possible to add it?

No, but of course it is a desirable feature.

I am happy that you are formulating the problem in terms of safe points,
which is the right approach.  Interrupting a VM program with a signal
would be messy, and I do not plan to ever support that; however a signal
handler can set a global and return.

An easy solution for this should be:

a) inserting a check before branches going backwards, and at the
beginning of every procedure.

b) checking after blocking library calls which can be interrupted by a
signal.  Right before a blocking library call such as getc, readline or
recv the VM program should set a thread-local flag (the entire state
runtime is thread-local), and then unset it if after the library call is
done if it has not been interrupted.

I have never done b) and maybe not a) either, but I am very interested.
This mechanism is also useful for concurrent garbage collection.  (My
concurrent GC was interruptable at every place, with no explicit
safepoints -- which in retrospect was a bad idea: a very complicated and
fragile solution.)

I am a little worried about the performance impact of a).

I will try and do something right now.  Coming in IRC.

Luca Saiu
* My personal web site:  http://ageinghacker.net
* GNU epsilon:           http://www.gnu.org/software/epsilon
* Jitter:                http://ageinghacker.net/projects/jitter

I support everyone's freedom of mocking any opinion or belief, no
matter how deeply held, with open disrespect and the same unrelented
enthusiasm of a toddler who has just learned the word "poo".

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]