Hai,
Please clear my doubt. In the following program, three threads accessing the same account.
My doubt is :
As withdrawal method is a synchronized one,only one
thread is allowed to make the withdrawal.After it finishes the withdrawal,second thread will withdraw.Eventhough the balance is Rs.90 after first thread's withdrwal,the second thread reads the balance as Rs.100.Why is this so?
i)does the threads read the balance from the thread's local or from main memory?
ii)After each thread making a withdrawal,will it store the balance in main memory or thread's local?when it gets stored in main memory?
iii) the balance variable is accessed from main memory or from thread's local each time it reads.
iv) what are the values in thread's local and will be in main memory?
Thanks in advance
moderator Bu: made one long line into to.
[ August 23, 2007: Message edited by: Burkhard Hassel ]