Top 8 reasons Why C is the best language for Operating Systems
I have seen so many wrong answers on the web. Only very few of them are acceptable so I tried to find the gist of all the correct answers in this post:
C is very simple language compared to other alternatives like assembly languages, FORTH, BLISS, FORTRAN, ALGOL 60 and the others.
2) Closeness to hardware:
Although C is a 3rd generation programming language still it is closer to hardware than any other modern languages of its generation. The operators in C are usually close to a 1-1 mapping with the respective assembly instructions in many architectures too. For example, a single pointer dereference (or array indexing in general for that matter) often translates to a single instruction.
3) Memory Management:
C doesn't need support for heap memory management - you can PROVIDE your own heap memory management with something as simple as an enormous, fixed-size array. C++ needs heap management as part of the run-time support. Let's say you are not satisfied with the default memory management then you can just then you can write code in C or C++ to mimic a faster approach.
C allows you direct control over the very low-level aspects of the computer. Most device drivers are actually written in C because it does not require garbage collection like Java. You can address IO ports directly and even absolute memory addresses, thus there is no need at all to use Assembly Language for drivers. The importance of this cannot be overemphasized.
Newer languages which have support for garbage collection, dynamic typing, and other facilities which make it easier for the programmer to write programs. The catch is, there is additional processing overhead which will degrade the performance of the application. C doesn't have any of that, which means that there is no overhead.
C doesn't really need a runtime environment (if you throw away standard libraries) unless you are missing in the CPU instruction set but needed by the OS design, then that's a bit of runtime support needed. So it is actually compatible with most of the smart devices and computers of today.
7) Rich History:
C was created and developed by professionals to solve a problem they had in the late 1960s/early 1970s, which it turns out the same problem a lot of people have today.
C is so widely popular and became a de-facto. In fact, it has a great deal of influence on the design of the CPU instruction set itself.