Multithreading (iii)

Source: Internet
Author: User

Four states of a thread

1 generation (new): The thread object has been generated but has not been started, so it cannot be executed, and the start () method is not called after the object is generated by new.

2 executable (Runnable): Each multithreaded system has a scheduler, the scheduler selects a thread from the thread pool and starts it, when a thread is in the executable state, it may be in the thread pool waiting for the scheduler to start it, or it may be executing. If a thread object's start () method is executed, the thread is in an executable state. However, it is clear that the thread may not be in the execution. Have execute permissions, but not executed.

3 Stagnation (Blocks): When a thread is stuck, the system scheduler ignores it and does not schedule it. When a stalled thread returns to its executable state, it may be re-executed. If you call the Wait () method on a thread, the thread goes into a standstill state. Only this call to notify () or Notifyall () can return it to the executable state.

4 Death (Dead): When a thread ends normally, it is in a dead state, such as when a thread's run () method finishes executing.

Multithreading (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.