Reasons to Thread (time)
Increase concurrency to overcome I/O latency
Increase concurrency to use multiple CPUs
Replace control loops for program clarity
Use threads to keep User Interface response times down
Exploit `parallel slackness’ to keep system busy
Notes:
EXAMPLE: Browsers use multiple TCP/IP connections to overcome 3xRTT (approx) setup latency; UNIX directory scanning algorithms can run many times faster even within one partition allowing better queueing of disk activity in OS (done in C/C++/Java).
- What is/are your main reason(s) for threading?
- Can you test results of your tinkering on your target system?
- Do you have multiple targets to optimise for some combination of?
- Remember that threading an algorithm will almost always consume some extra time and space and increase complexity.