Original Post
It's hard to word the question correctly. Here is my dilemma: I understand what threads do, how they work, and how to create them. I understand how to protect data using mutexes, semaphores, etc. The only thing holding me back from using threads right now is knowing whether a particular task is big enough to warrant its own thread. In other words, at what point does the overhead from creating/managing a thread exceed the benefits gained from concurrent processing? Sometimes, it is obvious. For instance, many have recommended putting the audio engine into its own thread. AI and Pathfinding can be threaded easily enough. But let's break it down a bit. Imagine I am multiplying two large matrices (a classic "threadable" problem). At what size is it helpful to use threads? How many instructions make a thread worth creating? My problem stems from the fact that I often can pick odd jobs here and there in my code that could be put into a thread, but I cannot bring myself to believe it would be worth it because the thread would start and then stop fairly quickly. I generally try to hunt for big jobs that can run independent of other code (which usually results in not threading them because of too much data dependency on the main thread). Help? Thoughts? Insights? Guidelines? Links to epic articles?