With what programming languages can you write OS in. I know that you can use C and C++ but are there any other, when i talk about OS i mean everything: from the BIOS & Boot & Kernel & all the rest that is neede to make an opersting system run?

Recommended Answers

All 2 Replies

assembly

Assembly, C and C++ are by far the most prevalent in that matter. I don't think there is any OS that is written with any other language. By far, it is dominated by C. Some lower-level details might be done in Assembly, and some higher-level parts might be done in C++, by the bulk is usually in C.

As for what is possible, then you first need a programming language that is compiled into native code (that rules out any interpreted or JIT-compiled language), then you need a programming language with no required runtime environment (that rules out many higher-level languages like Java or C#), and you need a programming language that allows you to manipulate low-level things like registers, hardware interrupts, and of course, physical addresses. And you probably want a language that is widely supported for different hardware architectures, and you probably want the code that is produced to be reliable (reliable compilers) and fast. Conclusion: use C, and possibly some C++ (or even a lot of C++). There aren't that many other programming languages who fit the bill, and that aren't antiquated languages. If you look at all working operating systems today, they are all programmed with a core in C (with some assembly) and some higher-level stuff in C++ or Objective-C (Mac). There might be some hobby operating systems whose core is in C++ or something else (like Ada).

I have never programmed an OS, but I have programmed on platforms without an operating system (e.g. micro-controllers), and when you do, it becomes pretty clear why C is more appropriate.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.