Page 1 of 1

ObjC kernel

Posted: Thu Mar 09, 2006 1:41 am
by llama-X
I've read the section in the FAQ and I'm wondering if anyone here has any knowlege as to whether or not a microkernel written in Objective-C would outperform one written in C++? ObjC is a much more elegant (read: Smalltalk-inspired) language than C++ and thus I'm thinking it will make for a much cleaner codebase, but I'm not sure how well it will perform on bare hardware. I know Apple and NeXT used it a lot, but was the NeXTSTEP kernel written in ObjC or in C?

Any input is greatly appreciated.

Re:ObjC kernel

Posted: Thu Mar 09, 2006 2:24 am
by Solar
You can't really make any claim for performance solely based on the language (at least as long as you're playing in the general ballpark of ASM / C / ObjC / C++). It very much depends on what features of the language you're going to use, and how good the coders understand the "hidden costs" of C++ / ObjC.

For example, the cost of exceptions. You could omit them completely from your C++ code (--no-exceptions), or you could chose between two or more "implementation styles". Then it's still a matter of how you use them.

I guess it's the same with many of the ObjC features: Just because they're there you don't have to use them, and even if you use them, a good coder will use them efficiently and a bad coder will waste clock cycles.

A good coder writes more efficient code than a bad coder, so in the end the question of language should be decided by your skill, the available tools and the available documentation.

Re:ObjC kernel

Posted: Thu Mar 09, 2006 3:16 am
by llama-X
Solar wrote:A good coder writes more efficient code than a bad coder, so in the end the question of language should be decided by your skill, the available tools and the available documentation.
That's very true. I think I'm up to the task... the only thing worrying me is ObjC's lack of use in the area thus far.

I do think, however, that the more elegant message-passing model in ObjC will make for a much cleaner API in the long run, perhaps the language does matter a bit?

Re:ObjC kernel

Posted: Thu Mar 09, 2006 3:31 am
by Solar
klipe wrote:I do think, however, that the more elegant message-passing model in ObjC will make for a much cleaner API in the long run, perhaps the language does matter a bit?
For the application programmer, the language of the OS will not matter much. You will have to provide wrappers for the various languages, or have them provided by third parties, and within such wrappers the beauty of underlying technologies is usually lost. (And the beauty of a language is in the eyes of the beholder anyway.)

And as for the kernel / OS itself, well - it will be mostly your team working with it, so use whatever does the trick for you.

Re:ObjC kernel

Posted: Thu Mar 09, 2006 5:27 pm
by geezusfreeek
As a fairly experienced Objective-C coder, I know that sending messages in Objective-C tends to be much slower than a member function call in C++.

I love Objective-C, and I do believe that it almost always leads to cleaner, more elegant code in the hands of a competent coder, but there are some ever so slight performance penalties, mostly message passing as I said above.

I say go for it. I would love to see a kernel written in Objective-C.