Skip to content

Pre-proposal: Interrupt handling #1446

Open

Description

@DemiMarie

This might sound rather strange, and possibly ill-suited to WebAssembly, but I could imagine certain embedders actually wanting to support it. Browsers probably wouldn’t.

The basic idea is to provide a way to handle a callback from an embedder that may happen at any CPU (not WebAssembly!) instruction boundary. The classic examples of this are hardware interrupts and Unix signals.

Activity

  1. sbc100 commented on Mar 25, 2022

    @sbc100
    Member

    This came up recently on an issue in the WASI repo it was mentioned that linux has signalfd(): https://man7.org/linux/man-pages/man2/signalfd.2.html. How many of the use cases you have in mind do you think could be handled adding something like that at the WASI level? It avoids the whole preemption issue, and allows application to effectively poll/wait for signal events.

  2. DemiMarie commented on Mar 25, 2022

    @DemiMarie
    Author

    This came up recently on an issue in the WASI repo it was mentioned that linux has signalfd(): https://man7.org/linux/man-pages/man2/signalfd.2.html. How many of the use cases you have in mind do you think could be handled adding something like that at the WASI level? It avoids the whole preemption issue, and allows application to effectively poll/wait for signal events.

    signalfd() on Linux, and EVFILT_SIGNAL on the BSDs, are a much better solution for Unix signals. I suspect illumos event ports also have a mechanism for this, and if nothing else the self-pipe trick works on all Unix systems. That isn’t sufficient for preemption, though, and there are actually applications that want that (usually for context switching). Go, for example, switched from cooperative to preemptive goroutine scheduling.

  3. sbc100 commented on Mar 25, 2022

    @sbc100
    Member
  4. frank-dspeed commented on Aug 15, 2022

    @frank-dspeed

    @sbc100 good point and i agree and Fuchsia OS as a whole does also use that with good results. in Fuchsia there are Only Jobs/Tasks and Processes. Overall my experience with that scheduling is well

  5. RossTate commented on Dec 12, 2022

    @RossTate

    There's some discussion related to this issue in #1459 (comment) and preceding comments.

  6. DemiMarie commented on Dec 13, 2022

    @DemiMarie
    Author

    @RossTate I am not sure if those approaches would be sufficient for this pre-proposal, which is mostly aimed at OS kernels and embedded systems. In this case it may be necessary to do something in the interrupt, such as acknowledge it so that the hardware deasserts the interrupt line (assuming level-triggered interrupts).

  7. RossTate commented on Dec 13, 2022

    @RossTate

    Sorry, didn't mean to imply they solved the problem! Just pointing to some challenges on both specifying and implementing a related problem, in case it offered some shortcuts.

  8. frank-dspeed commented on Dec 15, 2022

    @frank-dspeed

    the gc linear memory root marking is interesting for wasm i already run net wide memory grids in the browser based on concept of persistent loaded memory and throwing away like gc what is not loaded i designed a new kind of ffi to make that hapen where i do not do ffi i throw in a empty context and use it like shared memory let the function do its thing on the context directly so like working with handels and do not transfer data that leads to a net wide in memory grid program able via import export operators in ECMAScript i call that web 4.0 as it does not need html

  9. frank-dspeed commented on Dec 16, 2022

    @frank-dspeed

    My final conclusion is this should not get added we should use Streams over a file handle if we want to link directly from linux or a posix compatible signal i did check the current state of posix signals in a variation of kernel implementations mainly the compat between linux bsd mach(macos) (iridium win11) it makes no sense to take the signals as given by default wasm does not run on a posix environment by default.

    Streams do solve efficient wait locking mutex futex stuff in a nice way you do not even need code any logic for that.

  10. DemiMarie commented on Dec 16, 2022

    @DemiMarie
    Author

    @frank-dspeed: I agree when it comes to signal handling, but this does not work for preemptive context switching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions