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

Re: exception systems

    From: Matthias Blume <blume@cs.princeton.edu>
    It would perhaps be a good idea to look at John Reppy's interrupt
    handling mechanism for SML/NJ.  It is based on continuations.  This
    way one can easily build context-switch on top of it (which is what he
    needed it for -- because he wanted to use it for CML), but it is
    almost trivial to write a signal handler that raises an exception
    should this be the desired effect.

My take on async signals, such as clock timers and so forth, is that
they shouldn't necessarily be presented in terms of a premptive
mechanism like interrupts. This commits you to a serial implementation,
since preemption implies mutex -- when the handler is running, the
main thread is not.

In a multi-threaded model, you can afford to let threads block and
synchronously wait for signals from other agents. I find this to
be a much more appealing model.

You can always *implement* it, on a serial machine, with preemptive
interrupts. But you can *also* implement it, on a multiprocessor,
with a parallel implementation. This is good.

Models shouldn't capture details that are restrictive to a particular
implementation. Interrupts are a bad model.