emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.91k stars 3.32k forks source link

Advice on semi-blocking implementation of fork / vfork / exec / system calls #13239

Open vadimkantorov opened 3 years ago

vadimkantorov commented 3 years ago

I saw approaches that running processes as workers. Is there a modern advice/recipes on how to do this? e.g. sometimes an always-parent-blocking call is okay and useful (as if we have a single-user machine without time-sharing betweeen processes). The goal would be to run busybox ash shell with some support of pipes and external commands.

E.g. what would be nice is some advice / easy hooks for implementing various kinds of process emulation. E.g. Module.execve call that the user could override in JavaScript

sbc100 commented 3 years ago

I think these guys are probably doing the closest thing to what you want: https://browsix.org/. Maybe they have some tools you can re-use?

Emscripten has pretty good support for blocking calls on workers today via proxying calls back to the main thread. The bigger thing we lack is any kind of multi-process support whatsoever. Anything to do with IPC or more than one module in the same JavaScript instance you would need to roll yourself. At least that is the state of play today.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.