您将如何在嵌入式实时环境中使用 D? [英] How would you approach using D in a embedded real-time environment?

查看:18
本文介绍了您将如何在嵌入式实时环境中使用 D?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于所有熟悉 D 编程语言的人,如何在嵌入式中使用它实时环境?我知道它的原始设计并非针对实时嵌入式环境,但这个问题更多的是关于如何实现实时功能.

To all those familiar with D programming language, how would go about using it in a embedded real-time environment? I understand that it's original design is not targeted for real-time embedded environments, but this question is more about how would you go about making real-time capability happen.

该语言的哪些结构是必不可少的?

Which constructs of the language would be indispensable?

您认为哪些构造会成为问题?

Which constructs do you see would be a problem?

有人在嵌入式系统中成功使用过吗?

Has anyone successfully used it in a embedded system?

任何其他想法或建议都会很棒.

Any other thoughts or suggestions would be great.

推荐答案

D 并不是真正的用于实时应用程序,主要是因为 D 的某些语言特性依赖于它的垃圾收集器,而 D 的垃圾收集器是不可预测的并且会偶尔暂停你的程序来收集垃圾.引用:

D isn't really meant for use in real-time applications, mostly because some language features of D rely on its garbage collector, and D's garbage collector is unpredictable and will sporadically pause your program to collect garbage. Quoting:

垃圾收集不是灵丹妙药.有一些缺点:

Garbage collection is not a panacea. There are some downsides:

  • 集合何时运行是不可预测的,因此程序可以任意暂停.
  • 集合运行所需的时间没有限制.虽然在实践中它非常快,但不能保证这一点.
  • 在收集过程中,除了收集器线程之外的所有线程都必须停止.

您仍然可以在没有垃圾收集器的情况下使用 D(通过手动管理内存,例如在 C/C++ 中) - 这将阻止您使用某些语言功能,例如关联数组和内部分配内存而不释放/返回的库函数参考它.D 在许多不依赖于内存管理的领域(例如元编程)仍然表现出色.

You can still use D without a garbage collector (by managing memory manually, like in C/C++) - this will prevent you from using certain language features like associative arrays, and library functions that internally allocate memory without deallocating/returning a reference to it. D still excels in many areas not dependent on memory management (such as metaprogramming).

这篇关于您将如何在嵌入式实时环境中使用 D?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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