1. Priority of Threads
In the operating system, threads can prioritize, high-priority threads get more CPU resources, and are the tasks in the higher-priority thread objects that the CPU prioritizes.
Setting the thread priority helps the thread planner determine which thread will be selected for priority execution next time.
Set the priority using the SetPriority () method.
The inheritance of thread precedence
The precedence of a thread in Java is inherited, such as a start B, and the priority of B is the same as a.
Precedence is rule-
Although you can set the priority of a thread by using the SetPriority () method, you do not see the effect of setting the priority level
Thread 2:
High-priority threads are always executed mostly first, but not for high-priority threads. Do not assume that the mythread thread is called by the main thread, and that the result is completely MyThread1 priority is 10.
When the priority of a thread varies greatly, the order in which the code is called does not have to be done first.
Precedence has randomness
Daemon process
There are two kinds of threads in a Java thread, one is a user thread and one is a daemon thread.
A daemon thread is a special thread that automatically destroys a daemon thread when there is no non-daemon thread in the thread. A typical daemon thread is a garbage collection thread. Any daemon thread is the "nanny" of all non-daemons in the entire JVM, as long as any non-daemon thread in the current JVM instance is not over, the daemon is working, and the Guardian thread friend with the JVM as soon as the last non-daemon thread ends.
Three. Thread Priority and Daemon