C is by far the most favorite language for writing operating systems. It is high level enough to make sense to the programmer by abstracting away lower level details of the machine, and low level enough to talk directly to the hardware. Of course, there is low-level, machine-specific bootstrapping code that loads the operating system, however that’s a detail that we can safely ignore since the operating system itself has been written in C. These low-level routines that boot the operating system are located in the BIOS chips, and once they they have done their task, they “boot” the operating system by looking at a specific place in memory where the operating system’s core — also called the kernel — is located. The control then passes completely to the operating system, which then loads the shell and the usual what-have-you.

Yet another reason that C is so pervasive is that practically every hardware platform has a C compiler written for it.

And yet another factor for choosing C is that it does not depend on any abstraction layer between the operating system and the hardware. I would direct your attention to Java, with a software abstraction layer called the JVM required to run programs compiled on that platform. In the case of C, however, there are no such runtime dependencies to be resolved.

C also does not expect the presence of any program like a memory manager that will take care of memory management for it, and thusly C is its own memory manager. Or should I say, that responsibility devolves upon the programmer who has precise access to how much memory is required for the program, and when to allocate and deallocate chunks of memory.

Finally, owing to C’s low-level nature, practically every instruction written in C maps (more or less) to a specific machine instruction. Thus there is often a 1 to 1 correspondence between the program and the compiled code.

Original post: 

Image courtesy: By Michael J. RossThe original uploader was ArnoldReinhold at English Wikipedia. - http://www.corestore.org/36065-1.jpg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=1777101
Please spread the word among your friends & associates