MessiahAndrw wrote:When I started this thread, I wasn't thinking about porting a browser environment (including HTML and WebGL) into your kernel. Instead, I was thinking about the possibility of using WebAssembly as your OS's bytecode format for distributing applications in.
At the very least, this would require implementing a WebAssembly VM/interpreter into your kernel, so you can run WebAssembly on bare metal.
A WebAssembly module is associated with a table of symbols it imports (your system calls) and exports (e.g. 'main', but you could have other entry points such as handlers). I'm fascinated with the idea of implementing the same set of the system calls in both a bare metal kernel, and inside of a web page. Then the same program, distributed in WebAssembly bytecode could run on both your kernel and in a browser, as long as they shared the same ABI.
I misunderstood. I had the idea of adapting the OS to run web app APIs natively (although not entirely in the kernel, not in browser either when run locally, and with additional extensions where necessary.) Your vision is to adapt the browser APIs by bridging with javascript code that emulates your OS execution environment.
MessiahAndrw wrote:I mentioned Canvases, not because I'd want to reimplement the Canvas spec in my bare metal kernel, but because web modern browsers provide a bitmaprenderer Canvas context, so you could display the pixels your low-level graphics API is pumping out. (The syscalls for a higher level graphics API could take advantage of hardware acceleration in the browser such as WebGL.)
This could work for some applications, although I don't think that a multimedia player with built-in codecs could be run this way. For this to happen, the browser must have really slick JIT that converts canvas buffer accesses into raw memory transfers to get reasonable performance. Not to mention the lack of YCbCr (to my knowledge.) On other hand, a player that relies on system codecs could run using html5 video.
MessiahAndrw wrote:I mentioned Web Workers, not because I'd want to reimplement Web Workers in my bare metal kernel, but because Web Workers would provide a way to implement multi-threading and process isolation inside the browser.
Do they offer means of communication and synchronization comparable to kernel threading?
MessiahAndrw wrote:You could implement your filesystem IO syscalls around IndexedDB inside of a browser.
You could use that, or WebDav, or cloud storage (although I think they are object based, not block based), but there will be limitations. For example, an image viewer will need to open image files. Would those come from the web?
MessiahAndrw wrote:Web Audio gives you an audio buffer you can write into.
Same as with the Canvas APIs, but with less performance impact. I can see how this could work for things like games, or uncompressed audio editors.
MessiahAndrw wrote:The dream for me is to be in a state where I have an app store, and I can share you a link to a program I wrote in C++, you can click "Run", and the program near-immediately runs inside of the browser, and the binary is identical to what you could download and run off a disk on my bare metal kernel.
This is not a bad marketing move, but it will emphasize the application, not the OS. To turn this into advantage, you will have to show superior application quality and availability compared to other OSes, or you would have demonstrated that the browser can run an application that the user already has on their desktop. On the other hand, I think that just making the relevant C and JS libraries might turn into a meaningful product in itself (OS aside), because software companies sometimes try to provide a taster of their application on their web page by rather primitive means. This will make their online demos realistic. You might then offer cloud storage integration and this will turn your infrastructure into a portability solution for applications that run standalone natively and as a web service. I know this is not what you have in mind, but just saying - there might be demand there.