WIP: Begin reorganizing the kernel with kernel-space typescript fs#10
WIP: Begin reorganizing the kernel with kernel-space typescript fs#10ElvishJerricco wants to merge 10 commits intomasterfrom
Conversation
1ad25a4 to
ee2caa7
Compare
|
/cc @dfordivam |
711344e to
79830be
Compare
|
Of course, allocating a new SharedArrayBuffer on each syscall is a bad plan. So we should try to share one between syscalls until it needs to grow for whatever reason. Also, of course not all syscalls will want to jump out to the kernel. Memory allocation, for instance, still needs to be done in the user space. |
|
Ideally, the buffer underlying the webassembly memory would be our sharedarraybuffer, but wasm doesn't support that yet. |
|
Hmm just realized we need to get the data back also.. and currently there is no way to do that.. so will have to use SharedArrayBuffer Also as the kernel is now a separate worker, it would be able to handle incoming messages (like jsaddle JS). |
|
@dfordivam We are using the I'm not sure what you mean when you say "handler." The "process" (the worker executing the wasm) will be blocked on at most one syscall at a time, so the kernel can always |
|
As for postMessage we would definitely use the regular messaging style (no SharedBufferArray). My point was SharedBufferArray is only useful for the return messaging, for doing postMessage we dont need that. Regarding handler I meant that the sequence of syscalls should be |
|
I don't think we'll need any fancy JSON communication like that. Basically the only difference between operating on this As for interrupts: Well, we're not really considering interrupts yet :P But when we do, I think we'll just make it so that each syscall that blocks on the SharedArrayBuffer will just also respond to a special signal from the kernel that says "Hey this is a signal, not what you asked for." Then they'll enter a generic routine for signal handling. |
b275a21 to
b3d55d9
Compare
The plan here is to move all the syscall implementations into the kernel space. For each syscall the process makes to the kernel, it will
postMessageaSharedArrayBuffercontaining all the relevant information to the kernel, thenAtomics.waiton the buffer. The kernel will then do all the appropriate work andAtomics.wakethe process with results.To do all of this on nodejs, we can use the
worker_threadsmodule. It's experimental, but so is everything about WebGHC, so this doesn't bother me :PThis is WIP until the new kernel can actually run wasm programs.