- Linux is written in which language?
- What programming language does Linux support?
- What Language is Linux Written In? A Follow-Up: Page 1
- Kernel and Device Drivers
- Libraries and Utilities
- Package Managers and Configuration Programs
- Window Managers and Desktop Environments
- Graphical User Applications
- Conclusion
- What languages are Windows, Mac OS X and Linux written in?
- 12 Answers 12
Linux is written in which language?
The Linux Kernel (which is the core of Ubuntu) is written mostly in C and a little parts in assembly languages. And many of the applications are written in python or C or C++.
The most frequent answer is, linux is also written mostly in C, with some parts in assembly. About 97 percent of the world’s 500 most powerful supercomputers run the Linux kernel. It is also used in many personal computers.
Another popular question is “What programming language is the Linux kernel written in?”.
Windows: C++, kernel is in C Mac: Objective C, kernel is in C (IO Pn. P subsystem is Embedded C++) Linux: Most things are in C, many userland apps are in Python, KDE is all C++ All kernels will use some assembly code as well.
What is Linux and how is it written?
It’s a kernel, mostly written in C, along with a variety of tools, many of them from the GNU project, also mostly written in C. It’s all open source, so you are welcome to download it and examine it to see how it’s written. If you install a distro, you always have the option to also install sources and developer versions of the libraries.
What programming language does Linux support?
There is no particular one – Linux supports just about every language on the planet. Linux apps are written in a wide range of languages. C and C++ are very popular – but Python and Java are commonly used too…all sorts of languages are out there – and all of them can produce “ desktop ” programs.
About the scripting languages, no, they pretty much high level. Show activity on this post. The Linux kernel is mostly written in C (and a bit of assembly language, I’d imagine), but some of the important userspace utilities (programs) are shell scripts written in the Bash scripting language.
What Language is Linux Written In? A Follow-Up: Page 1
“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
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.
Libraries and Utilities
We have just scratched the surface of the kernel and Linux issue when we compared it to kernel32.dll. In fact, kernel, libraries and the common *NIX utilities are what make “Linux” the core of the operating system. Nobody can imagine a Linux distribution without stlibc, gcc etc.. And, also, nobody can imagine a working system without core utilities such as mkdir, chmod, chown, head, tail, chroot, uptime, users, etc.. These utilities are also written in C.
Package Managers and Configuration Programs
Package managers are the programs that control the application’s install and uninstall processes, taking the dependencies into account. For example, in openSuSE and Fedora yum is the package manager and apt or dpkg fills that role in Debian based systems such as Ubuntu. Many of the package managers and configuration programs are written in C.
The graphical front-ends to the package managers and the configuration programs are completely different issues. As the baseline, we can consider them to be written in Python (GTK, QT, Tcl/Tk to follow in Graphical User Applications).
Window Managers and Desktop Environments
Considering that the majority of standard users use a desktop environment, we have to look at what that is first. A desktop environment is a graphical interface that is designed to assist the user with routine computer use. For example, a user can issue the command mv file_a /dir/file_a to move the file named file_a from the present working directory to another directory named /dir, or he can open up a file manager and then drag the file from the present directory to /dir and drop there. This is one of the functions of a desktop environment.
A desktop environment includes icons, windows, toolbars, folder views, wallpaper, etc.. Typically, a desktop environment is based on specific libraries and the libraries make the desktop environment consistent in look and feel. In the case of the top two desktop environments, Gnome uses Metacity and KDE uses KWin window managers. Both Metacity and KWin are developed in C, and thus require GCC to compile.
Graphical User Applications
This is where many programming languages come into play. You can write any application using any language you want including the graphical user interface. This includes C, Python, Java, Perl, and others. For that program to run in a graphical user interface, you can use the libraries for the desktop environment that you plan your program to run. Let’s give an example: you have written a program to watch user-defined tweets from Twitter. You can design a user interface that uses GTK libraries to make the program look native to the Gnome Dekstop Environment, but you may write the underlying code in Perl. Then you can go on further and define a user interface by using QT libraries if you want your program to look native to KDE. Or, if you want, you can write the interface by using Tcl/Tk libraries. Synaptic and Kynaptic can be good examples; both use the same underlying code but Synaptic uses GTK and Kynaptic uses QT.
Or if you want full control, you can go with the Java development environment and use the Java graphical libraries. There are many programs available – one of them is Datacrow, which I use to catalog my media and book collection.
Conclusion
In the answer to the question “what language is Linux written in” one must know that technically he is referring to the kernel, utilities and libraries. This is simple: C and Assembly (to some extent). But if one is referring to the whole Linux distribution, then the answer is “it depends” because we do not know if the user is referring to a particular application or any other system component.
What languages are Windows, Mac OS X and Linux written in?
I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI components, etc). I assume that there are multiple languages for each and obviously I know the Linux kernel is written in C. I’m totally guessing here that Mac OS X contains a lot of Objective-C code as it is Apple’s language derived from NeXT. Windows, I have heard contains C, C++ and Intel Assembly. Do Linux or Mac OS contain any Assembly code? Also, are there scripting languages like Ruby, Python, etc used by the OS developers for scripting parts of the OS? What parts of the OS would be written in each language?
@samarmohan how is Windows written in JavaScript? I mean, can you make a damn OS in JS? You can’t (as far as I know). It’s C++.
12 Answers 12
- Windows: C++, kernel is in C
- Mac: Objective C, kernel is in C (IO PnP subsystem is Embedded C++)
- Linux: Most things are in C, many userland apps are in Python, KDE is all C++
All kernels will use some assembly code as well.
To make things crystal clear — the Apple kernel’s IOKit subsystem (for drivers) uses (a restricted subset of) C++. And on all 3, i.e Windows, Mac and Linux, many of the most important userland applications are written in either C or C++. Allegedly, for example, MS tried to redo Office in .NET but went back to C++. And the linux kernel uses many C++-like idioms but hand-cooked together in C, e.g. inheritance in driver code.
Linux: C. Some parts in assembly.
[. ] It’s mostly in C, but most people wouldn’t call what I write C. It uses every conceivable feature of the 386 I could find, as it was also a project to teach me about the 386. As already mentioned, it uses a MMU, for both paging (not to disk yet) and segmentation. It’s the segmentation that makes it REALLY 386 dependent (every task has a 64Mb segment for code & data — max 64 tasks in 4Gb. Anybody who needs more than 64Mb/task — tough cookies). [. ] Some of my «C»-files (specifically mm.c) are almost as much assembler as C. [. ] Unlike minix, I also happen to LIKE interrupts, so interrupts are handled without trying to hide the reason behind them. (Source)
Mac OS X: Cocoa mostly in Objective-C. Kernel written in C, some parts in assembly.
Mac OS X, at the kernel layer, is mostly an older, free operating system called BSD (specifically, it’s Darwin, a sort of hybrid of BSD, Mach, and a few other things). almost entirely C, with a bit of assembler thrown in. (Source)
Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employes a truly dynamic runtime making it uniquely flexible. Because Objective-C is a superset of C, it is easy to mix C and even C++ into your Cocoa applications. (Source)
Windows: C, C++, C#. Some parts in assembler.
We use almost entirely C, C++, and C# for Windows. Some areas of code are hand tuned/hand written assembly. (Source)
Unix: C. Some parts in assembly. (Source)