Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Standard way to convert timezone in multithreaded script

by rowdog (Curate)
on Nov 24, 2009 at 18:09 UTC ( #809157=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Standard way to convert timezone in multithreaded script
in thread Standard way to convert timezone in multithreaded script

perl -Mthreads -e'$n=3;for (1..$n){$t[$_]=threads->create(sub{my $r; while(1){$r++}});}; sleep 10;threads->exit()'

FWIW, I can attest that setting n=2 pegs both cores on my amd 3800+ running Arch Linux. However, n=1 (recommended setting) only pegs one core.


Comment on Re^3: Standard way to convert timezone in multithreaded script
Download Code
Re^4: Standard way to convert timezone in multithreaded script
by tirwhan (Abbot) on Nov 24, 2009 at 18:23 UTC
    However, n=1 (recommended setting) only pegs one core.

    Yes, of course. A single thread will only execute on one core. Which core that is may change (it's up to the OS), but it won't run on more than one core simultaneously. Multiple threads will.

    (I guess you already know this, just saying it explicitly in case someone reads all of this and is under the impression that simply saying "use threads;" will make a program run concurrently on several CPUs. That would be magic, not concurrency :-)


    All dogma is stupid.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://809157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-30 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (384 votes), past polls