Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Practice Exam I: question 1

 
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
Marshal
Pie
Posts: 21126
78
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic