52ky 发表于 2021-6-14 15:22:21

TinyOS in C# (Write your own OS in C#)

TinyOS in C# (Write your own OS in C#),有些地方在晚上上学的时候,我们被要求在操作系统课上写一个“虚拟 CPU 和操作系统”。更多的是解释器,我们得到了操作系统的描述、一些操作码和类似 ASM 的机器语言。我们要编写操作系统,并将测试程序输入系统。这是一个有趣的练习,也是教人们虚拟内存和内存映射如何工作、线程与进程等的好方法。我是唯一一个选择用托管代码编写它的学生。完全是 2002 年的政变。我提交了这个项目并把它放到 GotDotNet 上(这个链接将在 2007 年 7 月失效),但当然,GDN 很快就会消失。只是为了不会丢失,它现在在 C# 中可用。我认为这实际上很有趣,因为我加入了一些“笑话” - 至少对我来说很有趣。例如,当“物理”内存用完时,操作系统将其虚拟内存分页到 XML 文件。它的行为就像一个真正的小操作系统。它会因内存不足而崩溃,如果发生很多事情,它会变得支离破碎。
一个完全用 C# 编写的微型虚拟 CPU 和操作系统。 TinyOS 模拟了理论操作系统的调度、内存管理(包括分页和虚拟内存)等操作。您将看到许多正在使用的框架类和技术,包括正则表达式、XML 序列化、生成的强类型集合、XML 注释和生成的帮助文件。您不会从 TinyOS 本身获得太多有用的工作,但您将学到的技术可以应用于现实生活。
由于这个小曲子,其他真正知道自己在做什么的人已经用 C# 编写了更重要的操作系统,值得一看。

(Some where in the middle of going to school at night we were asked in an Operating Systems class to write a "Virtual CPU and OS." More of an interpreter, we were given a description of the OS, some op-codes and an ASM-like machine language. We were to write the OS, and feed test programs into the system. It was a fun exercise and a good way to teach folks how virtual memory and memory mapping works, threads vs. processes, etc. I was the only student who chose to write it in managed code. Quite the coup for 2002.
I turned in the project and threw it up on GotDotNet (this link will be dead in July of 2007), but of course, GDN will be gone soon. Just so it wouldn't be lost, it's now available here in C#. It's actually kind of fun, I think, as I put in some "jokes" - funny to me at least. For example, the OS pages it's virtual memory to XML files when it runs out of "physical" memory. It behaves like a real little OS. It'll thrash with low memory, and get fragmented if a lot is going on.
A tiny virtual CPU and OS written entirely in C#. The TinyOS simulates the scheduling, memory management (including paging and virtual memory) and other operations of theoretical Operating System. You’ll see many Framework classes and techniques in use including Regular Expressions, XML Serialization, generated Strongly Typed Collections, XML Comments and a generated Help file. You won’t get much useful work out of the TinyOS itself, but the techniques you’ll learn can be applied to real life.
Since this little ditty, others who really know what they are doing have written more serious OS's in C# that are worth looking at.)



页: [1]
查看完整版本: TinyOS in C# (Write your own OS in C#)