Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: shared scalar freed early

by Laurent_R (Canon)
on Feb 22, 2017 at 21:56 UTC ( [id://1182562]=note: print w/replies, xml ) Need Help??


in reply to Re^2: shared scalar freed early
in thread shared scalar freed early

Yeah, is that a problem?
Oh, yes it is. Spawning a very large number of threads will most certainly take an heavy toll on the machine's resources and at best slowdown everything (or more probably bring your machine down), even if many of them are idle at any point of time.

Other monks have already explained while I was off-line that it is much better to have a relatively limited number of threads picking work from a job queue (or something similar), and I absolutely agree with ikegami and tye on that.

(And this is why I candidly asked the question in the first place, as well as to make sure I understood you correctly, because the idea seemed so extravagant to me.)

Replies are listed 'Best First'.
Re^4: shared scalar freed early
by chris212 (Scribe) on Feb 23, 2017 at 01:49 UTC
    So even after a thread is joined, it still consumes resources? I don't see memory usage growing or the number of threads growing as new threads are created to replace the finished ones. The CPU is utilized heavily the entire time it runs, but that is the point. Are you saying my CPU cycles are being wasted on threads that have already joined/returned?
Re^4: shared scalar freed early
by chris212 (Scribe) on Feb 23, 2017 at 03:19 UTC
    Please see reply to ikegami. I'm still interested in how using so many threads can be causing my crash, but if I can't get queues to work anywhere near as well, I don't see a practical alternative in Perl. Thanks.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found