While reading concurrency in Java, I have following doubts:
Does Java provides lower level construct then synchronized for synchronization?
In
There is also volatile
keyword, according to http://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html volatile
variable access is more efficient than accessing these variables through synchronized code
java.util.concurrent.Semaphore
is used to restrict the number of threads that can access a resource. That is, while synchronized
allows only one thread to aquire lock and execute the synchonized block / method, Semaphore gives permission up to n threads to go and blocks the others.