-13

Is the linux kernel or at least part of it been ported to JavaScript yet ? I want to program on linux kernel but don't want to use c.

5
  • 9
    yet - what makes you believe it will ever be? May 14, 2023 at 3:22
  • I wonder what happened to this user. Where we an ass, did they disappear never to be seen again. Was it even a bad question, or did we decide that we did not like the question, because the answer was obvious to us? Dec 13, 2023 at 10:57
  • 1
    It's a hammer question. If all you have is a hammer, everything looks like a nail. Don't be a wuss, get a better tool set!!
    – user10489
    Dec 13, 2023 at 14:08
  • 2
    I normally despise the idea of closing bad questions instead of just flagging them as out-of-scope or something, but I'm surprised this one hasn't been closed since it is so ridiculous if you know anything about programming languages. Dec 13, 2023 at 17:31
  • While the question is a bit ridiculous, I don't see it as out of scope. Sometimes a dumb question can trigger enlightening answers. Actually, a dumb question should always trigger en lightning answers, unless the answerer is too dumbfounded to figure out how.
    – user10489
    Dec 13, 2023 at 17:37

6 Answers 6

3

Javascript is not a systems programming language, it is not appropriate for a kernel.

Additionally, the kernel is a very large body of code, and "porting" it to another language is not something that can be done easily, and would likely take years if not decades. If the kernel is ever ported to another language, it would likely be rust, not javascript.

Actually, if you want to extend the linux kernel but not use C, rust is a valid alternative. The kernel already has rust interfaces. However, if you want to modify existing kernel code, you are stuck with C unless you want to rewrite entire sections in rust, and I'm not sure if arbitrary parts of the kernel are ready for that yet.

1

No, and it's not likely to be re-implemented in JavaScript. Who would do the work? What would be gained? In C, the kernel can be ported to almost any hardware (just write a code generator for Portable CC, and you're 99% there). Does JavaScript support pointers, bit banging, standardized subroutine calls, structures, etc? What could one accomplish in a JavaScript kernel that would be difficult in the C kernel. How hard is it to write small, efficient code in JavaScript? How about Loadable Kernel Modules, device drivers, etc.

1

Consider parts of the OS, that are not the kernel. A lot of the OS is written in other languages. The kernel called Linux is just a small part of the system.

1

“I want to program on linux kernel but don't want to use c”

Consider Rust

If you really need to be adding code to the kernel, if you are not confusing Gnu etc with Linux, then

You can now create kernel modules in Rust.

-1

The Linux kernel will probably never be ported to JavaScript, but you can actually cross-compile the kernel with Emscripten, which is exactly what LKL.js does.

-1

Yes: sort of. see https://retrage.github.io/lkl-js/ It looks like it is a kernel replacement written in java-script.


This answer summarises the first answer given on this post. But instead of saying No It says Yes.

1
  • Interesting. Note however, that the webpage there says it is completely useless. And this doesn't really port the kernel, it compiles it to web assembly. You won't be able to write javascript code for the kernel or read javascript kernel code with this. Interesting demo though!!
    – user10489
    Dec 13, 2023 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .