I've started to learn Scala and Akka as the actor model. In an imperative language like C for example i can use several different methods for synchronizing threads on for example a binary tree; a simple semaphore or a mutex, atomic operations, and so on.
Scala however, is a functional object oriented language which can implement an actor model utilizing the Akka library (for example). How should synchronization be implemented in Scala? Let's say that i have i binary tree which my program is suppose to traverse and perform different operations upon. How should i make sure that two different actors isn't, for example, deleting the same node simultaniously?
synchronizedHOF. But I suspect the question you mean to ask is "What are the best practices for achieving thread safety for concurrent / parallel programs?" For that, the story is less simple. Actors and Futures go a very long way and each have their strengths and weaknesses and largely complement each other.