c++ in linux kernel

By: Richard Cownie (tich.delete@this.pobox.com),
Room: Moderated Discussions
anon (anon@anon.com) on 6/7/10 wrote:
---------------------------
>Richard Cownie (tich@pobox.com) on 6/7/10 wrote:
>---------------------------

>I don't agree. I don't agree correctness and performance are less important in
>other applications or libraries.

You're entitled to your opinion. But it's hard for me
to imagine that interpeted/JIT languages like Java and
its derivatives could have become as popular as they
are if most code in most apps was really performance-
critical. From what I've read, even the latest highly-
tuned JIT Java stuff goes about 2x slower than C++.

As for correctness, it's serious when an app crashes;
but it's far more serious when an OS kernel crashes.
And it's harder to debug kernel problems than most
app problems, which gives kernel developers a strong
(or if you prefer, an even stronger) incentive to get
it right earlier in the development process, in design
and code review.

>And productivity of programmers does not become
>_less_ important when you have hundreds maybe thousands of >developers working on
>a code base (most of them are paid, by most surveys).

I was unclear. I meant "productivity" in the narrow
sense of being able to write a lot of functionality
per man-month. But in kernel development (and development
of other large/highly-entangled/parallel systems) most of
the developer time goes on debugging obscure interactions,
rather than on actually writing code. So the choice of
language (and coding practices) matters only inasmuch as
it affects the speed with which such obscure interactions
can be understood and fixed. It's not clear that the
features of C++ offer much help with that. What matters
more in the linux kernel would seem to be the ruthless
rejection of code that doesn't meet high standards (and
a willingness to throw out inadequate old code).

>I think these attributes are more due to good design than >choice of language.

Yes, and as I said, the key is to get really good people.
The main advantage I see for C++, under most circumstances,
is that, with good design, it can allow you to get by
with substantially fewer lines of code, and thus with
substantially fewer people. And fewer people means both
*much* less time spent on interactions and meetings; *and*
a much better chance of assembling a team that's 90%
excellent rather than more normal large teams which are
20% excellent (or less).

