Speeding up a multi-threaded program
Posted on 2000-03-21
I have a question about trying to speed up a program that is already multi-threaded. I have a program that may have up to 120 threads continuosly waiting on separate sockets for data from another process. When data is received some work is done and a reply message is sent back through the socket. Then the thread goes back to waiting on the socket. When examing the trace file for this operation I noticed that when a particular thread has completed its tasks and goes back into waiting on the socket, there is about 100 milliseconds before the context is switched to another thread.
I know that this amount of time doesn't seem much but I was wondering anything could be done to speed up the context switching between threads. Is there a way of telling Win NT that the thread is about to wait become idle and that it should now switch to another thread?
By the way, I remember a function called Yield that kind of did this?