Hi,
I have worked on a lot of multi-threading programs and I have a question which I havn't been able to find an answer for.
When before you enter a synchronization block, the local
thread memory is updated from the "main memory" and when you leave a synchronization block the local thread memory is flushed back to the main memory keeping everyone happy.
But what *excatly* is flushed and is it implementation dependent.
1) Are all variables in the local thread flushed to main memory (ie all variables all the way up the stack).
2) Are all variables in the local thread memory at the top of the stack flushed?
3) Are only variables used within the synchrinization block in the current stack flushed?
I would love to know, since if 1) is the case, then I could probably remove some synchronized blocks which I have and optimise my code.