Jonathan 的个人资料Jonathan Chayce Dickinso...日志 工具 帮助

日志


1月23日

Cosmos

I'll make my first real post an introduction to Cosmos (which neither stands for something nor does not stand for anything). Cosmos is an open source operating system written in 100% pure home-grown C#. How do we do this?

Il2Cpu

IL2CPU is a compiler that compiles CIL (Common Intermediate Language) to ML (Machine Language). CIL can not be run directly on a CPU (currently, at least): but it is what C# compiles to. ML is what your CPU understands.

To get around the issue of needing ML at some point we inline assembler into C# (but it is strongly typed and all that amazing goodness). We can 'plug' methods in the corlib (.Net base library) and replace object and method implementations (this is a work in progress - a lot more needs to be done on the front of plugs).

Why IL?

So why are bothering to use IL in the first place?

  1. Languages that compile directly to ML generally suck (that includes 'hardcore' C/C++), why?
    1. ML is unsafe - write buggy programs (which even the best programmers do) and you are opening security holes: just look at Windows. 
    2. ML is complicated - yes, spend 10 years writing your operating system in C to prove your point.
    3. ML is only faster in academic situations - in very, very, very academic situations. Not to mention that up until now CIL has been benchmarked on an ML operating system.
    4. ML is static - you don't take advantage of MMX/SSE/3DNow automatically.
  2. It's a challenge.
  3. It's a philosophical leap.
  4. It's controversial.
    1. Everyone tells us that we can't and throws stones at us. Kinda like the nerd in elementary school who grows up and lands up being their boss.
  5. It will be easier in the long run.

What We Are Looking Forward To

We are really looking forward to:

  • Strongly typed drivers
  • Modular system
  • Uber security
  • Filesystem abstraction (read WinFS)