lkml.org 
[lkml]   [2007]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: Kernel Development & Objective-C
    Date
    On Nov 30, 2007, at 09:34:45, Lennart Sorensen wrote:
    > On Thu, Nov 29, 2007 at 12:14:16PM +0000, Ben Crowhurst wrote:
    >> Has Objective-C ever been considered for kernel development?
    >
    > Doesn't objective C essentially require a runtime to provide a lot
    > of the features of the language? If it does (as I suspect) then it
    > is totally unsiatable for kernel development.
    >
    > That and object oriented languages in general are badly designed
    > and a bad idea. Having not used objective C I have no idea if it
    > qualifies as badly designed or not. Certainly C++ and java are
    > both very badly designed.

    Objective-C is actually a pretty minimal wrapper around C; it was
    originally implemented as a C preprocessor. It generally does not
    have any kind of memory management, garbage collection, or anything
    else (although typically a "runtime" will provide those features).
    There are no first-class exceptions, so there would be nothing to
    worry about there (the exceptions used in GUI programs are built
    around the setjmp/longjmp primitives). Objective-C is also almost
    completely backwards-compatible with C, much more so than C++ ever
    was. As far as the runtime goes the kernel would be expected to
    write its own, the same way that it implements "kmalloc()" as part of
    a "C runtime". Since the runtime itself never does any implicit
    memory allocation, I think it would conceivably even be relatively
    safe for kernel usage.

    With that said, there is a significant performance penalty as all
    Objective-C method calls are looked up symbolically at runtime for
    every single call. For GUI programs where large chunks of the code
    are event-loops and not performance-sensitive that provides a huge
    amount of extra flexibility. In the kernel though, there are many
    codepaths where *every* *single* instruction counts; that could be a
    serious performance hit.

    Cheers,
    Kyle Moffett

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-11-30 16:29    [W:3.347 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site