wakish Posted March 7, 2006 Report Share Posted March 7, 2006 Hi everyone... Is linux entirely coded in C langauge?? Quote Link to comment Share on other sites More sharing options...
tyme Posted March 7, 2006 Report Share Posted March 7, 2006 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. Quote Link to comment Share on other sites More sharing options...
wakish Posted March 7, 2006 Author Report Share Posted March 7, 2006 Yeah, the linux kernel i meant. 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? Quote Link to comment Share on other sites More sharing options...
Qchem Posted March 7, 2006 Report Share Posted March 7, 2006 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! Quote Link to comment Share on other sites More sharing options...
wakish Posted March 7, 2006 Author Report Share Posted March 7, 2006 who says C++ is slower than C ?? anyways.. Quote Link to comment Share on other sites More sharing options...
tyme Posted March 7, 2006 Report Share Posted March 7, 2006 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. Quote Link to comment Share on other sites More sharing options...
Qchem Posted March 8, 2006 Report Share Posted March 8, 2006 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 Quote Link to comment Share on other sites More sharing options...
chalex20 Posted March 8, 2006 Report Share Posted March 8, 2006 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 :) Quote Link to comment Share on other sites More sharing options...
tyme Posted March 8, 2006 Report Share Posted March 8, 2006 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. Quote Link to comment Share on other sites More sharing options...
chalex20 Posted March 8, 2006 Report Share Posted March 8, 2006 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 ) Quote Link to comment Share on other sites More sharing options...
tyme Posted March 8, 2006 Report Share Posted March 8, 2006 so basically, you want to cause the entire programming community to implode? is that what you're going for? :P Quote Link to comment Share on other sites More sharing options...
wakish Posted March 9, 2006 Author Report Share Posted March 9, 2006 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.. is it? Quote Link to comment Share on other sites More sharing options...
Qchem Posted March 10, 2006 Report Share Posted March 10, 2006 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.. 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 Quote Link to comment Share on other sites More sharing options...
Gowator Posted March 10, 2006 Report Share Posted March 10, 2006 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. Quote Link to comment Share on other sites More sharing options...
phunni Posted March 10, 2006 Report Share Posted March 10, 2006 Hey! What's wrong with Java!? :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.