In akka, dispatcher will spawn threads to execute mailbox which will make change to actor internal state. If we spawn thread1 on cpu1 handle message1 and then use thread2 on cpu2 handle message2. How can we guarantee the thread2 will see the state changed when handle message1.
I have done a little research for this problem shown in this link. It seems used the “volatile piggyback” to make all internal state visible between two messages.
But if the internal state cross the cpu cache line, will the volatile piggyback still work again ? I think the volatile can only add make the related cache line invalid after change, but it will not cover all the state in actor, please correct me if i misunderstand
thanks
Aitozi