aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help.....Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Help.....Thread" Watch "Help.....Thread" New topic
Author

Help.....Thread

Aru Ven
Ranch Hand

Joined: Sep 28, 2000
Posts: 199
Hi All,
Can anyone explain me the output of the program.....

Thanks in advance.
Aruna
Vladimir Kositsky
Ranch Hand

Joined: Nov 03, 2000
Posts: 116
hi!
both treads increment i,k, and j in each of eternal loop invocation and return equal values.
so letters printed if workWithoutLocks( ) executed between first and second variables increment , and it is possible without any legimitacy.
see example 9.6 Mugal and Pasmussen
cheers
shalini Rajan
Greenhorn

Joined: Dec 02, 2000
Posts: 9
Hi Aruna,
I can't predict the result.Itz displaying infinite 'j' thatz right but some time it displays i & k also.I don't know why?.Lets wait for others to answer.
Shalini
Praveen Zala
Ranch Hand

Joined: Jul 02, 2000
Posts: 118
Hi Aru,
The code that u have posted started printing k,j.........and so
on ...it prints the same witout stopping ...infinitely....
Wonder why it does that !
Prav
Nasir Khan
Ranch Hand

Joined: Nov 04, 2000
Posts: 135
I changed the line if (j1 != j2) System.out.println("j");
with if (j1 != j2) System.out.println(j1+"j"+j2);
and found that the condition j1 != j2 is true after going through several loops ..
It seems that after sometime one thread lags behind the other one
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help.....Thread