简体   繁体   English

CLR中的确定性GC?

[英]Deterministic GC in the CLR?

are there any CLR implementations that have deterministic garbage collection? 是否有任何CLR实现具有确定性垃圾收集?

Nondeterministic pauses in the MS CLR GC inhibit .Net from being a suitable environment for real-time development. MS CLR GC中的不确定性暂停会抑制.Net成为适合实时开发的环境。

Metronome GC and BEA JRockit in Java are two deterministic GC implementations that I'm aware of. Metronome GC和Java中的BEA JRockit是我所知道的两个确定性GC实现。

But have there any .Net equivalents? 但是有任何.Net等价物吗?

Thanks 谢谢

There is no way to make the GC deterministic, expect of course from calling GC.Collect() exactly every second using a timer ;-). 没有办法让GC确定性,当然希望使用计时器来调用GC.Collect()每一秒;-)。

The GC however does contain a notification mechanism (since .NET 3.5 SP1) that allows you to be notified when a gen 2 collect is about to happen. 但是,GC确实包含一个通知机制(自.NET 3.5 SP1起),它允许您在第2代收集即将发生时收到通知。 You can read about it here . 你可以在这里阅读它。

The GC now also contains multiple latency modes that make it possible to prevent any GC collects from occurring. GC现在还包含多种延迟模式,可以防止任何GC收集发生。 Of course you should be very careful with this, but is especially useful for real-time systems. 当然你应该非常小心,但对实时系统特别有用。 You can read more about it here . 你可以在这里阅读更多相关信息。

No, there are non. 不,有非。 From my experience .net can't be used to create real time systems for many reasons, not only about garbage collection. 根据我的经验,.net不能用于创建实时系统,原因很多,不仅仅是关于垃圾收集。 C or C++ are better choice. C或C ++是更好的选择。 Also modern OSes do not provide deterministic scheduling, and it is about all applications, regardless of language. 现代操作系统也不提供确定性调度,它涉及所有应用程序,无论语言如何。

You would have to control the GC yourself in order to get predictable real-time behaviour, but if you are doing this then you may as well not use a managed language. 您必须自己控制GC以获得可预测的实时行为,但如果您这样做,那么您也可以不使用托管语言。

For real-time systems you need control over everything that is running. 对于实时系统,您需要控制正在运行的所有内容。 There are third-party modifications to Windows XP that make it real-time (can't remember if it's soft or hard real-time though). Windows XP的第三方修改使其成为实时(不记得它是否是软实时或硬实时)。

Completely unfeasible option. 完全不可行的选择。 Look into Cosmos OS - written in C# and compiled to assembler I think - might be able to do something with that :) 看看Cosmos操作系统 - 用C#编写并编译成汇编程序我认为 - 也许可以用那个做:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM