Why use a ReentrantLock if one can use synchronized(this)?

I’m trying to understand what makes the lock in concurrency so important if one can use synchronized (this). In the dummy code below, I can do either: synchronized the entire method or synchronize the vulnerable area (synchronized(this){…}) OR lock the vulnerable code area with a ReentrantLock. Code: private final ReentrantLock lock = new ReentrantLock(); private … Read more

What is the difference between concurrent programming and parallel programming?

What is the difference between concurrent programming and parallel programing? I asked google but didn’t find anything that helped me to understand that difference. Could you give me an example for both? For now I found this explanation: http://www.linux-mag.com/id/7411 – but “concurrency is a property of the program” vs “parallel execution is a property of … Read more