标签:tar ica thread 关系 locale soft 线程 nms void
继续更改上面1.10.2的优先级使他们俩的优先级差不多
1 package com.cky.prioritydemo; 2 3 /** 4 * Created by edison on 2017/12/3. 5 */ 6 public class PriorityTest { 7 public static void main(String[] args) { 8 for (int i = 0; i < 5; i++) { 9 MyThread1 th1 = new MyThread1(); 10 th1.setPriority(5); 11 th1.start(); 12 MyThread2 th2 = new MyThread2(); 13 th2.setPriority(6); 14 th2.start(); 15 } 16 } 17 }
C:\itsoft\jdk\bin\java -Didea.launcher.port=7539 "-Didea.launcher.bin.path=C:\itsoft\idea\IntelliJ IDEA 2016.3.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\itsoft\jdk\jre\lib\charsets.jar;C:\itsoft\jdk\jre\lib\deploy.jar;C:\itsoft\jdk\jre\lib\ext\access-bridge-32.jar;C:\itsoft\jdk\jre\lib\ext\cldrdata.jar;C:\itsoft\jdk\jre\lib\ext\dnsns.jar;C:\itsoft\jdk\jre\lib\ext\jaccess.jar;C:\itsoft\jdk\jre\lib\ext\jfxrt.jar;C:\itsoft\jdk\jre\lib\ext\localedata.jar;C:\itsoft\jdk\jre\lib\ext\nashorn.jar;C:\itsoft\jdk\jre\lib\ext\sunec.jar;C:\itsoft\jdk\jre\lib\ext\sunjce_provider.jar;C:\itsoft\jdk\jre\lib\ext\sunmscapi.jar;C:\itsoft\jdk\jre\lib\ext\sunpkcs11.jar;C:\itsoft\jdk\jre\lib\ext\zipfs.jar;C:\itsoft\jdk\jre\lib\javaws.jar;C:\itsoft\jdk\jre\lib\jce.jar;C:\itsoft\jdk\jre\lib\jfr.jar;C:\itsoft\jdk\jre\lib\jfxswt.jar;C:\itsoft\jdk\jre\lib\jsse.jar;C:\itsoft\jdk\jre\lib\management-agent.jar;C:\itsoft\jdk\jre\lib\plugin.jar;C:\itsoft\jdk\jre\lib\resources.jar;C:\itsoft\jdk\jre\lib\rt.jar;C:\多线程核心技术\第一章\out\production\第一章;C:\itsoft\idea\IntelliJ IDEA 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.cky.prioritydemo.PriorityTest thread 1 use time=516 thread 1 use time=531 thread 2 use time=547 thread 2 use time=578 thread 1 use time=578 thread 1 use time=578 thread 2 use time=594 thread 1 use time=594 thread 2 use time=594 thread 2 use time=594 Process finished with exit code 0
结果说明线程的优先级与打印顺序无关,不要将两者的关系关联,他们的关系有不确定性和随机性
标签:tar ica thread 关系 locale soft 线程 nms void
原文地址:http://www.cnblogs.com/edison20161121/p/7954803.html