OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 12:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: runtime.js
PostPosted: Sat Jun 07, 2014 4:49 pm 
Offline

Joined: Wed Jun 04, 2014 11:04 pm
Posts: 3
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. :)


Top
 Profile  
 
 Post subject: Re: runtime.js
PostPosted: Sat Jun 07, 2014 4:58 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
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

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: runtime.js
PostPosted: Sat Jun 07, 2014 6:44 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
This is awesome! Did you have any trouble porting V8 to bare metal? What challenges did you encounter?

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: runtime.js
PostPosted: Sun Jun 08, 2014 3:11 am 
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.


Top
  
 
 Post subject: Re: runtime.js
PostPosted: Sun Jun 08, 2014 5:11 am 
Offline

Joined: Wed Jun 04, 2014 11:04 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: runtime.js
PostPosted: Mon Jun 09, 2014 5:06 am 
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:
[==========JavaScript code==========]
       ^           ^
       v           v
[=============V8 engine=============]
       ^                   ^
       v                   v
[==Exposure API======Support API====]
                   ^
                   v
[=============Actual OS=============]


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group