Page 1 of 1

About Question enthuware.ocpjp.v7.2.1324 :

Posted: Mon Jun 10, 2013 4:11 am
by tduglas
Why not changing " Thread.sleep(10000); //1  sleep for 10 secs" to  Thread.sleep(1000); //1  sleep for 1 secs?
As for now the answer is not earnestly. Both threads have equal priority and so both will compete equally on the cpu time. If not take into consideration the proliferation of operation system schedulers it would be more fair to make Thread.sleep(1000) in both threads.

Re: About Question enthuware.ocpjp.v7.2.1324 :

Posted: Mon Jun 10, 2013 3:30 pm
by admin
You are right. 10 seconds is there to confuse you. The point that it is trying to make is that you should not depend on which thread executes when. You should not depend on thread scheduling based on sleep either.

HTH,
Paul.