Java threads have many kinds of states, the main six kinds, are created, run, sleep, wait, block and extinction Six, there are many down to 5 kinds, the sleep and wait to boil down to frozen;
is created: The thread is created, and the new Thread () is created after the threads.
Run: After the thread is created, the thread is started by the start () method, and the run () method of the thread is executed, and the thread is in the running state, which means that the thread is executing the Run method;
Sleep: The thread has sleep (), then can customize the time, the thread in the run as long as the call sleep (), the thread will go to sleep time, sleep state is the thread will not do anything, until the time of sleep to jump to the blocking state
Wait: The thread is through the wait () method to enter the waiting state, into the waiting state will not wake up, unless the main thread execution end, or is awakened, or is always waiting, wake up will enter the blocking state, Wake up through Notify () this method to achieve.
Blocking: When the CPU executes the program, the assigned process executes, the CPU that is not executed will be blocked, wait until the CPU is allocated to the time to run, and then sleep and wait for the wake to go to the blocking state, waiting for the CPU to execute;
Extinction: Is death, the run () method executes the process is finished, or the entire program is closed, the thread will die;
Six state of Java threads