"What language is Linux written in" is a very difficult subject to tackle. (A colleague of mine recently covered this topic in this article.) This is due to the fact that many users think that Linux is actually a full-fledged operating system, but this is not the case. In order to understand the subject completely and the right way, we have to understand the difference between “Linux” and “Distributions.”
- Linux is the operating system kernel, which is the core component of the operating system that is responsible for managing system resources. The management of system resources is the communication between the software and the hardware components. Basically, when you execute a program, it goes to the kernel and asks for some processor, memory and, depending on the program, disk space.
- Linux distributions are the operating systems that are built on top of the Linux kernel. All of the distributions use the same kernel, but applications may be quite different from one another. For example, Ubuntu is a user friendly distribution, oriented towards newcomers and includes programs such as OpenOffice.org (office suite), GIMP (image manipulation), etc., which a standard user requires. However, there is another distribution, BackTrack, which uses the same Linux kernel but has programs for security auditing, forensic investigation and penetration testing. So, the program AirSnort, used for wireless network security auditing is available in the Backtrack default installation but not in the default Ubuntu installation. That’s just one example of how a single Linux distribution can differ from another.
If we give an example with Windows and Linux Distributions; Windows’ kernel is kernel32.dll but the operating system has Control Panel, Notepad, Wordpad, Disk Defragmenter, Internet Explorer, Outlook Express (or Windows Live Mail), Windows Media Player, etc.. So, “I am using Linux” is the more or less the same, in Windows speak, as “I am using kernel32.dll.” We are not using Linux, we are using a “Linux distribution”. We are not using kernel32.dll, we are using Windows (more about this in the second page, under the “Libraries and Utilities” section).
Of course, it is not only the kernel and the operating system; there are device drivers, standard files and folder structures, and libraries, which together form the baseline of the operating system. You can see the abstraction layers on the image to the right (Image credit: Wikimedia Commons/Miko3k and Tene).
One cannot expect the whole operating system to be written in just one programming language; not because it is technically impossible but because different programmers use different programming languages. But of course there are some technical limitations, other than experimentation purposes. You will not write a graphical user interface program with Assembly, and Visual Basic will not permit you to write hardware device drivers. There are some projects on the Internet like Jnode, which is an attempt to develop a complete operating system in Java. But the kernel is in Assembly.
Now, let’s see which language is used in what part of the operating system.
Kernel and device drivers operate at the lower level of computer operations. To write an operating system kernel and to access the hardware’s properties - such as memory cycles, input/output buses, etc. - you need a program that can “communicate” with the hardware. For this purpose, you need to use a low-level programming language where the language requires a very small or no interaction with the computer’s instruction set.
In Linux, the kernel and the device drivers are written in C with a small amount of Assembly code. We will not go into the details of the loadable kernel modules here since it is not in the scope of our article.
Read on to the next page for information on package managers and configuration programs, window managers and desktop environments, and graphical user applications.