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
posted
0
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
posted
0
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
posted
0
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
posted
0
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.