I dont think that the threads I have implemented works properly, because there's no visible improvement in the script as used without threads.

Do you have a multi-core computer setup to run as multiple processors? If not, if you essentially have a single cpu, you can only process 1 thread at a time, and there will be no speed improvement over just running your math sequentially in a single subroutine. Its a common misconception that threads speed up parallelized routines on single cpu machines. In some cases they can help, like if there are multiple socket calls out to the internet, but in general text processing or number crunching no gain is made. You probably actually slow things down by threading on a single cpu computer, due to the overhead that threads impose.

Threads still can be useful on single cpu machines, but it is not for speed improvements; it is for things like inter-process communication and making routines non-blocking.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: Trouble implementing threads by zentara
in thread Trouble implementing threads by saranrsm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.