I am learning multi-thread programming; and whilst practising mutex, I notice that it seems doesn't work correctly on my dule-core laptop.
The mutex code is at http://pastebin.com/axGY5y3c
The result is as below:
count value:t[0]1
count value:t[1]1
count value:t[2]2
count value:t[3]3
count value:t[4]4
The result shows that seemly the threads would obtain the same init value at the beginning. That looks incorrect.
Is there anything wrong with my code? Or is there any resource providing examples about running java mutex on smp/ dule-core/ multiple cpus?
Thanks for help.