What Programming Languages are Operating Systems written in?

programming languages for os

A lot of our readers were asking for “programming languages for OS” or “languages used to program an OS”. Here I have stated each vital language followed by its use in/for OS. Hope you like it.

1. Assembly Language

assembly language for os

  • Assembly Language is mostly used for tasks not supported by C. When C is unable to dive extra deep glancing the hardware, that’s when Assembly is used. It was used for jobs like Context switching, interrupt handlers, etc.
  • MenuetOS is an Assembly language OS whose 32-bit version is open source.
  • MSDos was written in x86 Assembly language. KolibriOS, another fork from the MenuetOS is also written in FASM like it’s a parent, MenuetOS. SnowdropOS is yet another open source OS written from scratch in Assembly language. It uses only x86 Assembly language.

2. C Language

C for OS

  • The first version of Linux was written in assembler. Later B was invented which was upgraded to NB (New B) and C was invented. This C was upgraded and then used to make Unix’s high-level version.
  • The GNU tools and utilities of Linux OS are also written in C (including the compiler gcc and glib). These basic open source libraries are now broadly used by many applications and operating systems.
  • The boot files in Fuschia use C.
  • Windows kernel is said to be written in C.
  • Mac kernel is also written in C.
  • It’s also easy to mix C and C++ with it.
  • The famous Gnome environment in Linux is made in C.
  • Linux ‘Kernal’ was written in C, with some native assembler codes for low-level processor support.
  • The drivers and other low-level functions like networking in Android use C.

3. C++ Language

C++ for OS

In relatively new, Fuschia OS, the kernel itself is made in C++. Also, most of the drivers include C++ code. This is because as Fuschia is relatively new, (and still under development) and it has a well-planned approach towards development. Also, The later versions of C++ are now more optimized hence tasks which need faster execution can now be optimally performed with additional features of the Object Oriented Design.

  • Most of Windows code is written in C++. Windows is under continuous development and the developers there are constantly pushing forward for better quality.
  • MacOS has its peripheral subsystem made from embedded C++.
  • The Linux KDE environment is primarily made in C++.
  • OpenGL and other graphics in Android use C++.

Other high-level languages

  • Fuschia OS has it’s build scripts written in Python and shell.
  • Other 3rd party software use GO. Rust is used for UI and other trivial scripts.
  • Windows has mostly adopted C# in recent times. It’s application development also natively supports C#.
  • Mac uses Objective C.
  • Other user applications in Linux are made in Python.
  • In Android too, Python is used for toolchains management along with shell script. Languages like Groovy and C# are also used. Java, being a high-level language, was mostly used to make the front-end. Android applications also natively support Java.

Conclusion

Most Operating systems use C or even assembly. This is to provide support to the hardware components, most intricate hardware sources need to be hardcoded in C or assembly because it will be more feasible this way. Programming such delicate components in high-level languages may sometimes cause errors or problems in optimization (not preferred). Hence drivers, bootloaders and other system components like paging, subroutines, memory management, etc are mostly done in C (sometimes in C++). Other things like the application programs are made using high-level languages like Java, kotlin, python, etc because optimization is no longer an issue while programming application programs.

Vishwesh Thonte

I'm a computer engineering student, fascinated by the complexity of zeros and ones, more fascinated by laws of physics and even more by intelligence and cognition. I'm normally reserved but not with special ones.

You may also like...