streamich / jskernel

Node.js exo-kernel dream - proposal
47 stars 8 forks source link

A few questions #2

Closed austinfrey closed 7 years ago

austinfrey commented 7 years ago

Just trying to wrap my head around what this project does. Am I correct in thinking that parts of this project libjs, libaio, libsys etc. is to replace the C++/V8 dependencies from Node.js? Can some of these modules be dropped into Node currently? Meaning could I use your fs library written in JS, in Node right now?

When you use the term exokernel, are you using it interchangeably with unikernel? Would i need to use en emulator or some sort of virtualization to run jskernel?

Sorry for the n00b questions :/

streamich commented 7 years ago

Am I correct in thinking that parts of this project libjs, libaio, libsys etc. is to replace the C++/V8 dependencies from Node.js?

Yes, I am planing to rewrite all C/C++ parts, so no C/C++ dependencies, plus, you will be able to run it on any JS runtime. Even in browser (if you emulate UNIX system calls). So, it won't replace just C++/V8/Node.js dependencies, but also libc and libuv.

Can some of these modules be dropped into Node currently? Meaning could I use your fs library written in JS, in Node right now?

Yes, you can use fs module already here it is here it is, note that it dependends on libjs, which is a wrapper around system calls. In turn, libjs (you can find it here) has a single dependency process.syscall function, which your JavaScript environment has to provide. For Node.js, libsys package implements the syscall function, you can simply attach it to process global, like so.

(Actually, there is also an asynchronous syscall function process.asyscall, used for asynchronous file system operations, but that is a separate topic of its own. For a toy project, you can just create a fake one from the synchronous process.syscall.)

See this for fs module status.

When you use the term exokernel, are you using it interchangeably with unikernel?

I use it very vaguely as JS running in kernel space, but it is long way to there yet...

Would i need to use en emulator or some sort of virtualization to run jskernel?

When it is ready, I imagine it would be Linux + JS runtime + jskernel (FULL.js).

Eventually, though JS runtime that emits machine code can be itself written in JS and one of the reasons to run it in kernel space is of course to write some hardware stuff in JS, i.e. parts of Linux kernel.

So, in the very distant future I imagine it will be just JS running on bare metal.

austinfrey commented 7 years ago

@streamich thanks for the information. Are you still planning on using an interpreter or compiler written in C/C++ or are you planning on writing the engine in Javascript too? Reading through the various README's it looks like that's what your F1 project is supposed to be. So it could look like linux + F1 runtime + jskernel ?

streamich commented 7 years ago

Yes, but F1 is long way to go, first there is still a lot to do to get the first version of jskernel out.