Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Practice Exam I: question 1  RSS feed

 
henry joe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello the answer given to the code below says that Bang will execute for a second or two and It's difficult to predict which thread will be the last to finish. My question is how did they come to such conclusions from the code below? I had thought that it will execute for around 2 and half seconds ..



I just need explanations on why it is difficult to predict which thread and also the time factor in threads. Thanks
 
Henry Wong
author
Sheriff
Posts: 22846
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
henry joe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OCP Java Practice Exam textbook ; Practice Exam I question 1
 
LQ McDonald III
Greenhorn
Posts: 10
Eclipse IDE IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well...it could be because java does not explicitly enforce thread scheduling in any specific manner and lacks a thread scheduler. Thread scheduling in Java is platform dependent and relies on your JVM implementation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!