什么是Dalvik的线程状态?线程、状态、Dalvik

2023-09-05 09:30:38 作者:Very cold. 很冷漠

每ANR转储列出了所有线程的状态在ANR的时间。我知道 WAIT 手段,而是做什么悬挂监控是什么意思?

Every ANR dump lists the states of all threads at the time of the ANR. I know what WAIT means but what do SUSPENDED and MONITOR mean?

在此先感谢...

推荐答案

中的Dalvik线程状态摘要:

Summary of Dalvik thread states:

初始化 - 还没有运行 启动 - 还没有运行,但几乎没有 ZOMBIE - 死者(你不应该看到这一点)。 运行(A / K / A RUNNABLE) - 线程正在运行。虚拟机有权暂停执行堆栈转储全部线程,所以你一般不会看到这个比一个被倾倒在堆栈以外的任何线程。 等待 - 线程调用wait(),并耐心等待 TIMED_WAIT - 线程调用wait(),有超时。 (Thread.sleep()方法实现为一个定时的等待。) 监控 - 线程阻塞在一个监视器锁定,即它坚持试图进入一个同步块 在原住民 - 线程正在执行的原生code。虚拟机不会暂停在本地code线,除非他们提出了一个JNI调用(在这一点上他们立即悬浮过渡到跑步,然后)。 vmwait - 正在线程被阻塞,获取虚拟机的资源,就像一个内部互斥。或者,也许在等待着什么做的(如编译器和GC线程)。 在暂停 - 线程运行的,但是已经暂停。如前所述,堆栈自卸车喜欢穿越的筹码之前,暂停所有的线程,所以你的忙线程通常会出现这样的。 (在旧版本中,这种状态是不存在的;曾经是一个非零SCOUNT RUNNING,暂停) INITIALIZING - not yet running. STARTING - not yet running, but almost there. ZOMBIE - deceased (you shouldn't see this). RUNNING (a/k/a RUNNABLE) - thread is actively running. The VM has to suspend all threads to do the stack dump, so you generally won't see this for any thread other than the one that is dumping the stack. WAIT - the thread called wait(), and is patiently waiting. TIMED_WAIT - thread called wait(), with a timeout. (Thread.sleep() is implemented as a timed wait.) MONITOR - thread is blocked on a monitor lock, i.e. it's stuck trying to enter a "synchronized" block. NATIVE - thread is executing in native code. The VM doesn't suspend threads in native code unless they make a JNI call (at which point they transition to RUNNING, and then immediately to SUSPENDED). VMWAIT - thread is blocked acquiring a VM resource, like an internal mutex. Or maybe waiting for something to do (e.g. the Compiler and GC threads). SUSPENDED - thread was runnable, but has been suspended. As noted earlier, the stack dumper likes to suspend all threads before traversing their stacks, so your busy threads will generally show up this way. (In older releases, this state did not exist; "suspended" used to be "RUNNING with a nonzero sCount".)
 
精彩推荐
图片推荐