Tuesday, July 28, 2009

Why all operating systems writen in c language?

All operating systems are writen in c, but why not in java and other object oriented languages


can any one tell me.

Why all operating systems writen in c language?
They're not.





Perhaps since the advent of UNIX, it has become obvious that writing software in higher level languages makes for less debugging and more reliable code, but originally OSs were written in the assembler of the machine they ran on.





Believe it or not, most OS geeks think of "C" as a high level language. The fact that you can directly address all of memory and that it has a concept of interupt handling makes it an ideal candidate for portable OS code (consider that UNIX and later Linux now runs on virtually all hardware platforms).





Java specifically prevents you from directly accessing random memory. You can only address memory that Java has allocated to you in the form of objects. You can imagine writing a function that allowed java to directly access that memory ... but what would that function be written in? Probably C.





In fact, even version of the java engine I have seen was written in C or C++.





Way back when, the majority of programmers out there had experience with assemblers and C was such an advance that there was no reason to turn back.





By the way, the vast majority of OSs written in C still have a tiny bit of assembler associated with them associated with page handling and interupts.





In short C is the highest low level language, where you define "low level language" as one that can directly access memory by address instead of as an object. Alternately, you can say that C is high level language that has the advantage of being able to directly access memory by ... etc.





Problem is - the ability to talk about addresses instead of object handles makes it very easy to write bad code. And there is a LOT of bad C out there.
Reply:It is because C is a low level language. The only lower is ASM or direct machine language (which no one in their right mind would want to program in). Because C is low level, it is very fast and efficient. The same goes for C++. Java and other languages are high level and require an interpreter to run, which lowers their performance, although over the years Java's performance has been improved by quite a bit, but such languages will never be as fast as a low level language.
Reply:They aren't all written in C.





C is often a significant portion of the OS code base, because it's easier to use than Assembly Language and more efficient than higher level object oriented languages. C was originally designed as a system level programming language (unlike many of the higher-level languages such as Visual Basic or Java which were designed to interact with other applications, not hardware) and that makes it well suited for OS work.
Reply:Note that C was invented to write UNIX. On that time there does not exist higher level languages like C++ or Java!


Moreover when UNIX was being developed there does not exist anything on the earth that could be named as an OS!!





Every OS relies on system specific functions which must be writen in the assembly language of that machine. Kernighan and Ritchie invented C language as a universal assembly language to develope their UNIX under different hardware platforms.





OSes which are mostely written in VB!!!! are based on assembly functions. They are single platform OSes which are written only for IBM compatible machines. They are not important and are not comparable with UNIX.
Reply:Not all operating sysytems are written in c, windows 95 was written entirely in Visual Basic and on top of a DOS shell, so it's definately possible to write an entire OS in VB as well.
Reply:Because C is more powerful. You can do a lot more than java
Reply:do you mean ruby? the regular language? if that, then i guess it is the default language for a comp. you might b able to get it to write in java. i guess go to the local Geek Squad, Staples, or somthin like that.
Reply:Because c is one of the most efficient programming languages is one of the oldest but it's also one of the best languages with which you can write a programme. With c you can make any type of software and with Java it's limited.
Reply:Quote: "All operating systems are writen in c, but why not in java and other object oriented languages can any one tell me."





What utter Rubbish! It's an absurdley false statement. C is quite a new language as far as computing languages go. Many mainframe computers use operating systems written in Assembler for example. Even modern Operating systems use Assembler for a large chunk of the kernel as its far more compact and efficient.





ALL PCL controllers use embedded Assembler as the instruction language.





Various flavours of DOS were written using CPM and Basic, neither of which are C based languages.





---- edit--------------


Tarp - C is not a low level language, it's a high level language, any OOP language is high order as it requires an interpreter set in the kernel. Lower languages are the likes of COBOL and Fortran, Assembler and Machine languge.


No comments:

Post a Comment