基于 .NET Framework 构建的 Linux 发行版

发布于 2024-08-08 11:36:07 字数 272 浏览 5 评论 0原文

我是一名计算机科学工程专业的学生,​​我已经在 .NET Framework 上编程 2-3 年了,但我还没有使用过 Linux。我想,对于我最后一年的项目,Linux 发行版会很好。

当我想到一些疯狂的想法时,我正在考虑几种实现它的方法:

我们可以先在 Linux 内核上实现 .NET Framework,然后使用它构建其余部分吗?

这可能是最奇怪的问题,但如果我问的问题是正确的,请给我一个方法,如果我错了,请纠正我。

I am a computer science engineering student and I've been programming on the .NET Framework for 2-3 years but I haven't used Linux. I thought, for my final year project, a Linux distro would be good.

I was thinking of a few ways to implement it, when this crazy idea occurred to me:

Can we implement the .NET Framework first on the Linux Kernel and build the rest using it?

This could be the weirdest question but please be give me a way if I am right in asking the question and correct me if am wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

‘画卷フ 2024-08-15 11:36:07

.NET 框架的功能太丰富了,如果没有从 libc 开始的大量用户空间帮助程序,将其全部构建在裸 Linux 内核之上是没有意义的。恕我直言,对于单个学生的博士论文来说,这并非不可能,但过于雄心勃勃(如果你的目标是比博士学位更低的学位,则更是如此)。

查看 mono 的 .NET 独立于 Windows 的实现以及它所依赖的一切 - 并考虑一下如何在您自己的论文范围内,在您自己的 Mono 分支中减少(而不是消除;-)用户空间依赖性(当然,假设任何论文顾问都会在这方面注册支持您)。

The functionality of the .NET framework is too rich to make sense to build it all on top of a bare Linux kernel without substantial userspace helpers starting with libc. Not impossible, but way too ambitious, IMHO, for a single student's PhD thesis (and much more so if you're aiming at a lower degree than a doctorate).

Look at mono for a Windows-independent implementation of .NET and all it depends on -- and think of how you could reduce (not eliminate;-) userspace dependencies on your own, within your thesis' span, in a fork of Mono of your own (assuming any thesis advisor would sign up to support you in that, of course).

南冥有猫 2024-08-15 11:36:07

对于问题的第一部分,您可能需要查看 mono 项目,它是 .net 的实现在 c# 中。

至于第二部分,我不知道为什么你想在.net中实现Linux内核。这似乎有点倒退的处理方式。

如果您有兴趣在 C# 中实现操作系统,请查看 Singularity这是一个用c#开发的研究操作系统

For the first part of your question you might want to checkout the mono project which is an implementation of .net in c#.

As to the second part, I don't know why you'd want to implement the Linux Kernal in .net. It seems like a bit of a backwards way of approaching the thing.

If you're interested in implementing an operating system in c# check out Singularity which is a research operating system developed in c#

妳是的陽光 2024-08-15 11:36:07

CLR(又名 .NET 框架)已经在 Linux 上的 Mono 中至少实现过一次。

确实,您可以制作一个附带 Mono 的 Linux 发行版,或者使用 .NET 作为其某些启动脚本/守护程序。那就好了。可能有人已经这样做了。

我不知道尝试在内核中运行托管代码会带来什么好处,可能没有。在内核中运行托管代码将非常困难,因为在内核内存分配的许多部分都需要仔细完成 - 您可能没有足够的控制权。此外,默认情况下内核堆栈可能太小等等。内核中的某些上下文根本不能进行堆内存分配。

The CLR (aka .NET framework) has been implemented at least once on Linux, in Mono.

True, you could make a Linux distribution which ships Mono, or uses .NET for some of its startup scripts / daemons. That would be fine. Someone has probably already done this.

I don't see exactly what advantage trying to run managed code in the kernel would confer, probably none. Running managed code in the kernel would be very difficult because in many parts of the kernel memory allocation needs to be done carefully - you'd probably not have enough control. Moreover, the kernel stacks are probably too small by default etc. There are some contexts in the kernel where heap memory allocation must not be done at all.

旧伤还要旧人安 2024-08-15 11:36:07

您可以尝试修改内核,他使用单框架并且仅在用户空间中运行托管代码。

You could try to modify the kernel, that he uses the mono-framework and runs only managed code in userspace.

流绪微梦 2024-08-15 11:36:07

您可以使用 Visual Studio .NET + Grasshopper 的组合来完成此操作。
请检查此链接以获取更多信息。
http://dev.mainsoft.com/Default.aspx?tabid=45

you can do this using combination of Visual Studio .NET + Grasshopper.
Plase check this linke for more information.
http://dev.mainsoft.com/Default.aspx?tabid=45

就是爱搞怪 2024-08-15 11:36:07

.NET 框架包含许多实用程序类,例如字符串或集合。

由于从用户空间转换到内核空间是有代价的,性能实际上会变得更糟,除非您设法在内核空间中运行整个应用程序。

不想每次向列表添加内容或检查字符串的长度时都进行系统调用。

The .NET framework contains a lot of utility classes like strings or collections.

As transitioning from user space to kernel space comes at a cost, performance would actually get worse, unless you manage to run your whole application in kernel space.

Wouldn't wanna do a syscall every time I add something to a list, or check the length of a string.

白芷 2024-08-15 11:36:07

让 Linux 内核运行的是 c 运行时库,因此添加 mono 库和其他依赖项,我想它可以让它工作(至少对于 C# 来说)。

What makes the Linux kernel run is the c runtime libraries, so add in the mono libraries and other dependencies and I guess it make be possible to get it to work(at least with C#).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文