
Show HN: A new hobby OS from “scratch” in C# - amaneureka
https://github.com/amaneureka/AtomOS
======
udp
I appreciate that this is a hobby project, but comments like this one in
Kernel.cs:

    
    
         while (true) //Set CPU in Infinite loop DON'T REMOVE THIS ELSE I'll KILL YOU (^ . ^)
    

combined with things like your "How to contribute" section requiring that
anyone wanting to contribute is "dedicated", are frankly going to put anyone
off wanting to get involved with this. It also doesn't reflect well on your
maturity as a developer.

~~~
BinaryIdiot
I'm all for humorous comments, even if they're a bit flippant, but that
comment just isn't funny. Though I've met some great people with a sense of
humor that makes absolute no sense to me and that's just how it came off to me
versus a maturity issue (but without my experience I could easily see having
an identical opinion to yours).

The dedicated part though seems a little more ridiculous to me. Most people
who may contributed may not necessary be "dedicated" or even like the project
but just may want to help with someone. If I saw a project was looking for
dedicated contributors I'd be less likely to contribute anything as I don't
want to be married to someone else's project.

------
zamalek
There's also MOSA[1] and Cosmos[2]. MOSA is focusing more on the
compiler/runtime, while Cosmos is doing just enough to get a working OS. Both
are pure C#, it looks like Atom is too.

[1]: [https://github.com/mosa/MOSA-Project](https://github.com/mosa/MOSA-
Project) [2]:
[https://github.com/CosmosOS/Cosmos](https://github.com/CosmosOS/Cosmos)

~~~
amaneureka
Yeah. And I managed to take it to the next level with dynamic executable
loading and SVGA drivers.

~~~
mihular
But why not join forces with cosmos-instead of many half done OS we could have
one functional? Were there any particular reasons?

~~~
amaneureka
For couple of years I contributed to Cosmos and fixed some bugs in MOSA. But
my design idea was much different from them. So I decided to start with a new
project. And seems like it worked!

~~~
mihular
Can you elaborate on differences?

------
kodfodrasz
Nice, although I'd call the AssemblyAttribute EmitAssemblyAttribute, as the
Assmebly word has its special meaning in the .Net world, and can potentially
confusing (not to mention the assembly scoped attributes...)

~~~
amaneureka
Sure, Thanks :D

~~~
moon_priestess
[Removed to avoid distraction.]

~~~
amaneureka
I didn't mean that way. But I have updated the comment

~~~
moon_priestess
Apologies if I misinterpreted.

------
adzm
This sounds interesting but is really lacking details. Though... now I wonder
what happened to singularity / midori.

~~~
amaneureka
I am really sorry about lack of details on page. I am working on it and soon
add more detailed documentation.

Meanwhile You can try building it and play around with source.

[https://github.com/amaneureka/AtomOS/wiki/Build-
Environment](https://github.com/amaneureka/AtomOS/wiki/Build-Environment)

~~~
ifdefdebug
according to the license headers in the source files I am not even allowed to
copy the thing to my computer...

edit: ok, found the project license (bsd) but you really should update those
headers...

------
skybrian
I'm surprised C# is suitable for this. How does that work?

~~~
amaneureka
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...](https://github.com/amaneureka/AtomOS/tree/master/src/Compiler/Atomixilc)
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...](https://www.reddit.com/r/programming/comments/5xlmc6/a_new_hobby_os_from_scratch_in_c/dej2la3/)

~~~
pjmlp
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.

~~~
ianai
As a guy who really thinks *nix is awesome, I welcome new additions, too.

------
naasking
Looks like a traditional kernel, which I think is a shame. High-level
language-based operating systems have a lot more flexibility to enforce fine-
grained abstractions rather than a traditional OS's coarse-grained
abstractions.

For instance, memory safety is process-level in a traditional OS, but object-
level in a programming language. So paging logic doesn't make as much sense
here, since it would require a lot of expensive runtime support to make every
object lazily loaded, not to mention the expense of the bookkeeping overhead
to track which objects should be paged out.

This encourages a more event-oriented architecture where programs provide the
kernel with continuation when requesting services. For instance, something
like C#'s async/await operating at the kernel process level would be one
possible approach.

~~~
amaneureka
I strongly recommend you to build the kernel once and check output assembly
file. which should answer lot of your doubts like extra overhead of object
loading. It's not exactly same how you are interpreting. I tried very hard in
order to optimize the output code.

~~~
naasking
Are you saying this is not a traditional operating system design utilizing the
MMU for memory protection? If it is, then everything I said is accurate
compared to software isolation in an OS like Midori. If not, then you should
really point that out because it makes your project much more interesting!

~~~
amaneureka
Indeed it is utilizing MMU for memory protection. But no that is not the final
objective of project.

~~~
naasking
Sure, your objective is a standard operating system, and that's a neat
project. I'm just saying that a high-level language operating system provides
many more opportunities for different kinds of trade-offs than found in
typical commodity OSs. These aren't trade-offs you can make if you're going to
support legacy code or traditional OS abstractions, without jumping through a
lot of unnecessary hoops.

------
SwellJoe
There is an OS named "Atomic" (it is a Red Hat project, so not particularly
obscure), which seems pretty similar to "AtomOS" and "Atomix":
[http://www.projectatomic.io/](http://www.projectatomic.io/)

------
balajiarun
I see a lot of concepts simply borrowed from Cosmos, rewriting it and seeking
copyright - Especially the IL2Native compiler is very similar.

------
ishitatsuyuki
Not sure how it could deal with GC pause.

~~~
amaneureka
It does not. new operator internally calls Heap.kmalloc
[https://github.com/amaneureka/AtomOS/blob/master/src/Kernel/...](https://github.com/amaneureka/AtomOS/blob/master/src/Kernel/Atomix.Kernel_H/Core/Heap.cs)

To free any object instance I have to call Heap.Free

~~~
flukus
So random including random c# snippets would probably leak memory? I imagine
it would produce an uncanny valley feeling.

------
dmarlow
How is it different to
[https://github.com/FlingOS/FlingOS/](https://github.com/FlingOS/FlingOS/) ?

Not trying to be difficult, I'm just wanting to learn more about your project.

~~~
apotheon
I see it at least has a better license.

~~~
SwellJoe
Linux has done pretty well with the "worse" GPL license.

------
cd_cd
This is fantastic. I have heard of a few projects like this. I'm guessing
you're natively compiling the C# code. I'd love to contribute but I'd probably
just get in the way. Good luck - a glimpse of the future perhaps.

------
nkkollaw
No way to build on macOS..?

------
Animats
Yet another "multitasking monolithic kernel based x86 targeting operating
system" isn't that useful. Something new would help. A fast microkernel. A
hypervisor that runs containers. A kernel with better security for IoT.

~~~
pjmlp
Being written in C# makes it useful, because in this industry we lack
visionaries, and most only believe what is put in front of them.

------
jatins
That looks good!

(P.S. turns out we are from same college _and_ school)

~~~
amaneureka
oh! what's your name?

------
balajiarun
Does your compiler handle generics?

~~~
amaneureka
Yes!
[https://github.com/amaneureka/AtomOS/blob/master/src/Kernel/...](https://github.com/amaneureka/AtomOS/blob/master/src/Kernel/Atomix.Kernel_H/Lib/ds/Pair.cs)

------
_RPM
commits messages like "Open Sourced!" annoying

