Blocked thread with Read Write Lock due to writer starvation

Tags: , , ,

Here is an interesting and simple example of how you can end up with a locked thread in your application and what you can do to avoid it. Task A – Starts at t = 0. Takes a read lock. Runs for 3 seconds. Scheduled to run every 5 seconds. Task B – Starts at [...]

Continue reading » No comments

Java Synchronization Benchmark

Tags: , , , , , , , , ,

Here is a very simple and straightforward benchmark to demonstrate how synchronization in Java can affect speed of execution to different extents in Java 1.4 and Java 6. In the attached image (click above for full size), you can see that for Java 1.4 the synchronized method needs over 700% more time to do its [...]

Continue reading » 7 Comments