File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in thread

 
Divya Gehlot
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can any one explain me the above program as ahy its behaving inconsistently.As on linux machine its giving different output and windows its different.
Compilation without error, but the exact output cannot be determined.
above is the correct answer for above .
 
Ankith suresh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is Thread..You can not predict the behaviour.
Even in same system...right guys???
 
Manfred Klug
Ranch Hand
Posts: 377
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ankith suresh:
That is Thread..You can not predict the behaviour.
Even in same system...right guys???

Right.

But remember:
It is possible that you always see the same behaviour on one machine, and that you are very surprised if you start the program on another machine (even if both have the same OS).
 
Sandeep Sachan
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Divya Gehlot!
Well if it's regarding Thread then your cann't prove and even cant say which thread is going to start first
As i have checked in to linux as will in to WindowsXp, "When it comes with Thread it's cant predictable"

Try this out.


 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Agreed!

There is a single object and three threads are working on that. Behavior may
vary from execution to execution or plate-form wise. It may be same most of
the time or vary at each execution. It depends, how thread scheduling is
taking place.


Thanks,
 
Sandeep Sachan
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noopss

even theadscheduling is not working with Java when it come to Threads.
Yes, it differ from machine to machine and even compilation, actually in both the cases CPU's TimeCycle changes and there thread gets the way to execute. i want to know, why this kind of machanise Java supports??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic