Process state switch:
A process can be in five states: New, ready, Running, blocked, and destroyed. The diagram below:
Technically, the process also has a pending state, mainly to solve the problem of insufficient memory resources. The suspended state is required for end user requests, parent requests, and load balancing. The diagram below:
In the two states of ready and blocking, we can distinguish stationary ready and active ready, as well as stationary blocking and active blocking. The rest and active states can be switched by activation and suspension, while the running state can be switched to the rest ready state by suspension.
Thread state switching:
Thread is the microscopic representation of process, so the state of thread is basically consistent with the state of process, and the switching conditions are also basically consistent. The diagram below: