Ayende @ Rahien

Unnatural acts on source code

Managed Operating Systems

Here is something that caught by surprise. Sharp OS and Cosmos OS are two operating systems written in C#.

That is not something that you traditionally do with managed languages. So far I have had a look at Sharp OS source code, which seems nice, although I am taken aback by the amount of unsafe code that is there. Of course, it is not like there is much choice in the matter.

I was particularly amused by the implementation on inline assembly:

image

But other pieces of the code are make me feel that I am looking at some... other language:

image

You can take the kernel out of C, but you can't get the C out of the kernel, I would say.

I took a brief look at the Cosmos code as well, and it is not significantly different. The way both projects go about building kernels with managed languages is to do IL -> assembly translation at some point, and then run that.

Very interesting concept, although one that I have an academic interest at only. At least until they both get a viable TCP/IP stack and I can start using them as embedded systems. Until then, I think that a stripped down Linux + Mono would do the trick fairly well.

Comments

Jon Galloway
02/09/2008 06:08 AM by
Jon Galloway

Have you seen the Microsoft Research Singluarity project? http://en.wikipedia.org/wiki/Singularity(operatingsystem)

They're building a very tiny core in C++ but the rest is managed. I'd love to see Microsoft put some serious effort into this. Somebody's going to do it, and like you, I bet it'll be a lightweight Linux distro + Mono.

Pedro Teixeira
02/09/2008 05:09 PM by
Pedro Teixeira

100% in C# does not mean it's 100%managed, if they use unsafe code..

Anyway, I think there is real interest in having drivers and core os componentes written as managed code... but there is also some inertia :p

Victor Sergienko
03/11/2008 05:41 PM by
Victor Sergienko

Inferno (http://www.vitanuova.com/inferno/) is a notably old managed, complete, non-toy operating system.

My friend praises it for bytecode system better then in Java/.NET, network transparency, and resource lightness. It's said to run on 2M of memory.

It runs on itself or inside another OS... neat and invented long ago.

Comments have been closed on this topic.