Java thread
1. New state (New): a new thread object is created.
2. Ready state (Runnable): after the thread object is created, other threads call the object's start () method. The thread in this state is in the runnable thread pool and becomes runnable, waiting to gain access to the CPU.
3. Running: the thread in the ready state gets the CPU and executes the program code.
4. Blocking state (Blocked): blocking state means that the thread gives up the right to use CPU for some reason and stops running temporarily. You don't have a chance to go to the running state until the thread is in a ready state. There are three types of congestion:
(1) waiting blocking: the running thread executes the wait () method, and JVM puts the thread in the waiting pool. (wait will release the lock held)
(2) synchronization blocking: when the running thread acquires the synchronization lock of the object, if the synchronization lock is occupied by another thread, JVM will put the thread into the lock pool.
(3) other blocking: when a running thread executes the sleep () or join () method, or when an Icano request is issued, JVM puts the thread in a blocking state. When the sleep () state times out, the join () waits for the thread to terminate or times out, or when IBG O has finished processing, the thread returns to the ready state. (note that sleep will not release held locks.)
5. Dead: the thread ends its life cycle when it finishes execution or exits the run () method because of an exception.