垃圾收集器(.net / java)是实时系统的问题吗? [英] Is a garbage collector (.net/java) an issue for real-time systems?

查看:109
本文介绍了垃圾收集器(.net / java)是实时系统的问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我记得几年前的一些恐怖故事,其中典型的是例子总是一个动作游戏,你的角色会在跳跃中停止几秒钟,当垃圾收集器进行清理时。



我们还有几年时间,但我想知道这是否仍然是一个问题。我在.Net 4中看到了新的垃圾收集器,但它看起来很像一个大黑盒子,你只需要相信一切都可以。



如果你有一个系统总是必须快速响应,有一个垃圾回收器太大的问题,是不是更好地选择一个更硬核,控制它自己像c + +语言?我讨厌它,如果事实证明是一个问题,基本上几乎没有什么可以做的,除了等待新版本的运行时或者做非常奇怪的事情来尝试影响收集器。 p>

编辑

感谢所有的优秀资源。但是,似乎大多数articles / custom gc's / solutions都适用于Java环境。 .Net是否也有自定义GC的调整功能或选项?

准确地说,垃圾收集器是真正的问题时间系统。更准确地说,可以使用具有自动内存管理的语言编写实时软件。

更多详细信息可以在 Java实时规范,介绍了使用Java实现实时行为的一种方法。 RTSJ背后的想法很简单 - 不要使用堆。 RTSJ提供了新的Runnable对象,确保线程不会访问任何类型的堆内存。线程可以访问作用域内存(这里没有什么不寻常的东西,当关闭作用域时值被破坏)或永久内存(在整个应用程序生命周期中都存在)。永久内存中的变量会一次又一次地写入新值。

通过使用永久内存,RTSJ确保线程不会访问堆,以及更多重要的是,系统没有一个垃圾回收器来抢占线程执行的程序。



更多详细信息请参阅Project Golden Gate:迈向太空任务中的实时Java由JPL发布和Sun

When building a system which needs to respond very consistently and fast, is having a garbage collector a potential problem?

I remember horror stories from years ago where the typical example always was an action game where your character would stop for a few seconds in mid-jump, when the garbage collector would do its cleanup.

We are some years further, but I'm wondering if this is still an issue. I read about the new garbage collector in .Net 4, but it still seems a lot like a big black box, and you just have to trust everything will be fine.

If you have a system which always has to be quick to respond, is having a garbage collector too big of a problem and is it better to chose for a more hardcore, control it yourself language like c++? I would hate it that if it turns out to be a problem, that there is basically almost nothing you can do about it, other than waiting for a new version of the runtime or doing very weird things to try and influence the collector.

EDIT

thanks for all the great resources. However, it seems that most articles/custom gc's/solutions pertain to the Java environment. Does .Net also have tuning capabilities or options for a custom GC?

解决方案

To be precise, garbage collectors are a problem for real-time systems. To be even more precise, it is possible to write real-time software in languages that have automatic memory management.

More details can be found in the Real Time Specification for Java on one of the approaches for achieving real-time behavior using Java. The idea behind RTSJ is very simple - do not use a heap. RTSJ provides for new varieties of Runnable objects that ensure threads do not access heap memory of any kind. Threads can either access scoped memory (nothing unusual here; values are destroyed when the scope is closed) or immortal memory (that exists throughout the application lifetime). Variables in the immortal memory are written over, time and again with new values.

Through the use of immortal memory, RTSJ ensures that threads do not access the heap, and more importantly, the system does not have a garbage collector that preempts execution of the program by the threads.

More details are available in the paper "Project Golden Gate: Towards Real-Time Java in Space Missions" published by JPL and Sun.

这篇关于垃圾收集器(.net / java)是实时系统的问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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