Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
On my work i get problem for creating multiple threads for the less execution time.i dont get any idea how to create threads for multiple files.each file should process only one thread.but not multiple threads. how can i do. can any one can give me idea about plz.
Posted
Comments
phil.o 6-Nov-15 10:40am    
More threads do not automatically mean fewer execution time, especially if disc access is involved. You can fire as many threads as you want, your disc-controller won't ever be able to read more than one file at a time.
But these are just my 2 cents :) Good luck
Sergey Alexandrovich Kryukov 7-Nov-15 1:01am    
Why multiple? Create just one extra thread, in addition to you UI. Do you think by adding a thread will add you a computing power? Add as many as the number of CPU code, no more. Or better just one.
—SA

1 solution

I agree with comment that if you wont to work with same resource (in your case HDD) more threads will not spead-up your work and may slow it down due to context switching. Anyway ThreadPool is the solution for your problem
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900