[Mono-list] Threading and IO problem
Eric.Engler at zcsterling.com
Thu Mar 6 16:43:14 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
>I've made a small program to use all processors on a system to analyze
>N text files. But when it's run on a 8 CPU PC, the CPU time stays
>70%-80% and the idle time between 20-30%.
Your problem is that you need to ensure your threads get launched, and
run, on each available processor. As you may have guessed, your best
processor utilization will occur with 8 threads in execution on an 8-way
In version 2.0 of the .NET Framework MS developed an elegant solution
for this. Instead of creating your own threads, you can call
ThreadPool.QueueUserWorkItem and pass it a delegate to a static
function. This will take complete responsibility for allocating threads
from the thread pool, and getting them executed on separate processors.
Your overall CPU utilization will shoot up to 100.
I don't know if this is implemented in Mono.
NOTICE: The information contained in this electronic mail transmission is intended by the sender for the sole use of the named individual or entity to which it is directed and may contain information that is privileged or
otherwise confidential. Please do not copy it or use it for any purposes, or disclose its contents to any other person. To do so could violate state and Federal privacy laws. If you have received this electronic mail
transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email or by telephone, so that the sender's address records can be corrected. Thank you for your cooperation.
-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 2.6.2
-----END PGP SIGNATURE-----
More information about the Mono-list