File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why there is no Os built based on java

 
raj talatam
Ranch Hand
Posts: 92
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Every one,

when i was studying B.Tech i got a doubt, when i was in my first year ,we learned C basics,
when i was in 3 rd year we learned java, They said , there are many, disadvantages with c,
for Pointers, memory leaks etc, so these are eliminated in java.

Then why every operating system is built based on C, Not in java,
By using java we can write more flexible OS right..
 
Greg Brannon
Bartender
Posts: 563
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java .class files run on the JVM which is dependent on / tailored to the host machine's OS. Without an existing OS, there is nothing to 'run' the JVM. Without a JVM, there is no ability to run a Java program. It's one of those layer cake diagrams that show the host OS the largest bottom layer, the next layer partially covering would be the JVM, and the topmost, smallest layer the Java application. That's a required construct for the Java language that can't be turned upside down.

And not all C problems were entirely eliminated in Java. The designers did their best to mitigate or minimize many C issues, continuing to improve the language to this day, but it's not perfect - yet.
 
Winston Gutkowski
Bartender
Pie
Posts: 9497
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raj talatam wrote:Then why every operating system is built based on C, Not in java,
By using java we can write more flexible OS right..

Actually, I believe there are devices - particularly small hand-held ones like phones - that pretty much tie the JVM directly to the OS, or even have the JVM burnt into a chip; but I couldn't swear to it. And in such a case it would be the JVM that is acting like an OS, not the Java language.

The fact is that the two things - an OS and Java - perform completely different functions. The business of Java is to allow us to write programs that are OS-independent; the business of an OS is...well...to be dependent - to communicate directly with the devices and memory and processors and filsystems used by a particular machine.

Like Greg says, it's a chicken and egg situation.

Winston
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raj talatam wrote:Every operating system is built based on C, Not in java,By using java we can write more flexible OS right..


I don't think this statement is true. In the past, for example, the DEC VMS operating system was written not in C but in Bliss. Multics, which was an early operating system was written in PL/1. Multics was so important in the history of computer science that Unix was named after it. Apple's OS-X is written in Objective-C, which has object-oriented characteristics. IOS is also written in Objective-C

For the past 20 years, design theory behind operating systems has moved away from flexibility in the OS itself. Rather, the OS is small and fast and robust. Everything that can be is removed from the operating system and placed into user-mode programs.

Java is great for these user mode programs. On Android, nearly all user mode programs are written in Java, or at least run on the Java JVM.
 
Naishadh Parmar
Ranch Hand
Posts: 95
C++ Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yeah you are right all OS that run on a PC are written in C. Because C works faster than Java. Nobody can doubt that

And there are mobile OS based on Java----- Blackberry OS, Android (Its core is based on C but display is based on Java, and all apps are written in Java)

And as Greg rightly pointed that Java programs need a JVM to run. This is possible on mobile phones. So mobile phones can run OS based on java
 
Campbell Ritchie
Sheriff
Pie
Posts: 47299
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naishadh Parmar wrote: . . . Because C works faster than Java. Nobody can doubt that . . .
I most certainly doubt that. Java is faster than C in some instances. Much faster.

The reason for using C is that C allows one directly at access memory locations (via pointers) and probably also to use assembly language.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naishadh Parmar wrote:And as Greg rightly pointed that Java programs need a JVM to run. This is possible on mobile phones. So mobile phones can run OS based on java

I would argue that neither the Android OS nor the JME OS is based on Java, but on native code. Only the applications are written in Java, not the OS. With the same right you could run only Java desktops apps on your PC - that doesn't make the OS Java-based, either. (And all this is disregarding that Android apps can be written in C as well as Java.)
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naishadh Parmar wrote:Yeah you are right all OS that run on a PC are written in C. Because C works faster than Java. Nobody can doubt that


nope. OS-X is not in C.
All the rest were written in C because they started writing them, Java didn't exist.

The "c is faster than java" claim is simply not supported by facts.

That C makes it easier to get directly to registers, interrupt vectors, etc. is true. You need a language such as C, Bliss, GO, etc. that can easily handle that stuff.
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C is a systems programing language, and thus well-suited for writing operating systems. Java is an applications programing language, which fixed many of the problems developers had when using C for application programing. C++ also attempted to modify C into an application programing language, but just ended up creating an ugly hybrid. C is still the undisputed king in systems programing, and regularly battles Java for the most popular development language. They have different focuses.

 
Naishadh Parmar
Ranch Hand
Posts: 95
C++ Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry everyone,
Thanks for enlightening me on this issue.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to apologize! It was a good question and a good set of replies too.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Application Programming, You need to concentrate on the business logic.
Common things like, Memory References, and Memory management can be put out of developer hand.

But, On the other hand,
Operating system does lot of complex things, which are not feasible to write them in Java.
Even, Most of the Runtime's like JVM, or GC of OS X needs to be written in C.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic