Wednesday, February 13, 2013

When to use multithreading?

Based on my experiences:

1) When multiple tasks need to be running at the same time.

We created a mobile game where we have individual threads for the music, the graphics update, and for reading the input.

2) When it is beneficial for tasks to be running at the same time.

I needed to communicate with a web service that returns a very large amount of information. There is also a limit to the amount of information that it returns. This can be done serially, requesting chunks of information at a time. Multiple requests can also be done at the same time, so I opted for multithreading, significantly reducing the amount of time to retrieve all the needed information.

No comments: