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.
About Question enthuware.ocpjp.v7.2.1324 :
Moderator: admin
-
- Posts: 6
- Joined: Wed May 22, 2013 4:03 am
- Contact:
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1324 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 225 guests