0
votes

I have a question, I am always asked this in the interviews multiple times--

How is synchronization implemented in java.. I have answered-- using trylock() mechanism using wait, notify ,and notifyAll() methods in java using synchronized blocks using synchronized for class and object level using mutexes for synchronization using re-entrant locks

Are there any better answers to this?/

3
Are you talking about how synchronization is implemented by JVM implementors, or how synchronization is used by developers?sjlee

3 Answers

1
votes

If you care about gaining a deep insight on concurrency then a great source is the http://www.javaconcurrencyinpractice.com/ book.

If you simply care about "passing" this question in interview(s?) then http://download.oracle.com/javase/tutorial/essential/concurrency/index.html may do, but still you generally need to practice a bit to understand synchronization so you are in a position where you'll sufficiently answer questions following the extremely vague "How is synchronization implemented in java".

0
votes
0
votes

I'd probably go with something along the lines of what is found here: http://download.oracle.com/javase/tutorial/essential/concurrency/locksync.html