Can you please suggest some good tutorial for Java Concurrency. Where can i get some sample code also.
TL: DR — Yes, Java Concurrency in Practice is still valid and one of the best books to learn Java multithreading and concurrency concepts.
Concurrency is the ability to run several or multi programs or applications in parallel. The backbone of Java concurrency is threads (a lightweight process, which has its own files and stacks and can access the shared data from other threads in the same process).
The main way we can avoid such concurrency issues and build reliable code is to work with immutable objects. This is because their state cannot be modified by the interference of multiple threads. However, we can't always work with immutable objects.
Multitasking - Multiple tasks/processes running concurrently on a single CPU. The operating system executes these tasks by switching between them very frequently. The unit of concurrency, in this case, is a Process. Multithreading - Multiple parts of the same program running concurrently.
This is also a nice series of articles covering the topic:
http://www.baptiste-wicht.com/2010/05/java-concurrency-part-1-threads/
http://www.baptiste-wicht.com/2010/05/java-concurrency-part-2-manipulate-threads/
http://www.baptiste-wicht.com/2010/08/java-concurrrency-synchronization-locks/
http://www.baptiste-wicht.com/2010/08/java-concurrency-part-4-semaphores/
http://www.baptiste-wicht.com/2010/09/java-concurrency-part-5-monitors-locks-and-conditions/
http://www.baptiste-wicht.com/2010/09/java-concurrency-atomic-variables/
http://www.baptiste-wicht.com/2010/09/java-concurrency-part-7-executors-and-thread-pools/
First google link:
http://download.oracle.com/javase/tutorial/essential/concurrency/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With