Slashdot Mirror


High Performance Linux Kernel Project — LinuxDNA

Thaidog submits word of a high-performance Linux kernel project called "LinuxDNA," writing "I am heading up a project to get a current kernel version to compile with the Intel ICC compiler and we have finally had success in creating a kernel! All the instructions to compile the kernel are there (geared towards Gentoo, but obviously it can work on any Linux) and it is relatively easy for anyone with the skills to compile a kernel to get it working. We see this as a great project for high performance clusters, gaming and scientific computing. The hopes are to maintain a kernel source along side the current kernel ... the mirror has 2.6.22 on it currently, because there are a few changes after .22 that make compiling a little harder for the average Joe (but not impossible). Here is our first story in Linux Journal."

44 of 173 comments (clear)

  1. Re:GCC compatibility by NekoXP · · Score: 4, Insightful

    Compilers shouldn't need to be compatible with each other; code should be written to standards (C99 or so) and Makefiles and configure scripts should weed out the options automatically.

  2. Portability.. by thesupraman · · Score: 5, Insightful

    IMHO This is a great development, for one important reason.

    Portability of the kernel.

    GCC is a great compiler, but relying on it excessively is a bad thing for the quality of kernel code, the wider range of compilers used, the more portable and robust the code should become.

    I know there will be the usual torrent of its-just-not-open-enough rants, but my reasoning has nothing to do with that, it is simply healthy for the kernel to be compilable across more compilers.

    It also could have interesting implications with respect to the current GCC licensing 'changes' enforcing GPL on the new plugin structures, etc.

    GCC is a wonderful compiler however it has in the past had problems with political motivations rather than technical, and moves like this could help protect against those in the future (some of us still remember the gcc->pgcc->egcs->gcc debarcle).

    Of course no discussion of compilers should happen without also mentioning LLVM, another valuable project.

    1. Re:Portability.. by mrsbrisby · · Score: 4, Insightful

      GCC is a great compiler, but relying on it excessively is a bad thing for the quality of kernel code ... it is simply healthy for the kernel to be compilable across more compilers.

      Prove it.

      The opposite (relying on GCC is a good thing for code quality) seems obvious to me. The intersection of GCC and ICC is smaller than GCC, so I would assume that targetting something big would afford greater flexibility in expression. As a result, the code would be cleaner, and easier to read.

      Targetting only the intersection of ICC and GCC may result in compromises that confuse or complicate certain algorithms.

      Some examples from the linked application include:

      • removing static from definitions
      • disabling a lot of branch prediction optimizations
      • statically linking closed-source code
      • tainting the kernel making debugging harder

      I cannot fathom why anyone would think these things are "good" or "healthy", and hope you can defend this non-obvious and unsubstantiated claim.

      (some of us still remember the gcc->pgcc->egcs->gcc debarcle).

      When pgcc showed up, it caused lots of stability problems, and there were major distribution releases that made operating a stable Linux system very difficult: 2.96 sucked badly.

      The fact that gcc2 still outperforms gcc4 in a wide variety of scenarios is evidence this wasn't good for technical reasons, and llvm may prove RMS's "political" hesitations right after all.

      I'm not saying gcc4 isn't better overall, and I'm not saying we're not better for being here. I'm saying it's not as clear as you suggest.

    2. Re:Portability.. by thesupraman · · Score: 2, Insightful

      Oh, wait a second, I see the problem here.

      You are a moron.

      What exactly do you think happens when GCC changes behavior (as it has done in the past, many times) within the C spec?

      Perhaps we better freeze on version x.y.z of GCC?

      The same would apply to for example assumptions with branch prediction - gcc can and quite probably one day will change behavior - do you really want major features of the kernel to change behavior when this happens?
      The good effect this will have when addressed properly (and remember what you are referencing above is a small group making a starting attempt to achieve this outcome..) is that anything worthwhile AND compiler specific will become clearly marked and optional to the compiling process - therefore increasing the total quality of the kernel. Such assumptions should NEVER be simple spread through the code unmarked.

      By supporting a range of compilers we help make the kernel MORE robust to such changes, and these are both highly competent compilers, so the 'intersection' of features is actually most of the C/C++ specs..

      Of course you obviously have zero experience of such things. You seem to think 'better' means more highly tuned code - try maintaining a major project for more than 6 months, and you may well learn a thing or two.

      pgcc, and more importantly egcs, were the only things that broke the complete stagnation and navel-gazing of gcc that was threatening to cause its death. with the hard work and risk taken by the developers of both, gcc would not be nearly as strong as it is now.

      Again, you dont seem to know what you are talking about, do you perhaps measure compiler 'goodness' by Dhrystone mips?

    3. Re:Portability.. by walshy007 · · Score: 2, Informative

      Oh, wait a second, I see the problem here.
      You are a moron.

      First up, personal attacks to the parent does not an argument prove, all it does is lessen your credibility.

      By supporting a range of compilers we help make the kernel MORE robust to such changes, and these are both highly competent compilers, so the 'intersection' of features is actually most of the C/C++ specs..

      Of course the intersection of features are the specs.. because they are the only standardized thing that makes it c, but as has been said, C leaves a LOT to the implementer in order to be flexible, the standard does not specify everything, and operating systems need to run at such a low level that what they deal with is NOT covered in said specs,

      Furthermore, as for being 'more robust' to breakage when compiler changes occur by supporting more changes, bollocks, now instead of supporting one standard compiler that worked for platforms x,y and z with portable coding practices, you now have to monitor a second compilers changes just so it doesn't break on platform x aswell

      Also you have to monitor that any changes you do to support the second compiler, don't break the building of the three platforms on the first.

      Sounds like a lot of work for essentially no gains, and a lot of added complexity and room for errors that simply doesn't need to be there.

      Of course you obviously have zero experience of such things. You seem to think 'better' means more highly tuned code - try maintaining a major project for more than 6 months, and you may well learn a thing or two.

      By trying to support multiple compilers by changing source code to suit, you really are killing maintainability, with normal programs it might not be so bad, but as said the kernel relies on a LOT of things not standardized between compilers(inline assembly, etc etc), writing compiler specific portions for every aspect of it (and maintaining it) would be hell.

      Again, you dont seem to know what you are talking about, do you perhaps measure compiler 'goodness' by Dhrystone mips?

      I agree performance is never the be all and end all, however going the other route and saying performance is nothing is just as absurd.

  3. 40% faster kernel, but what overall performance? by whoever57 · · Score: 3, Interesting
    Since all the userland code is still compiled with GCC, what overall performance improvement will this bring?

    Ingo A. Kubblin is quoted as saying:

    "... boost up to 40% for certain kernel parts and an average boost of 8-9% possible"

    is that 8-9% overall speedup of applications, or just kernel tasks?

    --
    The real "Libtards" are the Libertarians!
  4. My post is 5-9% faster to read overall... by mattaw · · Score: 2, Interesting
    ...and 40% faster in parts. FACTS - give me some context to judge if this is good or bad.

    Looking at Amdahl's law (golden oldie here) how much time does a PC spend on kernel tasks these days?

  5. It's a Bad Idea. by Anonymous Coward · · Score: 4, Funny
    Personally, I am looking forward to the Low Performance Linux Kernel project.

    You see, I'm a consultant and am paid by the hour.

    1. Re:It's a Bad Idea. by PrescriptionWarning · · Score: 3, Funny

      You could just use Vista in that case... why wait for something slower! Oh wait, you like waiting. Ok, wait away.

  6. compilers? by __aardcx5948 · · Score: 2, Insightful

    So GCC is slow compared to the Intel compiler?

    1. Re:compilers? by gzipped_tar · · Score: 3, Interesting

      I can't judge because my experience with ICC is minimal. GCC is constantly improving, but I feel it concentrates more on platform support than performance. The GCC team has to work on ARM/MIPS/SPARC/whatever while ICC only need to work on x86.

      So I'm not surprised to see GCC falling behind Intel in x86 performance. In fact, only recently did GCC began to support local variable alignment on the stack, which I think is a basic optimization technique. (See the 4.4 pre-release notes http://gcc.gnu.org/gcc-4.4/changes.html, search for the phrase "align the stack" in that page)

      --
      Colorless green Cthulhu waits dreaming furiously.
    2. Re:compilers? by dfn_deux · · Score: 2, Informative

      The GCC team has to work on ARM/MIPS/SPARC/whatever while ICC only need to work on x86.

      ICC supports IA-32, Itanium 1 & 2, x86-64, and xscale. Not that it kicks too much of a leg from your argument, but if you are going to argue the point you should at least make it accurate. Ah yeah almost forgot to mention all the extended instruction sets too... SSE, SSE2, SSE3, MMX, MMX2, etc...

      --
      -*The above statement is printed entirely on recycled electrons*-
  7. Re:GCC compatibility by NekoXP · · Score: 2, Informative

    Amazing. You have no idea what you're talking about :D

    C99 doesn't stop you writing interrupt code OR threaded code.

  8. Yes! by Arakageeta · · Score: 3, Insightful

    I completely agree. I ran into this when I was working as a software architect on a project that had been around for a while. Contracts were required compiler compatibility instead of standard compatibility. It made updates to the dev environment much more complicated. The contracts should have specified standards, but its writers didn't know any better-- the customer had no need to stick to a compiler product/version. It also makes your code more dependent upon the compiler's quirks. I would mod you up if I had the points.

  9. Re:GCC compatibility by NekoXP · · Score: 4, Insightful

    :)

    I think the point is that ICC has been made "gcc compatible" in certain areas by defining a lot of pre-baked defines, and accepting a lot of gcc arguments.

    In the end, though, autoconf/automake and cmake and even a hand-coded Makefile could easily abstract the differences between compilers so that -mno-sse2 is used on gcc and --no-simd-instructions=sse2 on some esoteric (non-existent, I made that up) compiler. I used to have a couple of projects which happily ran on BSD or GNU userland (BSD make, GNU make, jot vs. seq, gcc vs. icc vs. amiga sas/c :) and all built fairly usable code from the same script automatically depending on the target platform.

    The over-reliance of the Linux kernel and it's hardcoded options for GCC means you have to port GCC to your platform first, before you can use a compiler which may already be written by/for your CPU vendor (a good example was always Codewarrior.. but that's defunct now)

    Of course there is always configure script abuse; just like you can't build MPlayer for a system with less features than the one you're on without specifying 30-40 hand-added options to force everything back down.

    A lot of it comes down to laziness - using what you have and not considering that other people may have different tools. And of course the usual Unix philosophy that while you may never need something, it should be installed anyway just because an app CAN use it (I can imagine using a photo application for JPEGs alone, but they will still pull in every image library using the dynamic linker, at load time.. and all these plugins will be spread across by disk)

  10. Will this kernel run fast on AMD processors? by steveha · · Score: 5, Interesting

    A few years ago someone figured out that Intel's compiler was engaged in dirty tricks: it inserted code to cause poor performance on hardware that did not have an Intel CPUID.

    http://techreport.com/discussions.x/8547

    But perhaps they have cleaned this up before the 10.0 release:

    http://blogs.zdnet.com/Ou/?p=518

    steveha

    --
    lf(1): it's like ls(1) but sorts filenames by extension, tersely
    1. Re:Will this kernel run fast on AMD processors? by Jah-Wren+Ryel · · Score: 4, Interesting

      A few years ago someone figured out that Intel's compiler was engaged in dirty tricks: it inserted code to cause poor performance on hardware that did not have an Intel CPUID.

      It wasn't necessarily malicious, all the compiler did was default to a "slow but safe" mode on CPUIDs that it did not recognize. Intel's reasoning was that they only tweaked the code for cpus that they had qual'd the compiler against. Seeing as how they were Intel, they were not particularly interested in qualing their compiler against non-Intel chips. In hindsight, what they should have done is add a "I know what I'm doing dammit!" compilation flag that would enable optimizations anyway.

      --
      When information is power, privacy is freedom.
    2. Re:Will this kernel run fast on AMD processors? by Anonymous Coward · · Score: 2, Informative

      Nope, they have not changed that, and I think it is quite bad behavior for Intel.

      However the do _not_ insert _bad_ code. What they do is that they prevent code optimized for the newest Intel CPUs to run on non-Intel CPUs, even if all the used instructions is present. I think -xW (use SSE, SSE2, optimize for Pentium4) is the highest that will run on AMD.

      However in almost all cases the Intel compilers will still produce the fastest binaries on AMD. Not only compared to GCC, but also compared to other commercial compilers like PGI (with have specific optimization flags for the latest AMD CPUs.)

    3. Re:Will this kernel run fast on AMD processors? by Anonymous Coward · · Score: 2, Insightful

      It was completely intentional. Intel's CPUID protocol defines how to determine the capabilities of a CPU. AMD follows this protocol. Intel could have checked the CPUID for the level of SSEx support, etc. Instead they checked for the "GenuineIntel" string before enabling support for extra instructions that speed up many diverse activities (e.g. copying memory).

      Perhaps your gullibility meter needs recalibration.

    4. Re:Will this kernel run fast on AMD processors? by Anonymous Coward · · Score: 5, Interesting

      It wasn't necessarily malicious

      Like Hell it wasn't. Read this and see if you still believe it wasn't malicious.

      http://yro.slashdot.org/comments.pl?sid=155593&cid=13042922

      Intel put in code to make all non-Intel parts run a byte-by-byte memcpy().

      Intel failed to use Intel's own documented way to detect SSE, but rather enabled SSE only for Intel parts.

      Intel's C compiler is the best you can get (at least if you can trust it). It produces faster code than other compilers. So, clearly the people working on it know what they are doing. How do you explain these skilled experts writing a byte-by-byte memcpy() that was "around 4X slower than even a typical naive assembly memcpy"?

      People hacked the binaries such that the Intel-only code paths would always be taken, and found that the code ran perfectly on AMD parts. How do you then believe Intel's claims that they were only working around problems?

      I'm pissed at Intel about this. You should be too.

    5. Re:Will this kernel run fast on AMD processors? by palegray.net · · Score: 2, Insightful

      Its their compiler, they are damn well allowed to do what they want - call me when AMD pour that kind of resource into having their own compiler.

      Sure, they can do what they want. But it's generally a bad idea to lie about what you've done once you're caught red-handed. You go from losing a lot of respect to nearly all respect in the minds of many customers.

    6. Re:Will this kernel run fast on AMD processors? by JohnFluxx · · Score: 3, Informative

      > Its their compiler, they are damn well allowed to do what they want - call me when AMD pour that kind of resource into having their own compiler.

      ARM put money into GCC. That's far better than them trying to make their own compiler.

    7. Re:Will this kernel run fast on AMD processors? by Tokerat · · Score: 3, Insightful

      Ok I'll bite. By your logic, Intel should:

      • Spend the time and money to test competitors current CPUs against their compiler.
      • Take the blame when their compiler causes unforseen problems on current or newer models due to changes, or aspects they did not know to test for.

      While I agree that something like --optimize_anyway_i_am_not_stupid would have been a good idea, does it make more sense for Intel to spend money and time making their competition faster? You'd need to make a lot of assumptions to think that optimizations for one CPU will work well for another, even from the same manufacturer. Besides, doesn't AMD have their own compiler?

      --
      CAn'T CompreHend SARcaSm?
  11. Re:GCC compatibility - Time to move to Java? by Anonymous Coward · · Score: 5, Funny

    They should think about moving to a Java kernel. They could just bootstrap one of the new, clever "Just-In-Time" Virtual Machines at powerup.
    These JVMs are able to dynamically optimize the running code in real-time, far beyond what could be achieved by C or C++ compilers, without any performance degradation.
    A Java kernel would likely run at least 50 times faster then the very best hand coded assembler - and since the language is completely type-safe and doesn't implement dangerous legacy language features such as pointers or multiple-inheritance then it would be unlikely to ever crash.

  12. Re:40% faster kernel, but what overall performance by setagllib · · Score: 3, Interesting

    If your program is malloc-intensive and you care about performance, you may as well just use a memory pool in userland. It is very bad practice to depend upon specific platform optimisations when deciding which optimisations not to perform on your code. Then you move to another operating system like FreeBSD or Solaris and find your assumptions were wrong and you must now implement that optimisation anyway.

    --
    Sam ty sig.
  13. Re:letme google that for ya. by setagllib · · Score: 2, Informative

    It severely cripples maintenance. Any optimisation, especially one that forks you into multiple parallel implementations (raw C, x86 asm, amd64 asm, amd64 ASM with SSE4, PPC, ....), has to be carefully weighed against its extra maintenance cost.

    The parts that do benefit from optimisation, such as RAID parity calculation, symmetric encryption, etc. are already optimised. At any rate I think the kernel developers know a lot more about this than you or I do.

    --
    Sam ty sig.
  14. Re:We're going about the problem the wrong way by setagllib · · Score: 2, Informative

    That's being done too. GCC 4.3 with Profile Guided Optimisation is SWEET. I don't think plain PGO can be run on a kernel (but that would be an awesome project), but it would definitely close the gap between ICC and GCC. ICC's PGO is not as good, or rather, ICC itself is better at making the kind of fuzzy predictions that PGO makes definite.

    --
    Sam ty sig.
  15. Re:GCC compatibility by SpazmodeusG · · Score: 3, Informative

    And what is the C99 standard to tell the compiler to pack structures with a 1 byte alignment?

    (Hint: there is no standard way)

  16. Re:GCC compatibility by Punto · · Score: 2, Insightful

    Why don't they improve GCC to have a 8-9 to 40% performance gain? it's not like intel has some kind of secret magical piece of code that lets them have a better compiler.

    --

    --
    Stay tuned for some shock and awe coming right up after this messages!

  17. Re:GCC compatibility by forkazoo · · Score: 4, Interesting

    Compilers shouldn't need to be compatible with each other; code should be written to standards (C99 or so) and Makefiles and configure scripts should weed out the options automatically.

    Unfortunately, writing an OS inherently requires making use of functionality not addressed in the C standards. If you stick only to behavior well defined by the ISO C standards you *can* *not* write a full kernel. Doing stuff that low level requires occasional ASM, and certainly some stuff dependent on a particular hardware platform. I think that being as compiler-portable as it is hardware-portable should certainly be a goal. The ability to build on as many platforms as possible certainly helps shake out bugs and bad assumptions. But, just saying "clean it up to full C99 compliancy, and don't do anything that causes undefined behavior" would be ignoring the actual reality of the situation, and makes as much sense as porting the whole kernel to Java or Bash scrips.

  18. Re:GCC compatibility by forkazoo · · Score: 3, Informative

    Why don't they improve GCC to have a 8-9 to 40% performance gain? it's not like intel has some kind of secret magical piece of code that lets them have a better compiler.

    To a large extent, they have. ICC really no longer has the performance lead that it once did over gcc. There was absolutely a time when the difference was consistent, and significant. But, a lot has changed since gcc 2.95, when egcs existed. The 4.x branch in particular has been about improving the optimisation capabilities of the compiler. These days, I generally reccomend just going with gcc to anybody who asks me.

  19. Re:GCC compatibility by Jurily · · Score: 2, Funny

    GCC itself is rather prolific... Is there any noteworthy platform that it doesn't already support?

    Commodore 64?

  20. Unimpressed with ICC by Erich · · Score: 4, Interesting
    We tried ICC on our simulator. The result: 8% slower than GCC. On intel chips. Specifying the correct archtiecture to ICC.

    We were not impressed.

    --

    -- Erich

    Slashdot reader since 1997

  21. This is ancient by scientus · · Score: 2, Insightful

    This kernel is so ancient that any possible performance gains are outweighed by the new kernels performance, bug fixes, and improved driver support. Plus why would someone want to toss away their freedom by using a non-free compiler? Also, does the Intel compiler work with AMD processors?

    There is so much against this that it is useless, until Intel open sources, can work with up to date kernels, and can work on all x86 and x86_64 compatible hardware (im not sure if this is a problem) then im not interested.

  22. Re:GCC compatibility by NekoXP · · Score: 4, Informative

    There isn't one, so what you do is use pragmas (I remember #pragma pack(1)) or attributes (__attribute__((packed)) or something similar.

    Of course they're compiler-specific but there's no reason that code can't be written wrapped in defines or typedefs to stop compiler-specific stuff getting into real production code nested 10 directories down in a codebase with 40,000,000 lines.

    Linux does an okay job of this - but since coders usually reference the compiler manual to use these esoteric pragmas and types, they are usually told "this is specific to GCC" (GCC does a good job of this anyway) so they should be wrapping them by default to help their application be portable and maintainable to future compilers (especially if they change the attribute name or the way it works - as has been done on many a GCC, let alone other compilers).

    What usually nukes it (and why linux-dna has a compiler wrapper) is because they're hardcoding options and doing other weird GCC-specific crap. This is not because they are lazy but because the Linux kernel has a "we use GCC so support that, who gives a crap about other compilers?" development policy and it usually takes some convincing - or a fork, as linux-dna is - to get these patches into mainline.

  23. Re:GCC compatibility - Time to move to Java? by Anonymous Coward · · Score: 3, Informative

    There are actually quite a few ARM processors that do. See Jazelle.

  24. Re:Thank you, I look forward to trying this. by gzipped_tar · · Score: 2, Informative

    I'm afraid the boost of kernel code won't help you much. Since you're doing fluid physics, I guess the hotspots are in the floating point math computation, and your code doesn't do context switching often. In that case, kernel speed isn't that important.

    Well, I'm just saying it. I hope I'm wrong :)

    --
    Colorless green Cthulhu waits dreaming furiously.
  25. Re:GCC compatibility - Time to move to Java? by Ninnle+Labs,+LLC · · Score: 4, Informative

    Java is not a "systems language", meaning you don't write operating systems and systems level code in it for very good reasons.

    Funny cause Sun already did that like 13 years ago.

    One of them being, name me a processor that can run Java bytecode nativly.

    The ARM9E.

  26. Re:GCC compatibility by NekoXP · · Score: 3, Interesting

    I find it hard to believe that the Linux kernel developers never heard of ICC. Or, to take another example, never used Codewarrior or XL C (IBM's PPC compiler, especially good for POWER5 and Cell) or DIAB (or Wind River Compiler or whatever they call it now). Or even Visual C++. Personally I've had the pleasure of using them all.. they all do things differently, but when you have a development team which is using more than one.. I once worked on a team where most of the developers had DIAB, but they didn't want to pay for licenses for EVERYONE, so it was just for the team leaders and release engineering guys, so we all got GCC instead. We had to be mindful not to break the release builds.. and the work ethic meant everything went pretty much fine all round.

    All of them have at one time or still today produce much better code and have much better profiling than GCC and are used a lot in industry. If the commercial compiler doesn't do what you want or is too expensive, GCC is your fallback. Linux turns this on it's head because it "wants" to use as much free, GNU software, but I don't think the development process should be so inhibited as to ignore other compilers - especially considering they are generally always far better optimized for an architecture.

    As a side note, it's well known that gcc 2.95.3 generates much better code on a lot of platforms, but some apps out there are refusing to compile with gcc 2.x (I'm looking at rtorrent here.. mainly because it's C++ and gcc 2.x C++ support sucks. This is another reason why commercial compilers are still popular :) and some only build with other versions of gcc, patches flying around to make sure it builds with the vast majority, significant amounts of development time is already "wasted" on compiler differences even on the SAME compiler, so putting ICC or XCC support in there shouldn't be too much of a chore, especially since they are broadly GCC compatible anyway.

    Like the article said, most of the problem, and the reason they have the wrapper, is to nuke certain gcc-specific and arch-specific arguments to the compiler, and the internal code is mostly making sure Linux has those differences implemented. There is a decent white-paper on it here. The notes about ICC being stricter in syntax checking are enlightening. If you write some really slack code, ICC will balk. GCC will happily chug along generating whatever code it likes. It's probably better all round (and might even improve code quality generated by GCC, note the quote about GCC "occasionally" doing the "right" thing when certain keywords are missing) if Linux developers are mindful of these warnings, but as I've said somewhere in this thread, Linux developers need some serious convincing on moving away from GCC (I've even heard a few say "well, you should fix GCC instead", rather than take a patch to fix their code to work in ICC)

  27. Re:Thank you, I look forward to trying this. by thesupraman · · Score: 2, Insightful

    It depends, if the system is distributed, the hotspots (ie performance bottlenecks) could quite easily be in network latency and throughput, something that could be reasonably impacted here.

    Of course if its not, you are 100% right, however dont underestimate the proportion of cpu time the kernel spends in some situations (databases and distributed apps, for example).

  28. Re:GCC compatibility by Bert64 · · Score: 4, Informative

    Depends on the CPU... gcc has reasonable performance on x86, but on ia64 or ppc the vendor supplied compilers have a big advantage. even on x86 icc leads by a considerable margin in some areas, especially on very new processors.

    --
    http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  29. Re:GCC compatibility by scotch · · Score: 2, Funny

    All my feature-incomplete software is really fast, too.

    --
    XML causes global warming.
  30. Re:GCC compatibility by 42forty-two42 · · Score: 4, Informative

    On the contrary - there is no support for threads or interrupts whatsoever in C99. Sure, there's pthreads and the like - but those are not part of C99, nor can you implement them in pure C99.

    C itself (all versions) tries very hard to avoid tying itself to any specific hardware or OS. It even supports weird things like platforms with more than 8 bits in a char, or with reserved bits in their integers. But as a result, it has only the bare minimum featureset common across all platforms imaginable, and this is why it's very hard to write anything useful with only pure C. (No networking, no listing the contents of a directory, no executing any other programs except via system()...)

    For most userland applications, C plus some OS-dependent libraries are good enough, of course. Things like the POSIX API can't be implemented in regular C (at some level you have an assembly call to the OS's syscall interface), but if you treat it as opaque, no problem.

    But for an OS kernel, things aren't that easy. In the quest for high performance, Linux does all kinds of neat hacks, including things like inlining assembly code into C functions - and later rewriting that code on the fly (google for 'smp alternatives' for more information). It also makes use of CPU-level atomic operations - and exactly which ones are available depend on the architecture. Because of these kinds of hacks, which produce noticeable speed improvements, it is utterly impossible to stick purely to standards like C99.

  31. Re:GCC compatibility - Time to move to Java? by cerberusss · · Score: 3, Funny

    A Java kernel would likely run at least 50 times faster then the very best hand coded assembler

    I'm going to have to agree with you here. However with all the major browser producers concentrating on JavaScript speed recently, I'd say it's much better to use JavaScript instead of plain Java. Think about it, JavaScript is where the speediness is. Also, since almost every browser supports it, you could just boot the kernel using any browser. This could potentially get the kernel out of the hands of that bunch of self-righteous, elitist Linux hackers who are currently totally disconnected from users like you and I.~

    --
    8 of 13 people found this answer helpful. Did you?