将 Haskell 用于大型实时系统:如何(如果?)? [英] Using Haskell for sizable real-time systems: how (if?)?

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

问题描述

我一直想知道是否有可能将 Haskell 的强大功能应用于嵌入式实时世界,并且在谷歌搜索中发现了 Atom 包.我假设在复杂的情况下,代码可能具有所有经典的 C 错误 - 崩溃、内存损坏等,然后需要追溯到原始的 Haskell 代码造成他们.所以,这是问题的第一部分:如果你有使用 Atom 的经验,你是如何处理在编译的 C 代码中调试低级错误并在 Haskell 原始代码中修复它们的任务的?"

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 ?"

我为 Atom 搜索了更多示例,这篇博文 提到了生成的 C 代码 22KLOC(显然没有代码:),包含的示例 是一个玩具.这个this 引用有一些更实用的代码,但这就是结束的地方.我在这个主题中加上相当大"的原因是,如果您可以分享您在 300KLOC+ 范围内使用生成的 C 代码的经验,我最感兴趣.

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+.

由于我是 Haskell 新手,显然由于我的未知数,我可能没有找到其他方法,因此将不胜感激任何其他在该领域进行自我教育的指针 - 这是第二部分问题 - 在 Haskell 中进行实时开发的其他一些实用方法(如果)是什么?".如果多核也在图片中,那是一个额外的好处:-)

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 :-)

(关于为此目的使用 Haskell 本身:从我在 这篇博文,Haskell 中的垃圾收集和惰性使得它在调度方面相当不确定,但也许在两年内发生了一些变化.真实世界 Haskell 编程 关于 SO 的问题是我能找到的最接近该主题的问题)

(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)

注意:上面的实时"更接近硬实时"——我很好奇是否可以确保主任务未执行时的暂停时间是低于 0.5 毫秒.

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.

推荐答案

在 Galois,我们使用 Haskell 有两个目的:

At Galois we use Haskell for two things:

  • 软实时(操作系统设备层、网络),其中 1-5 毫秒的响应时间是合理的.GHC 生成快速代码,并为调整垃圾收集器和调度程序以获得正确的时间提供大量支持.
  • 对于真正的实时系统,EDSL 用于为其他语言生成代码,以提供更强的时序保证.例如.Cryptol、Atom 和 Copilot.

所以要小心区分 EDSL(Copilot 或 Atom)和宿主语言(Haskell).

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

关键系统的一些示例,在某些情况下,实时系统,无论是编写的还是从 Haskell 生成的,由 Galois 制作.

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

EDSL

  • Copilot: A Hard Real-Time Runtime Monitor -- a DSL for real-time avionics monitoring
  • Equivalence and Safety Checking in Cryptol -- a DSL for cryptographic components of critical systems

系统

  • HaLVM -- 适用于嵌入式和移动应用程序的轻量级微内核
  • TSE -- 跨域(安全级别)网络设备
  • HaLVM -- a lightweight microkernel for embedded and mobile applications
  • TSE -- a cross-domain (security level) network appliance

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

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