多线程--->线程优先级

线程优先级

1、java提供一个线程调度器来监控程序中启动后进入就绪状态的所有线程,线程调度器按照优先级决定应该调度那个线程来执行

2、线程的优先级用数字表示,范围从1~10

1>.Thread.MIN_PRIORITY = 1

2>.Thread.MAX_PRIORITY = 10

3>.Thread.NORM_PRIORITY = 5

3、使用一下方式改变或获取优先级

getPriority().setPriority(int xxx)

/**
 * 测试线程的优先级
 */
public class TestPriority{
   
    
    

    public static void 

Guess you like

Origin blog.csdn.net/m0_59133441/article/details/119986653