What are the Dalvik thread states?

ぃ、小莉子 提交于 2019-11-28 18:27:57

Summary of Dalvik thread states:

  • 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".)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!