Jump to content

Linux is coded in which languages?


wakish
 Share

Recommended Posts

depends on what you mean by "linux". if you're talking about the kernel, I found this on the wikipedia linux kernel page:

It is written almost entirely in C with some GNU C language extensions, along with snippets of assembly language (in the GNU Assembler's "AT&T-style" syntax).

 

All the software on top of that runs in a variety of languages...java, c++, perl, python, etc.

Link to comment
Share on other sites

But has anyone re-written the kernel in other languages other than C/assembly, like in C++ or Java??

Or is the kernel being just updated and customized as it is?

 

Why would you want to do that? It would become much slower!

Link to comment
Share on other sites

You would not want to use Java for the kernel since it is an interpreted language, not a compiled language. you would have to load the java vm before booting the kernel which you can't really do without having a kernel booted...

 

C++ is largely an improvement of C, and for the most part you could compile a C program as C++ (there may be a few issues); so really "rewriting" the kernel in C++ would be a complete and utter waste of time.

Link to comment
Share on other sites

who says C++ is slower than C ??

anyways..

 

Of course the generality of this statement is going to depend on the skill of the programmer and the problem they are trying to solve, but you can read more about it here:

 

http://www.eventhelix.com/RealtimeMantra/b...Performance.htm

 

http://www.eventhelix.com/RealtimeMantra/b...erformance2.htm

Link to comment
Share on other sites

You would not want to use Java for the kernel since it is an interpreted language, not a compiled language. you would have to load the java vm before booting the kernel which you can't really do without having a kernel booted...

From purely theoretical point of view, (mostly) Java-based kernel is possible. Build some minimal kernel including Java VM, in C, write all the rest in Java, boot the minimal kernel, load all the rest and let it crawl along :) Bootstrapping at its best :)

Link to comment
Share on other sites

but obviously it wouldn't be a purely java kernel ;). it's not a practical way of going about it, was my main point. i can't imagine anyone doing it except as a proof-of-concept.

Link to comment
Share on other sites

but obviously it wouldn't be a purely java kernel ;). it's not a practical way of going about it, was my main point. i can't imagine anyone doing it except as a proof-of-concept.

Let's go even further :) This minimalistic bootstrapping part may actually replace BIOS, so the kernel would be pure Java ( heaven forbid :wall:)

Link to comment
Share on other sites

Thanks for the links Qchem!

 

 

Yeah, i get your point tyme.

So, if i got it well, it goes something like this:

while there are several possibilities in coding, programmers most of the time choose the most "suited" and "appropriate" language based on what they actually want to achieve.

So despite C++ or Java may be possible to use, the most suited one is actually C (which is close to the power of assembly)

 

Hey but just imagine the kernel was purely with assembly...would the kernel be much more powerful?

but yeah, in practice, this is a tiresome work.. :wall: is it?

Link to comment
Share on other sites

Hey but just imagine the kernel was purely with assembly...would the kernel be much more powerful?

but yeah, in practice, this is a tiresome work.. :wall: is it?

 

It depends what you mean by more powerful. If it was written well in assembler then the code would probably run faster. Assembler isn't really suited to re-writing the whole Linux codebase though, and adding new features etc would be a very difficult task. In short, it's not worth it.

 

Now, if you were suggesting a re-write in Fortran, thats something I would support..... (j/k) :P

Link to comment
Share on other sites

You would not want to use Java for the kernel since it is an interpreted language, not a compiled language. you would have to load the java vm before booting the kernel which you can't really do without having a kernel booted...

 

C++ is largely an improvement of C, and for the most part you could compile a C program as C++ (there may be a few issues); so really "rewriting" the kernel in C++ would be a complete and utter waste of time.

The point is I think the additional baggage of the C++ libs would not be needed because its purely the kernel.

 

The Java VM might be nice wih a dedicated Java EPROM or direct on chip suppot for native Java... I think this is used in some embedded devices and the linux embedded devices site would be a good place to start looking for anyone interested.

 

So despite C++ or Java may be possible to use, the most suited one is actually C (which is close to the power of assembly)

Its also important because its a collective effort and minimising libraries. If one developer starts using C++ libs then everyone would need to and the kernel size would increase whereby most developers will continue using only the C libs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...