C#.NET可以用于硬实时吗? [英] Can C# .NET be used for hard real-time?

查看:48
本文介绍了C#.NET可以用于硬实时吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于.NET的熟悉形式是在Windows上运行,而不是实时O/S,而MONO在Linux上运行(标准内核也不是实时O/S).

Given that the familiar form of .NET is run on Windows, which is not a real-time O/S, and MONO runs on Linux (standard kernel is also not a real-time O/S).

还考虑到,任何提供垃圾回收的内存分配方案(如在托管" .NET中)以及实际上任何堆内存方案都会在应用程序的执行行为中引入不确定的,可能不重要的延迟.

Given also, that any memory allocation scheme offering garbage collection (as in "managed" .NET), and indeed any heap memory scheme will introduce non-deterministic, potentially non-trivial delays into an application's execution behavior.

是否存在替代主机O/S和编码范例的组合,在其中可以实现C#.NET的所有功能和便利,同时实现一种可以在严格指定的时间限制内执行指定代码部分的解决方案?例如每10毫秒就启动一个C#方法,使其容差小于1毫秒,而完成时间仅取决于该方法本身所完成的工作吗?

Is there any combination of alternate host O/S and coding paradigm in which one can leverage all of the power and conveniences of C# .NET while implementing a solution which can execute designated portions of code within tightly specified time constraints? e.g. start a C# method every 10ms to a tolerance of less than 1ms, with completion time determined only by the work performed in the method itself?

显然,该应用程序必须仔细编写;时间紧迫的代码将不得不避免内存分配;一旦启动硬实时循环,应用程序将必须完成其所有内存分配等工作,并且没有其他线程处于活动状态.另外,主机操作系统必须支持实时调度.

Obviously, the application would have to be carefully written; time-critical code would have to avoid memory allocations; the application would have to have completed all its memory allocation etc. work and have no other threads active once the hard real-time loop is started. Also, the host O/S would have to support real-time scheduling.

.NET/MONO框架内是否可能实现此功能,还是在支持.NET运行时,框架和支持它(或兼容等效产品)的O/S的设计中排除了这种可能性?

Is this possible within the .NET / MONO framework, or is it precluded by the design of the .NET runtime, framework, and O/Ss on which it (or compatible equivalent) is supported?

例如:是否可以使用 NETduino 之类的东西完全用C#进行可靠的细粒度(〜1ms)机器控制,或者他们有限制或需要针对此类应用的替代策略?

For example: is it possible to do reliable fine-grained (~1ms) machine control purely in C# with something like NETduino, or do they have limits or require alternate strategies for such applications?

推荐答案

简短答案:否

更长的答案:最接近的是直接在硬件上运行 .net Micro Framework ,但是TinyCLR仍然不能给您确定的时间.Microsoft已将 Windows CE/Windows Embedded Compact 作为其实时产品,但是即使如此,这也只能用于较慢的任务(I相信在50微秒或更长的时间范围内-不确定是否符合硬实时"条件

Longer answer: The closest you can get is running the .net Micro Framework directly on Hardware, but the TinyCLR still doesn't give you deterministic timings. Microsoft has Windows CE/Windows Embedded Compact as their real time offering, but even that is only real time for slower tasks (I believe somewhere in the range of 50 microseconds or more - not sure if that qualifies for Hard Real Time)

我不知道在技术上是否可以创建实时c#实现,但是没有人做过甚至

I do not know if it were technically possible to create a real-time c# implementation, but no one has done one and even .net native isn't made for that.

这篇关于C#.NET可以用于硬实时吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