Re: why only C?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 04 April 2011 01:19 AM, Bernd Petrovitsch wrote:
Hi!

On Mon, 2011-04-04 at 00:47 +0530, mohit verma wrote: [....] 
  
As far as i can decipher , we impose Object oriented paradigm in
kernel space using C  : like using gates to allow only one way entry
and binding functions to structures in a OOP fashion  and trying to
make them private to that structure only  , encapsulation of one
struct into another structure (and lots of features ) and itself  lots
of kernel subsystem supports like driver interface and blah blah
behaving like **objects** .......
    
OOP is a design issue independent of the used programming language. So
you actually *can* do OOP with C (or assembler or ....) and I have seen
C++ programs which do not employ the ideas behind OOP.

  
why dont we use some fully OOPs supportive language like JAVA or
partial supportive language like  C++ to construct Linux Kernel????
    
What does it buy and what does it cost?

For - or more against - Java: You really do not want an OS to use an
interpreted "language". That kills performance. And the more interesting
challenge is to implement hardware IRQ handlers in Java.
  
JVM has been optimised to such a level that it beats C++ in performance. Only thing faster than that is C and assembly language. A few chips process Java byte code at hardware level as well. 
Read this http://en.wikipedia.org/wiki/Jazelle   ... So this can't be a valid argument.

The key thing over here is purpose. OOP based languages are essentially meant to abstract the developers from the hassles of  low level operations (Assuming a programmer well versed with OOP) , so the focus is on application development. Java plays an important role in isolating low level hardware issues. That's why you have Java as a proffered choice for mobile apps and not C.
If you are developing kernel, you are programming bare metal. You have to do low level operations like loading the program into the memory, defining it's data segment, code segment, etc. Hence C is the obvious choice since it's the closest to the hardware (meaning simple to deal low level operations) and well structured than assembly language.

C++ has lots of features which make it awkward to use. For starters,
think about the fact that Java does not have multiple inheritance.

  
I don't  think that performance is the main reason behind all this .
Is it??
    
Did you google for it and read the links etc.?
You will find much more on this question.

Bernd
  


--
Cheers !!!
Chaitannya

follow me on twitter http://twitter.com/chaitannya

I believe there's a hero in all of us
who keeps us honest, gives us strength, makes us noble, and finally allows us to die with pride,
even though sometimes we have to be steady, and give up the thing we want the most... even our dreams.
- Spider Man 2
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux