Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you only write operating systems in C?

I get that C and its super sets allow you to have low level access, but could you use a different language. For example Visual Basic, C# or even Java? I was just curious because it seems like something better should have come along since C's inception.

like image 650
user538442 Avatar asked Jan 11 '11 17:01

user538442


People also ask

Are all operating systems written in C?

Most of the operating systems are written in the C/C++ languages. These not only include Windows or Linux (the Linux kernel is almost entirely written in C), but also Google Chrome OS, RIM Blackberry OS 4.

Can you write an operating system in C++?

C is the programming language most commonly used and recommended for writing operating systems. For this reason, we are going to recommend learning and using C for OS development. However, other languages such as C++ and Python can also be used.

Why are OS written in C not C++?

Writing bits and pieces in inline asm is simple in C and C++. Also, most other languages support C's calling convention, so writing your OS in C makes it easy to expose system calls to user-space in a way that can be easily interacted with.

Why are all operating systems written in C?

Easy to code: One of the biggest reasons why C works so well for systems programming is because it is easy to code. C's direct 1-1 interaction with machine code means there are no complicated built-in data structures like trees or tables.


2 Answers

You can write an operating system in any language you choose - provided you have the bootstrapping required to compile it onto that platform.

For example, JNode is a Java based OS (with a small amount of assembler).

like image 183
Reed Copsey Avatar answered Oct 04 '22 15:10

Reed Copsey


You could use any of those to write the operating system. However, you would need a bootstrap (probably written in C) to load and run the runtime for your language.

Google Scholar shows some good starting points for research: http://scholar.google.com/scholar?q=java+operating+system&hl=en&btnG=Search&as_sdt=1,5&as_sdtp=on

like image 23
Babak Naffas Avatar answered Oct 04 '22 16:10

Babak Naffas