runtime.js

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
iefserge
Posts: 3
Joined: Wed Jun 04, 2014 11:04 pm

runtime.js

Post by iefserge »

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).

Image

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. :)
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: runtime.js

Post by max »

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 :P
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: runtime.js

Post by AndrewAPrice »

This is awesome! Did you have any trouble porting V8 to bare metal? What challenges did you encounter?
My OS is Perception.
embryo

Re: runtime.js

Post by embryo »

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.
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...

How your OS manages interrupts? How it works with threads? How it delegates runtime to the drivers? How it manages memory?
iefserge wrote:- no heavy context switches
What does it mean?
iefserge wrote:- non-blocking asynchronous IPC
Is there any explanation of this statement?
iefserge wrote:- drivers and system services are implemented in JavaScript
Why not to do it in C++?
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.
Do you plan to develop the server by yourself or there is some ready made solution?
iefserge wrote:Unfortunately, I haven't had time
to write documentation so far. Tests are lacking too.
It's a common problem. But the lack of documentation raises all the questions above.
iefserge
Posts: 3
Joined: Wed Jun 04, 2014 11:04 pm

Re: runtime.js

Post by iefserge »

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 :P
Thanks.
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.
MessiahAndrw wrote:This is awesome! Did you have any trouble porting V8 to bare metal? What challenges did you encounter?
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.
embryo wrote:Well, we have a bit of OS that is used as a starter for a third party application.
Thank you for your interest.
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
embryo

Re: runtime.js

Post by embryo »

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 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.

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.
iefserge wrote:V8 is actually a library you can use to execute JavaScript code. It doesn't provide platform services programs need.
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.

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=============]
Post Reply