Hacker News new | ask | show | jobs
by skybrian 3401 days ago
I'm surprised C# is suitable for this. How does that work?
3 comments

Because It is not possible to run C# executable without .NET framework. I had to work on a compiler first. Source: https://github.com/amaneureka/AtomOS/tree/master/src/Compile... Which works on the top of Microsoft's IL Builder. Then it add compiler stubs to support .NET code and convert code into native x86 assembly. The assembly file is then passed through NAsm and proper linking chain to produce final Kernel ELF binary. Build.sh produces an ISO image which can be used to boot OS in either virtual machine or on real hardware.

I explained it here: https://www.reddit.com/r/programming/comments/5xlmc6/a_new_h...

Good luck with the project, we already have too many kernels written in straight C.

Only thanks to this kind of work one can prove it is possible.

As a guy who really thinks *nix is awesome, I welcome new additions, too.
That's a lot-o-work! Pretty impressive man. I think projects like this are awesome.
Haven't you heard of Singularity or Midori?

http://joeduffyblog.com/

https://www.infoq.com/presentations/csharp-systems-programmi...

There are quite a few OS projects written in system programming languages with GC, all the way back to Mesa/Cedar at Xerox PARC.

If you want to have an idea, check the Project Oberon book.

http://people.inf.ethz.ch/wirth/ProjectOberon/index.html

This is the 2013 re-edition, it was originally published in 1992.

Also a library for building special purpose operating systems (unikernels) in OCaml, which is actually used: https://mirage.io/
Let's not forget other more recent stuff that still happened before AtomOS, like Redox. I seem to recall seeing a couple others recently as well, but for some reason I'm drawing a blank now. I think the big deal about this is mostly just that it's an effort outside of Microsoft to do this, and compile it to machine code rather than just use some kind of "higher order" OS that needs to run on top of something else -- and even there it's not unique, even if it looks more interesting than FlingOS (which is evidently just a new take on the "toy kernel/OS for teaching" idea).
Midori was still built on a C++ microkernel though.
Which doesn't diminishes its value.

No one would though of writing an OS in C++ in the 90's, it was too slow and everyone knew that microkernels could only be possibly written in C.

I thought of writing an operating system in C++ in the 1990s. I didn't achieve it until after the turn of the century. But I definitely thought of it.

The "everyone" who knew these things about C++ was a small set of vocal people largely from the Unix and C worlds. Other people who were at the time developing Windows NT device drivers in C++, to pick one example, knew that a lot of the received, and loudly recirculated, wisdom about systems programming and C++ was just bunkum.

Me too, I never liked C.

What I was trying to convey with that comment was that C++ was looked down for systems programming, it required Symbian, BeOS, OS X IO Kit to change that mentality.

Even Windows that you mention, which always was a more welcoming place for C++ tooling, Microsoft only started to officially support it with Visual C++ 2012 when the /kernel flag was introduced.

So even that microkernel could have been eventually written in System C#, if there was enough management support to keep developing Midori and improving the language to the point C++ wouldn't be needed.

Instead the project was canceled and since in IT, seeing is believing, there will be idea for many, that there wasn't any other way to accomplish it.

I love the way Alan Kay and others like him think, it is not what the technology give us today, but what it can give us tomorrow in a few years time.

How does that work? Surprisingly well :)

Many hobby kernels (as mentioned in these comments) have used C#, as well as bleeding-edge research kernels e.g. Microsoft's Singularity project: https://en.wikipedia.org/wiki/Singularity_(operating_system)

Bleeding-edge was VerveOS:

https://www.microsoft.com/en-us/research/publication/safe-to...

It's legacy will be in their IronClad Apps. Look into those if you want to see how far they've gone. Also, Microsoft Research & HLL vs Nix and C in security are a gap that's ever widening. ;)