barski Posted June 9, 2006 Posted June 9, 2006 I've done very little with threading and i mean very little. From my initial reading i can see the advantage to freeing up the app to do other things while a particularly long process is running. However, in a single cpu environment there wouldn't be any kind of performance gain with the implementation of threading correct??? for example if i have job1 job2 job3 the amount of time it would take for jobs 1-3 to complete would be the same if i ran them sequentially or spun them off into three different threads??? if it matters, can't imagine that it would, all jobs do bascially the same thing getdata(), changedata(), senddata() Quote
Administrators PlausiblyDamp Posted June 9, 2006 Administrators Posted June 9, 2006 On a single CPU the overheads of thread management might even cause a (very very) slight performance drop - probably not large enough to worry about though. However it's not just the overall time that you need to consider but also the user's perception. If job1 was to take 5 minutes and effectively hung the UI while it was working (no repaints, (not responding) in the titlebar etc.) then it gives a poor impression. Running the activity in a 2nd thread would at least keep the main UI responsive and give a better overall impression. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Leaders snarfblam Posted June 9, 2006 Leaders Posted June 9, 2006 Another place multi-threading might help: suppose you were to download a file and perform some other additional operation. A file download isn't particularly CPU intensive, which means that you can use two threads to use all that extra CPU power and do both at once instead of waiting for the download to finish. Also, in the event that a user has a pentium with hyperthreading, theoretically an operation may perform faster if done using multiple threads, but I certainly wouldn't base a program around that. Quote [sIGPIC]e[/sIGPIC]
barski Posted June 9, 2006 Author Posted June 9, 2006 thanks for the input. i'm definetly going to use threading because there are a couple of places where i have to free up the app to do other things. so i guess 100 one second jobs are going to take 100 seconds. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.