However, the way C++ achieves that trick of more
functionality with less code is largely by doing a lot
of clever stuff implicitly. And in the context of an OS
kernel, that implicit stuff may well be confusing,
memory-hungry, and slow, unless you're really really
rigorous. [Aside: I just got done fixing an issue in a
big C++ app where a bunch of code was doing unnecessary
implicit copying of hashtable iterators. You just
couldn't have that kind of issue in C].

< Previous Post in ThreadNext Post in Thread >
Thread (207 posts)
TopicPosted ByPosted
c++ in linux kernelnewbie
  c++ in linux kernelrwessel
    c++ in linux kernelslacker
      Forums and C/C++David Kanter
        Forums : flat vs. threaded.Dean Kent
          Forums : flat vs. threaded.anonymous
            Forums : flat vs. threaded.Rob Thorpe
              Forums : flat vs. threaded.Dean Kent
      c++ in linux kernelnewbie
        c++ in linux kernelnksingh
        c++ in linux kernelDavid Kanter
        c++ in linux kernelHeath Provost
          c++ in linux kernelLinus Torvalds
            c++ in linux kernel?
              c++ in linux kernelnksingh
                c++ in linux kernelS. Rao
              c++ in linux kernelmpx
                c++ in linux kernelEduardoS
              c++ in linux kernelLinus Torvalds
                c++ in linux kernelMichael S
                c++ in linux kernel?
                  c++ in linux kernelPekka Enberg
                    c++ in linux kernelMichael S
                      c++ in linux kernelPekka Enberg
                        c++ in linux kernelMichael S
                          c++ in linux kernelPekka Enberg
                    c++ in linux kernelVincent Diepeveen
                      c++ in linux kernel?
                  c++ in linux kernelnemlis
                c++ in linux kernelMark Christiansen
                c++ in linux kernelNeo
                  Poor troll, try harder next time (NT)Matt Sayler
                  c++ in linux kernelRohit
              c++ in linux kernelgallier2
                c++ in linux kernelMichael S
                  c++ in linux kernelgallier2
                    c++ in linux kernelMichael S
                      c++ in linux kernelgallier2
                c++ in linux kernel?
                  c++ in linux kernelMichael S
                    c++ in linux kernel?
                      c++ in linux kernelMichael S
                        c++ in linux kernel?
                          c++ in linux kernelMichael S
                  c++ in linux kernelEduardoS
              c++ in linux kernelCodeGrunt
            c++ in linux kernelnewbie
            c++0x any better?Max
              c++0x any better?anon
                c++0x any better?Michael S
            c++ in linux kernelLispLover
              c++ in linux kernelRob Thorpe
            c++ in linux kernel - more disadvantagesVincent Diepeveen
            c++ in linux kernelsomeone
            c++ in linux kernelJohn Regehr
            c++/java in linux kerneliirekm
              c++/java in linux kernelanon
                c++/java in linux kerneliirekm
                  c++/java in linux kernelRob Thorpe
                  Java is not just syntactic sugar on top of assemblyMark Roulo
                    no it is :-)iirekm
                      no it is :-)Mark Roulo
                        no it is :-)iirekm
                          no it is :-)Gabriele Svelto
                  c++/java in linux kernelanon
                c++/java in linux kernel?
                  c++/java in linux kernelEduardoS
                  c++/java in linux kernelanon
                    C is more portable than assembly??
                      C is more portable than assembly?anon
                        C is more portable than assembly??
                          C is more portable than assembly?anon
            c++ in linux kernelBob
        c++ in linux kernelAaron Spink
          c++ in linux kernelRichard Cownie
            c++ in linux kernelanon
              c++ in linux kernelRichard Cownie
                c++ in linux kernelAaron Spink
                  c++ in linux kernelRichard Cownie
                    c++ in linux kernelMark Roulo
                      very interesting case study, thanks (NT)Richard Cownie
                      Okay, wait, let me get that straightTimmy
                        Split codebase..Anon
                        Okay, wait, let me get that straightRichard Cownie
                          Okay, wait, let me get that straightanonymous
                            Okay, wait, let me get that straightMax
                            Okay, wait, let me get that straightGabriele Svelto
                              Okay, wait, let me get that straighthobold
                                Okay, wait, let me get that straightSalvatore De Dominicis
                            Okay, wait, let me get that straightRichard Cownie
                            Okay, wait, let me get that straightMark Roulo
                              Okay, wait, let me get that straightRob Thorpe
                        Okay, wait, let me get that straightMark Roulo
                        Okay, wait, let me get that straightEduardoS
                c++ in linux kernelanon
            Joke: C programs are high-performance?
              Programmers Need To Learn Statistics Or I Will Kill Them Allanon
                Programmers Need To Learn Statistics Or I Will Kill Them All?
                  Programmers Need To Learn Statistics Or I Will Kill Them Allhobold
                  Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo
                    Programmers Need To Learn Statistics Or I Will Kill Them All?
                      Programmers Need To Learn Statistics Or I Will Kill Them AllMark Roulo
                To kill programmers just ship them to Tomtom - Gestapo methods there (NT)Vincent Diepeveen
            c++ productivityanon2
              c++ productivityLinus Torvalds
                c++ productivityRob Thorpe
                c++ productivityD.P.
                  c++ productivityLinus Torvalds
                    c++ productivityanon2
                      c++ productivityMark Roulo
                        C with pointer checkingMax
                          C with pointer checkingD.P.
                            C with pointer checkingMax
                              C with pointer checkingD.P.
                        DIE FORTRAN, DIERohit
                          DIE FORTRAN, DIEa reader
                            DIE FORTRAN, DIEhobel
                            DIE FORTRAN, DIED.P.
                      c++ productivityD.P.
                    c++ productivityMaxthon T. Chan
                c++ productivityWalter Bright
                  c++ productivityD.P.
                    c++ productivityNick Sabalausky
                      c++ productivityD.P.
                        c++ productivityWalter Bright
                          c++ productivityD.P.
                            c++ productivityJesse Phillips
                            c++ productivityWalter Bright
                              c++ productivityD.P.
                                c++ productivityNick Sabalausky
                                c++ productivityWalter Bright
                                  c++ productivityD.P.
                            c++ productivityNick Sabalausky
                Context-dependency considered harmful??
                c++ productivityAlok
                  c++ productivityLinus Torvalds
                    c++ productivityanon
                    c++ productivityEva
                    c++ productivityOh Come On Dept
                      c++ productivityLinus Torvalds
                        c++ productivityMark Christiansen
                          c++ productivityLinus Torvalds
                            c++ productivitystubar
                            c++ productivitya reader
                              c++ productivityGabriele Svelto
                                c++ productivityBrad Cantrell
                            c++ productivity?
                              c++ productivityJouni Osmala
                                c++ productivityEduardoS
                            c++ productivityTimmy
                              c++ productivityEduardoS
                                c++ productivityrwessel
                                  c++ productivityEduardoS
                                    c++ productivityrwessel
                                      c++ productivityAnon
                                        c++ productivityMark Roulo
                                          c++ productivityEduardoS
                                            c++ productivityMark Roulo
                                        c++ productivityrwessel
                                          c++ productivityAnon
                                            c++ productivityrwessel
                                              c++ productivityhobel
                                                c++ productivityrwessel
                                                  c++ productivityRob Thorpe
                                                    c++ productivityhobel
                                              c++ productivityMichael S
                                                c++ productivityrwessel
                                                  c++ productivityMichael S
                                                    c++ productivityrwessel
                                                      c++ productivityMichael S
                                                        c++ productivityrwessel
                                              c++ productivity - apologyrwessel
                                              c++ productivityRob Thorpe
                                                c++ productivityMark Roulo
                                                  c++ productivityRob Thorpe
                                              c++ productivityAnon
                                c++ productivityanonymous
                            c++ productivitytm
                              c++ productivitygallier2
                        c++ productivityOh Come On Dept
                c++ productivityKagamin
                  c++ productivityanon
                    c++ productivityDavid Kanter
                      c++ productivityRichard Cownie
                        c++ productivityCharles
                          c++ productivityRichard Cownie
                          well-designed C++ librariesD.P.
                            boost sucksanon
                              what c++ libraries does not suck?D.P.
                                amount of ignorance to history?
                                  amount of ignorance to historyCharles
                                    amount of ignorance to historyanon
                                      amount of ignorance to historyMark Christiansen
                                        amount of ignorance to historyanon
                                    Boost is being used to illustrate that good C++ is unreadable by mostMark Roulo
                                    amount of ignorance to historyD.P.
                            well-designed C++ librariesanon
                              well-designed C++ librariesD.P.
                                well-designed C++ librariesanon
                                  well-designed C++ librariesD.P.
                                well-designed C++ librariesKagamin
                                  Lack of features can be a featureDavid Kanter
                                  some features have global effectsRichard Cownie
                                    some features have global effectsTimmy
                      c++ productivityRob Thorpe
                      c++ productivityKagamin
                c++ productivityfast