使用Haskell进行相当大的实时系统:如何(如果?)? [英] Using Haskell for sizable real-time systems: how (if?)?

查看:138
本文介绍了使用Haskell进行相当大的实时系统:如何(如果?)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,可以理解是否可以将Haskell的实力应用于嵌入式实时世界,而谷歌搜索已经发现了 Atom 包。我会假设在复杂的情况下,代码可能具有所有古典的C错误 - 崩溃,内存损坏等,然后需要跟踪到
导致的原始Haskell代码。所以,这是问题的第一部分:如果你有Atom的经验,那么你是如何处理调试编译C代码中的低级别错误并将其固定在Haskell原始代码中的任务?



我搜索了更多的Atom例子,本博客提到生成的C代码22KLOC(显然没有代码:),包含的例子是一个玩具。 这个引用有一些更实用的代码,但这是这个结束的地方。而且我把这个主题放在大小上的原因是,如果你可以分享你在300KLOC +范围内使用生成的C代码的经验,最感兴趣的话。



由于我是一名Haskell新手,显然可能还有其他方式,我没有找到由于我未知的未知数,所以在这方面的任何其他自我教育指针将非常感谢 - 这是问题的第二部分 - 在Haskell中进行实时开发将是一些其他实际方法(如果)。如果多核还在图片中,那是一个额外的加号:-)



(关于Haskell本身为此使用的用法:从我在本博客,Haskell中的垃圾回收和懒惰使得它非常不确定安排明智,但也许在两年内有所改变。真实世界Haskell编程关于SO的问题是最接近我的这个话题)



注意:上面的实时会更接近硬实时 - 如果可以确保主任务未执行的暂停时间小于0.5ms,我很好奇。

解决方案

在Galois,我们使用Haskell两件事:




  • 软实时(OS设备层,网络),其中1-5 ms res响应时间是合理的。 GHC生成快速代码,并且有足够的支持来调整GC和调度程序以获得正确的时间。

  • 用于真正的实时系统EDSL用于为其他语言提供更强的代码定时保证。例如。 Cryptol,Atom和Copilot。



所以要小心区分EDSL(Copilot或Atom)和主机语言(Haskell) / p>




关键系统的一些示例,在某些情况下,由Haskell编写或生成的实时系统,由Galois。



EDSLs





系统




  • HaLVM - 用于嵌入式和移动应用程序的轻量级微内核/ li>
  • TSE - 域(安全级别)网络设备


I've been curious to understand if it is possible to apply the power of Haskell to embedded realtime world, and in googling have found the Atom package. I'd assume that in the complex case the code might have all the classical C bugs - crashes, memory corruptions, etc, which would then need to be traced to the original Haskell code that caused them. So, this is the first part of the question: "If you had the experience with Atom, how did you deal with the task of debugging the low-level bugs in compiled C code and fixing them in Haskell original code ?"

I searched for some more examples for Atom, this blog post mentions the resulting C code 22KLOC (and obviously no code:), the included example is a toy. This and this references have a bit more practical code, but this is where this ends. And the reason I put "sizable" in the subject is, I'm most interested if you might share your experiences of working with the generated C code in the range of 300KLOC+.

As I am a Haskell newbie, obviously there may be other ways that I did not find due to my unknown unknowns, so any other pointers for self-education in this area would be greatly appreciated - and this is the second part of the question - "what would be some other practical methods (if) of doing real-time development in Haskell?". If the multicore is also in the picture, that's an extra plus :-)

(About usage of Haskell itself for this purpose: from what I read in this blog post, the garbage collection and laziness in Haskell makes it rather nondeterministic scheduling-wise, but maybe in two years something has changed. Real world Haskell programming question on SO was the closest that I could find to this topic)

Note: "real-time" above is would be closer to "hard realtime" - I'm curious if it is possible to ensure that the pause time when the main task is not executing is under 0.5ms.

解决方案

At Galois we use Haskell for two things:

  • Soft real time (OS device layers, networking), where 1-5 ms response times are plausible. GHC generates fast code, and has plenty of support for tuning the GC and scheduler to get the right timings.
  • for true real time systems EDSLs are used to generate code for other languages that provide stronger timing guarantees. E.g. Cryptol, Atom and Copilot.

So be careful to distinguish the EDSL (Copilot or Atom) from the host language (Haskell).


Some examples of critical systems, and in some cases, real-time systems, either written or generated from Haskell, produced by Galois.

EDSLs

Systems

  • HaLVM -- a lightweight microkernel for embedded and mobile applications
  • TSE -- a cross-domain (security level) network appliance

这篇关于使用Haskell进行相当大的实时系统:如何(如果?)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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