in reply to Re^2: Multithreads with an executable in the worker subroutine
in thread Multithreads with an executable in the worker subroutine

Okay. Looking at the code I see nothing -- other than perhaps the implementation of logmsg which you haven't supplied -- to suggest that it is your code that is preventing concurrency.

Having scanned a little of the information I can find about the blast program, I strongly suspect that it is serialising access to it database file -- probably through file locking. So the problem would also exist if you were using fork.

The solution I would try is to use different databases for the concurrent runs. If the nature of your workload means that you only want to use a single database, then you could make N (where N is the number of cores) copies of that db file and have each thread operate against a different copy. I am assuming that the blast program is using the db for reference only, not updating it.


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.

The start of some sanity?

  • Comment on Re^3: Multithreads with an executable in the worker subroutine (fork (probably) won't help)
  • Download Code

Replies are listed 'Best First'.
Re^4: Multithreads with an executable in the worker subroutine (fork (probably) won't help)
by Anonymous Monk on May 31, 2012 at 13:24 UTC
    This is logmsg and I don't think it's blocking anything.
    sub logmsg {my $FH = $AKUtils::LOG || *STDOUT; print $FH "$0: ".(caller(1))[3].": @_\n";}
      Sorry, I replied anonymously, but that is indeed the logmsg subroutine. sub logmsg {my $FH = $AKUtils::LOG || *STDOUT; print $FH "$0: ".(caller(1))[3].": @_\n";}