- Joined
- Feb 8, 2008
- Messages
- 1,649
- Reaction score
- 4
- Points
- 38
- Location
- Hampshire, UK
- Website
- orbiter.quorg.org
There are no hard-and-fast rules for when or when-not to use multithreading. Though as a general rule, things should be kept as simple as possible unless the case warrants for something more complicated.What are best practices to program multithreading?
When should it be used? When shouldn't?
Basically, you should keep to single-threading unless you need the performance improvement of parallelisation of multithreading and have the time and expertise in your development team to be able to implement it as multi-threaded or in the case that single threading just won't cut it - eg, you have blocking calls in your code and need the rest of the program to continue execution whilst waiting for the blocking call to unblock. Though in the latter case, a different approach can generally be found.