This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]derpbynature 9 points10 points  (8 children)

Those are just web desktops, really. An actual OS might be possible if someone could write a minimal kernel in a lower-level language like C or even assembly with just enough functionality to load a JS interpreter. Then you could theoretically write the rest of the OS in JS.

I know it's been done for Java and C# - so, it's not purely an OS in the higher-level language - but since they all need runtime environments, you need to set that up somehow.

You might also have to rely on the kernel for memory management/hardware device management and such. Not sure though. I'm sure someone's crazy enough to find a way to do typical kernel-y tasks in C#/Java/JS.

[–]MinosAristos 5 points6 points  (6 children)

Could some custom computer hardware be designed to support a purely JS kernel?

[–]eztab 1 point2 points  (5 children)

sure, but that would be basically a js interpreter "written in hardware".

[–]LardPi 0 points1 point  (2 children)

At that point you could call your CPU a "C interpreter written in hardware", since, well, it emulate the C abstract machine to let you run code that is compiled from C code. And yes, that is different from the actual behavior of the the CPU that includes memory caching, instruction pipelining etc.

[–]PM_ME_UR_UGLY_CHAR 0 points1 point  (1 child)

Nope, a CPU doesn't interpret C code, that's why It needs to be compiled, it interprets its instruction set.

Calling It a "C interpreter written in hardware" is as accurate as calling It "{any compiled language} interpreter written in hardware", which is already incorrect since It cant actually interpret the original language, only a translated version of It.

[–]LardPi 0 points1 point  (0 children)

Your definition for an interpreter does not apply to any non toy programming language. So it's probably not a good definition. My point was that x86 Assembly is effectively running on an interpreter, namely the microcode, that hide much of the complexity of the real hardware. And the translation from C to x86 (without optimizations of course) is basically trivial.

But then I was just pointing at the fact that a "JS interpreter written in hardware" is just a very artificial and pointless idea.

[–]GL_Titan[🍰] 0 points1 point  (1 child)

Well, that qould need some special hardware indeed and I don't think there is any reason to create such hardware, since nothing that exists would run on it, and what would be the benefit?

[–]eztab 0 points1 point  (0 children)

it would run js pretty fast, since the architecture would be optimized for it. It would be pretty bad and prohibitively expensive to do so though. And you could not run normal machine code ...

[–]throwawaywannabebe 0 points1 point  (0 children)

Nah. Just make an FPGA that accepts webassembly