Most OSes and systems programming in general is mostly done in C (and C++?).<p>The language has some clear flaws from what I understand but there aren't really any alternatives are there?<p>Why is C so fast? Because people make it fast or because it is easy to write fast compilers for it?<p>Why aren't other languages used for writing OSes? They just don't have the speed?
JAVA is used a lot for server-programming right? But doesn't cut it speedwise for OSes?<p>As we move to the cloud and the OS becomes less important will C disappear as new systems replace the old ones?<p>But you will still need some small basic OS right? So will people program in C in 10 years or will compilers have gotten so smart will be writing that in Haskell, Python or JAVA?<p>Why hasn't anyone created a better systemprogramming langauge?
I've heard several times (citation needed, I know. Anybody?) that processors have gradually been tuned to perform better with machine language that has artifacts from C compilation in it, or something like that. I would love details. (Related: <a href="http://www.c2.com/cgi/wiki?CeeAsAnIntermediateLanguage" rel="nofollow">http://www.c2.com/cgi/wiki?CeeAsAnIntermediateLanguage</a>)<p>Python won't be used as a systems programming language because it's relatively slow compared to most compiled languages (though many parts of its library are compiled C) due to two major strikes against it: It's interpreted (albeit with some bytecode caching), and it doesn't (yet) have a clear way to declare/infer types for optimization, so a lot of cycles get burned double-checking data types. In practice, it's usually fast enough for most purposes -- its design focused on speed of development over than execution, which is a good tradeoff overall, but works against it for systems programming (except prototyping).
Off the top of my head, I'd say that C is used for systems programming due to direct addressing of memory via pointers and it being as low level as you can get without getting into machine specific assembly. Speed is more of a byproduct of being extremely low level since you've got very low overhead.<p>I'd be curious what you see as the inherent flaws in C, and what would you want to see out of a better systems language?
There are operating systems in other, higher-level languages: Singularity, JNODE, Genera, SqueakNOS, Movitz, but:<p>C is not garbage collected. If you write an OS in a dynamic language you need either a GC in a low-level language or one that does not produce garbage itself. If you want a realtime-OS, garbage collection will make things much more complicated.<p>Other dynamic featues like multiple dispatch at runtime may also slow down the system and create an unnecessary bottleneck at such a low level.<p>> Why hasn't anyone created a better systemprogramming langauge?<p>Java is a very good systems programming language for Processors that have Java bytecode as machine code.<p>Oberon is a better language to write the Oberon system in than C. There is also a lot of low-level programming going on with Ada. Oberon and Ada are both derived from Pascal and seem very un-dynamic to me. Depending on your definition of better, they may be better sytem programming languages.
There is the D programming language, but it hasn't caught on.
<a href="http://www.digitalmars.com/d/index.html" rel="nofollow">http://www.digitalmars.com/d/index.html</a>