Five states of Java Multi-threading

Source: Internet
Author: User

New state: After the new Thread (parameter), a thread object is established;

Ready state: After the thread object is established, call the start () method, enter the ready state, at this time not directly call the run () method, the thread into the running state also need to preempt CPU resources to be able;

Running state: After the thread has grabbed the CPU resource and started executing the run () method, it enters the running state;

Blocking state: When the thread encounters some situation, it will temporarily exit the CPU resources, let other threads execute first, and then enter the thread blocking state;

Case of Thread blocking: 1. Sleep, 2 waits to be awakened, 3, when the thread tries to get a lock, the lock is being occupied by another thread; 4. Invoke I/O blocking operation

Thread End: The Run () method exits gracefully or the run () method is terminated without catching an exception that is a thread break.

Five states of Java Multi-threading

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: info-contact@alibabacloud.com 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.