Thursday, March 24, 2011

Concurrency in Eclipse: Best Practices and Gotchas

A brief discussion of concurrency within Eclipse, primarily through Jobs and ISchedulingRules, and a few tips for troubleshooting them:
  • Avoid excessive synchronization as third-party libraries may be doing their own and you may cause race conditions, deadlocks or thread starvation. It should be a last resort, especially on the UI thread.
  • Use Jobs rather than RunnableWithProgress.
  • Deadlocks are usually caused by poorly written ISchedulingRules, either too vague or too restrictive.
  • Enable the Show Monitor function when debugging.
  • In testcases, spawn multiple threads that access the same API to find non-threadsafe API. Use ISchedulingRules on Jobs to limit access to that API.

No comments:

Post a Comment