This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread's Output can't able to predict  RSS feed

 
Sarath Kalangi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi this is basic thread question: I got three threads, when i exectue those three threads i got one output and again i execute i got different output.
why every time the order of output's can't able to predict in threads then it's no use of going to create threads in first point.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Multi-threading is all about concurrent execution.
Thread scheduling and CPU allocation would be architecture/OS dependent and as such beyond the scope of Java (or any other programing language).

The idea is to be able to execute multiple processes concurrently without worrying about the order in which they execute. If the order is a concern in such a situation you might have to look up Thread synchronization and ways to achieve it.

Cheers,
Raj.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!