17.4. Threading guidelines

Use threads only when there is a real need for multi-threading, such as if you have multiple CPUs and are writing a computation intensive application which has a user interface portion. While one thread deals with user interaction, the other can be performing background computation concurrently.

Avoid using multiple threads unnecessarily because not only does writing such applications require a higher level of expertise, it is also often difficult to debug threaded applications. [20]

[20] This is true especially for bugs due to inconsistent state which resulted from thread synchronization problems. The difficulty is exacerbated by the fact that multi-threaded applications always give different outputs depending on various ...

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.