I have been working on threads. I have found that normal priority is five. But I just like to set the priority Maximum as ten.
The jobs running on normal and maximum priority changed the meaning,Even-though I specified the priority to my threads. It's simply running as normal and maximum as mixed case.
If any stuffs about JVM Vs OS, explain me fully.
Why is this happening? I am little bit confused on the JVM behavior. Some deep explanation will make me clear. Code is given below!
class Count implements Runnable { public void run() { for(int i=1;i<=100;i++) { if(i%10==1) { System.out.println("10 counts have been finished"); } System.out.println("The numbers are:"+i+"From"+Thread.currentThread().getName()); try { Thread.sleep(1000); } catch (InterruptedException e) { System.out.println(e); } } } } public class ThreadEx { public static void main(String[] args) { Count c = new Count(); Thread t = new Thread(c); Thread t1 = new Thread(c); t.setName("Sridhar Job"); t.start(); t1.setName("Bob Job"); t1.setPriority(10); t1.start(); } }
All the stuffs which I read as Threads working is not guaranteed. What is the core relation between JVM Threading and OS Threading?