Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which language would you use in your OS?

This is probably more of a subjective question, but which language (not API like .NET or JDK) would you use should you write your own operating system? Which language provides flexibility, simplicity, and possibly a low-level interface to the hardware? I was thinking Java or C...

like image 284
Aethex Avatar asked Jun 11 '09 23:06

Aethex


3 Answers

C, of course.

like image 121
Ryan Oberoi Avatar answered Sep 24 '22 21:09

Ryan Oberoi


Haskell.

Once you have flipped the right hardware bits, C is a terrible language to use for the rest of the OS. Things like the scheduler, filesystems, drivers, etc. are complex high-level algorithms, and you don't want to be writing those in assembly language (or C; same thing). It's too hard to get right. (The VM subsystem and memory manager may need to be written in something low-level, as you will need to bootstrap your high-level langauge's runtime somehow.)

Anyway, this isn't just a crazy idea that I am coming up with for SO. Here is an OS written in Haskell: http://programatica.cs.pdx.edu/House/

Lisp is another good choice; the original Lisp machines were infinitely more tweakable (at runtime) than "modern" OSes like UNIX and Windows.

Sometimes history forgets good ideas (often in the name of "maximum performance"), and that makes me sad.

like image 20
jrockway Avatar answered Sep 23 '22 21:09

jrockway


D would be an interesting choice. From its own description:

D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.

The D runtime assumes the existence of a garbage collector, which would not be appropriate for the very lowest levels of the kernel. However, it would be appropriate for many of the higher layers.

like image 26
Greg Hewgill Avatar answered Sep 24 '22 21:09

Greg Hewgill