There is something that bugs me with the Java memory model (if i even understand everything correctly). If there are two threads A and B, there are no guarantees that B ...
imagine there is a masseur and he has his own salon. He is sleeping the whole day until a customer enters the salon and wakes him up.
The customer is sleeping while ...
I have model. This is actually an ArrayList of objects.
And I also have methods of dealing with it.
Such as remove(), find(), getAll(), create(), add(), loadFromFile() and storeInFile().
This model used ...
I read that JVM achieves the synchronization by copying data of shared variable from the main memory to the thread's working memory according to this link.
enter link description ...
Hi everyone My first post on JavaRanch ;) I've been looking for an answer to my question for quite some time. No luck though... Let's say one thread waits for changes of variable int "state". First it enters synchronized block synchronized(guard) modifies "state" and releases lock of the guard object via guard.wait(). Now second thread modifies variable "state" also in synchronized ...