Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: dynamic number of threads based on CPU utilization

by BrowserUk (Patriarch)
on Sep 26, 2012 at 15:59 UTC ( [id://995803]=note: print w/replies, xml ) Need Help??


in reply to Re: dynamic number of threads based on CPU utilization
in thread dynamic number of threads based on CPU utilization

Remember, the work being done here is I/O-bound, not CPU bound.

Why are you doing this?

For 90%+ of the runtime of the OPs program, IT IS CPU BOUND NOT IO BOUND.

So do just stop regurgitating your useless, pointless, irrelevant, and gratuitously incorrect home-spun wisdoms.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

  • Comment on Re^2: dynamic number of threads based on CPU utilization

Replies are listed 'Best First'.
Re^3: dynamic number of threads based on CPU utilization
by mabossert (Scribe) on Sep 26, 2012 at 16:38 UTC

    my apologies...I thought that since the procXml sub worked just fine, it would not be relevant to the discussion or potential solution. Within the procXml sub, I simply slurp the file into a hash, then operate on the hash.

    I was under the impression that because I was operating on the file contents in memory (i.e. the hash), it was a mostly CPU-bound process (minus slurping the input file and printing to the output file.

      .I thought that since the procXml sub worked just fine, it would not be relevant to the discussion or potential solution.

      You were mostly right. The only relevance it has is that nowhere in that code do I see any sign of locking (the keyword 'lock' does not appear), which means that multiple threads are writing to a shared hash and there is nothing to prevent them from corrupting data through collisions.

      You may 'get away with it', but I wouldn't want to be responsible for when things go wrong.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2026-02-12 03:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.