Monday, August 10, 2015

Why are all OS built by C, C++ etc.? Why not Java?

Because Java itself requires JVM to ensure platform independence. So, lets assume you code an OS using Java. Now, if you start thinking recursively, your OS requires JVM to run, JVM requires OS, OS requires JVM, JVM requires OS.. infinite mutual recursion.
System Stack Overflow! grin emoticon
On a serious note, Java is just not designed for system programming. C is more effective when you require direct interaction with the hardware and memory but Java doesn't allow interaction with hardware/memory. You will understand it even better if you get your hands dirty on some system programming with C/C++.
Even, OS can't be built 100% in Java but it can be built with the mixture of Java and C/C++. Just write some part of OS in C/C++ that would be sufficient to start the JVM then rest of the OS could be written in Java.
Examples of attempts at such an operating system include JavaOS, JOS,[2] JNode, and JX.

No comments:

Post a Comment