|
|
| "be consistent" | |
| PerlMonks |
Re^4: create new task from main programby BrowserUk (Patriarch) |
| on Apr 14, 2006 at 08:40 UTC ( [id://543329]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Okay. Over the course of spawning 1000 threads, this version will use `1/16th (~13MB) of the memory required by my original version above. It substitutes a shared variable for the array of thread handles, and detaches the threads so they clean themselves up rather than sitting around consuming memory (~208MB) as in the original version. The numbers will vary depending upon how many threads exist concurrently. If you are likely to be spawning anything like this number of threads, moving to a thread pool would be your best bet, though it is slightly more complex. Without knowing what your program is actually doing, and it dynamic resource demands, it is quite likely that this version will also not be best for your application. Hence my /msg for further information. There is no one-size-fits-all solution.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||