in reply to cpu time within a thread
No matter the method tried, when I increase the number of threads, the reported time increases dramatically...
Assuming that your running on a single cpu machine, that is to be expected.
Using two threads will not double the capacity of your cpu. They shared the cpu. Both threads will get (slightly less than) half of the time a single thread would get. All other things being equal.
Threads are not a way of making your code run faster. The main purpose to is allow one part of your program to continue doing something useful whilst another part of your program is waiting for something to happen--usually IO of some form. Waiting for the user to type something, or a webserver to respond to a query etc.
There are other uses, but the limited api that Perl threads present of the underlying mechanisms restricts many of these.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: cpu time within a thread
by tallison (Initiate) on Jul 28, 2004 at 18:25 UTC | |
by BrowserUk (Patriarch) on Jul 28, 2004 at 18:52 UTC | |
by tallison (Initiate) on Jul 28, 2004 at 21:39 UTC |