File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Thread's Output can't able to predict Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread Watch "Thread New topic

Thread's Output can't able to predict

Sarath Kalangi

Joined: Nov 01, 2012
Posts: 11
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

Joined: Mar 02, 2005
Posts: 445

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.

I agree. Here's the link:
subject: Thread's Output can't able to predict
It's not a secret anymore!