也是Android垃圾收集器暂停其他应用程序运行时? [英] Is Android garbage collector pausing other apps while running?

查看:144
本文介绍了也是Android垃圾收集器暂停其他应用程序运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现关于Android的垃圾收集器是矛盾给我一些信息。

I've found some information about the Android garbage collector that are contradictions to me.

Android的Devevelopers指南说:

Android Devevelopers Guide says:

3.0的Andr​​oid是第一个版本的平台的设计上运行   无论是单核或多核处理器架构。各种各样   改变Dalvik虚拟机,仿生图书馆和其他地方添加支持   在多核环境中对称多。这些   优化可以惠及所有的应用程序,即使是那些   单线程。例如,具有两个活动核心,一个单线程   应用程序仍然可能看到性能的提升,如果在Dalvik垃圾   集电极运行在第二芯。该系统将安排这   自动完成。

Android 3.0 is the first version of the platform designed to run on either single or multicore processor architectures. A variety of changes in the Dalvik VM, Bionic library, and elsewhere add support for symmetric multiprocessing in multicore environments. These optimizations can benefit all applications, even those that are single-threaded. For example, with two active cores, a single-threaded application might still see a performance boost if the Dalvik garbage collector runs on the second core. The system will arrange for this automatically."

好了,现在其他的事情

根据此链接:的Dalvik虚拟机架构 Android使用标记和清除的形式给出。

According to this link: The Dalvik Virtual Machine Architecture android uses mark and sweep aproach.

在Dalvik的垃圾收集器目前的策略是保持大关   位,或比特指示特定对象是   到达,因此不应被垃圾收集,分离   从其他堆内存。

The current strategy in the Dalvik garbage collector is to keep mark bits, or the bits that indicate that a particular object is "reachable" and therefore should not be garbage collected, separate from other heap memory.

如果我们检查如何标记和清除工作此链接: 标记和清除垃圾收集算法 ,我们可以看到这样的:

If we check how mark and sweep works on this link: Mark and Sweep Garbage Collection Algorithm , we can see this:

的标记 - 扫描方法的主要缺点是以下事实   正常的程序执行暂停,而垃圾   回收算法运行。尤其是,这可以是在一个有问题   程序,它与人类用户交互或必须满足   实时执行的限制。例如,交互式   使用标记 - 清除垃圾收集成为应用   反应迟钝定期。

The main disadvantage of the mark-and-sweep approach is the fact that that normal program execution is suspended while the garbage collection algorithm runs. In particular, this can be a problem in a program that interacts with a human user or that must satisfy real-time execution constraints. For example, an interactive application that uses mark-and-sweep garbage collection becomes unresponsive periodically.

所以,我现在的问题是,它是如何真正发挥作用?有没有垃圾回收器暂停,而他的工作,或者是他能够运行在其他活动的处理器内核?

So my question now is, how does it really work? Does garbage collector pause everything while he is working, or is he capable of running completely independent on the other active processor core?

推荐答案

Dalvik虚拟机在姜饼和超越版本使用大多并发局部集合垃圾收集器暂停时间通常约为5毫秒。所以,是的,GC是影响其他应用程序通过停止他们,但并发GC算法能够minimaze这些停顿。

The Dalvik VM in the Gingerbread and beyond version is using the Mostly Concurrent partial collection garbage collector with pause times usually around 5ms. Therefore, yes, the GC is influencing the other apps by stopping them but the concurrent GC algorithm is able to minimaze these pauses.

您应该看看:

  • Technical details of Android Garbage Collector
  • Does the DalvikVM Garbage Collector halt the whole VM?

在一般情况下,垃圾收集理论<一href="http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29#Stop-the-world_vs._incremental_vs._concurrent">[Garbage收藏百科] 说明:

In general, the Garbage Collection theory [Garbage Collection Wiki] explains:

  • 停止这世界的垃圾收集器完全停止执行程序运行一个采集周期的

  • Stop-the-world garbage collectors completely halt execution of the program to run a collection cycle

增量和并发垃圾收集器旨在通过减少这种破坏 从主程序交织他们与活动的工作。增量式的垃圾收集器 执行垃圾收集周期在独立的阶段,与之间允许的程序执行 每一个阶段(有时在某些阶段)。

Incremental and concurrent garbage collectors are designed to reduce this disruption by interleaving their work with activity from the main program. Incremental garbage collectors perform the garbage collection cycle in discrete phases, with program execution permitted between each phase (and sometimes during some phases).

这篇关于也是Android垃圾收集器暂停其他应用程序运行时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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