Linked by Thom Holwerda on Fri 22nd Feb 2008 09:16 UTC, submitted by obsethryl
.NET (dotGNU too) "Previously, we have presented one of the two opensource licensed projects related to creating a C# kernel. Now it's the time to complete the set by rightfully presenting SharpOS, an effort to build a GPL version 3 + runtime exception licensed system, around a C# kernel of their own design. It is my pleasure and priviledge to host a set of questions and answers from four active developers of SharpOS, that is William Lahti, Bruce Markham, Mircea - Cristian Racasan and Sander van Rossen in order to get some insight into what they are doing with SharpOS, their goals, their different design and inspiration."
Thread beginning with comment 301976
To read all comments associated with this story, please click here.
Does managed code build better OSs?
by Laurence on Fri 22nd Feb 2008 11:48 UTC
Laurence
Member since:
2007-03-26

I keep reading about all these experimental OSs build with C# (and other managed languages) and I'm still a little confused about one thing:
What makes C# better for building a kernel than C/++ and/or assembly?

Don't get me wrong, I'm all for progress and experimentation, I'm just a little puzzled what such a high level language can offer in terms of kernel performance and stability that lower level languages haven't offered for a great deal of time already. Is it just a case that these are geeky projects some programmers have taken up "just because they can" (which is as good a reason as any for building experimental systems) or do these projects offer some serious future gain which I'm naively overlooking?

Reply Score: 2

ahmetaa Member since:
2005-07-06

Just like Jnode with Java,
Basically safety is the answer. no buffer overflows or easy memory leaks. Also development speed is a big bonus.

Reply Parent Score: 5

erdizz Member since:
2006-06-07

To my understanding, buffer overflows and memory leaks are only a fraction of the sources of instability in modern kernels, while synchronization issues in highly parallel asynchronous environment and general complexity problems are probably more significant and harder to solve. Managed languages don't help with the latter, so it's not a silver bullet.

Reply Parent Score: 5

l3v1 Member since:
2005-07-06

safety is the answer. no buffer overflows or easy memory leaks


Well, actually all you do is delegate the safety checks to the developers of the language/compiler/whatever. In the long run all I see emerging from this is something I don't really like, coders who say are experienced and perform horribly when needed to code in c++ and the likes. And disregard c/c++/vc/etc. all you want, it's still mighty important. Don't get this wrong, I personally don't have anything against c# (although winforms is a no-go for me), on my better days I tend even to like it somewhat ;)

Reply Parent Score: 3

tuttle Member since:
2006-03-01

I keep reading about all these experimental OSs build with C# (and other managed languages) and I'm still a little confused about one thing: What makes C# better for building a kernel than C/++ and/or assembly?


The big advantage is software isolated processes.

If your user mode programs use the verifiable subset of the MSIL instruction set, you can let all processes run in the same address space without security problems.

This gives a huge performance increase since interprocess communication can be done by just passing around pointers. A kernel call does no longer involve costly copying of arguments and CPU mode switches.

In the long term, a CPU designed for running an OS using software isolated processes could be simplified tremendously. So you could squeeze many more cores on the same die space.

Don't get me wrong, I'm all for progress and experimentation, I'm just a little puzzled what such a high level language can offer in terms of kernel performance and stability that lower level languages haven't offered for a great deal of time already.


The performance of C# and java actually are quite close to the performance of C++ when done right. Especially for .NET languages that support value types (structs), there is no theoretical reason why C# should be slower than C++. Of course C++ compilers have more mature and more optimized code generation algorithms, but that is slowly changing. For example, the next version of the JVM will get stack allocation, and the next version of the CLR will do much better struct inlining.

Unfortunately, most java and C# programmers do not realize the performance potential of managed languages because they are creating thousands of objects in inner loops. To write high performance code, you need to know how the language constructs are mapped to machine language, and most programmers simply do not know or care about such details.

Is it just a case that these are geeky projects some programmers have taken up "just because they can" (which is as good a reason as any for building experimental systems) or do these projects offer some serious future gain which I'm naively overlooking?


Like I said, better security, much faster IPC and less requirements on the underlying CPU are the major advantages.

Reply Parent Score: 9