Hi! I've just released the first version (0.0.1-alpha) of my kernel.
runtime.js is a kernel built on V8 JavaScript engine. It uses event-driven and non-blocking I/O model inspired by Node.js.
I ported V8 engine and wrote simple keyboard and VGA display drivers in JavaScript.
System boots into JavaScript REPL application
(you can use F1-F4 to switch consoles).
Some technical details:
- supported x86_64 only
- software isolated applications (processes)
- no heavy context switches, single address space
- does not use cpu protection rings
- non-blocking asynchronous IPC
- drivers and system services are implemented in JavaScript
- written in C++11
It's available on GitHub https://github.com/runtimejs/runtime
You can download prebuilt binaries to try it in QEMU from releases page
https://github.com/runtimejs/runtime/releases
It's probably very unstable, but runs fine on my desktop.
Currently it's pretty much useless, but I'm planning to implement simple network stack and
some ethernet driver. I'd like to host a JavaScript web server on it someday.
If you want to contribute, your help is very welcome. Unfortunately, I haven't had time
to write documentation so far. Tests are lacking too.
Thank you. If anyone interested, I'd like some feedback on this please.
runtime.js
- max
- Member
- Posts: 616
- Joined: Mon Mar 05, 2012 11:23 am
- Libera.chat IRC: maxdev
- Location: Germany
- Contact:
Re: runtime.js
Really nice work. The model is very similar to the first version of my kernel, with a virtual machine running Java, also all in a single address space. How are you planning to do security-related things?
embryo will be interested in this, too
embryo will be interested in this, too
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: runtime.js
This is awesome! Did you have any trouble porting V8 to bare metal? What challenges did you encounter?
My OS is Perception.
Re: runtime.js
Well, we have a bit of OS that is used as a starter for a third party application. But what do we know about the actual OS? It uses something inspired by another thing...iefserge wrote:runtime.js is a kernel built on V8 JavaScript engine. It uses event-driven and non-blocking I/O model inspired by Node.js.
I ported V8 engine and wrote simple keyboard and VGA display drivers in JavaScript.
How your OS manages interrupts? How it works with threads? How it delegates runtime to the drivers? How it manages memory?
What does it mean?iefserge wrote:- no heavy context switches
Is there any explanation of this statement?iefserge wrote:- non-blocking asynchronous IPC
Why not to do it in C++?iefserge wrote:- drivers and system services are implemented in JavaScript
Do you plan to develop the server by yourself or there is some ready made solution?iefserge wrote:Currently it's pretty much useless, but I'm planning to implement simple network stack and some ethernet driver. I'd like to host a JavaScript web server on it someday.
It's a common problem. But the lack of documentation raises all the questions above.iefserge wrote:Unfortunately, I haven't had time
to write documentation so far. Tests are lacking too.
Re: runtime.js
Thanks.max wrote:Really nice work. The model is very similar to the first version of my kernel, with a virtual machine running Java, also all in a single address space. How are you planning to do security-related things?
embryo will be interested in this, too
I'm planning to remove global system functions and pass resources program needs in arguments (I use JS object instead of string). This way it's possible to provide completely isolated environment for every app.
I have JavaScript objects which represent resources like IRQ, IRQRange, MemoryBlock, IORange, IO port, ProcessManager.
For example IRQRange object provides access to IRQ1-IRQ16, MemoryBlock to physical memory at 0xb8000, etc.
What's interesting you can pass regular JavaScript function to other program through arguments too. And it will do IPC when called and return Promise object.
Thanks. I think the biggest problem so far was to correctly set up local storage V8 uses extensively. And this is required to support multitasking with multiple contexts.MessiahAndrw wrote:This is awesome! Did you have any trouble porting V8 to bare metal? What challenges did you encounter?
Thank you for your interest.embryo wrote:Well, we have a bit of OS that is used as a starter for a third party application.
V8 is actually a library you can use to execute JavaScript code. It doesn't provide platform services programs need. For example there is no setTimeout function provided by engine. Kernel itself provides services V8 needs to run, and environment for user apps.
As for implementation of different kernel subsystems, I'm planning to write docs. But I can't say for sure when it will be available.
As for web server, no solution here yet.
- Serge
Re: runtime.js
But it's just the thing every application with API have. Anyone wishing to expose something will make some interfacing means. You have to expose your system internals and, of course, following the need for interfaces, you have created some implementation.iefserge wrote:I have JavaScript objects which represent resources like IRQ, IRQRange, MemoryBlock, IORange, IO port, ProcessManager.
For example IRQRange object provides access to IRQ1-IRQ16, MemoryBlock to physical memory at 0xb8000, etc.
But where is the OS? We see it's interfaces only. It's like a way the Windows goes - here are our API and do not ask us for more.
Yes, porting something means implementing interfaces, required by the something. We can see it as a port initiated communication, which requires some port API to be implemented. But again - there is little about OS.iefserge wrote:V8 is actually a library you can use to execute JavaScript code. It doesn't provide platform services programs need.
However, we know that your OS has defined some API to expose it's internals and has some additional API implemented in order to be able to support V8 port. Exposing part of API uses JavaScript objects to transfer some data to a consumer and implements some callbacks in form of JavaScript functions. The v8 supporting part, of course, implements just what the v8 requires.
It looks like this (there's no monospace font and picture looks a bit skewed, but close to what I mean):
Code: Select all
[==========JavaScript code==========]
^ ^
v v
[=============V8 engine=============]
^ ^
v v
[==Exposure API======Support API====]
^
v
[=============Actual OS=============]