是否DalvikVM垃圾收集器停止整个虚拟机? [英] Does the DalvikVM Garbage Collector halt the whole VM?
问题描述
我有一种情况,其中我的Android应用程序是不能够及时执行软实时任务以及垃圾收集器被称为它需要几毫秒。对给GC时间几毫秒不足以错过一些重要的最后期限从IO设备读取数据的小任务。
I have a situation in which an my Android application is not able to perform a soft real time task well in time as Garbage Collector is called which takes a few milliseconds. The few ms of time given to GC is inadequate to miss some important deadline for small tasks of reading data from IO device.
我在想引入另一个线程,给它投票的任务的重要数据。不过,我不知道,如果GC暂停所有线程或只是内存占用的呢?
I was thinking about introducing another thread and giving it the task of polling the important data. However I'm not sure if GC suspends all threads or just the memory hogging ones?
推荐答案
在的的Android应用的帕特里克内存管理 Dubroy我发现了以下(幻灯片16,重点煤矿):
In Memory Management for Android Apps by Patrick Dubroy I found the following (slide 16, emphasis mine):
-
pre-姜饼GC:
Pre-Gingerbread GC:
-
超炫的世界
Stop-the-world
全堆集合
暂停时间通常> 100ms的
姜饼及以后:
-
并发(大部分)
Concurrent (mostly)
部分集合
暂停时间通常< 5ms的
在一般情况下,垃圾收集必须停止整个虚拟机,但现在这个时间大大缩短。然而无论虚拟机,也没有Android平台作为一个整体不是实时操作系统,所以不要指望这样严格的保证。
In general, garbage collection must stop the whole VM, although nowadays this time greatly reduced. However neither VM nor Android platform as a whole are not real-time operating systems so don't expect such strict guarantees.
为什么需要一个毫秒precision?
Why do you need single millisecond precision?
这篇关于是否DalvikVM垃圾收集器停止整个虚拟机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!