in reply to Did I create a concurrent program?
Your mytest routine will run concurrently, but you have a race condition. You should pass the value of $j into the thread at thread creation time instead of accessing a global variable. As your threads run, there is a chance that two threads will try to use the same value in $j to move a file. Also, there is little sense in using threads for IO operations, as IO operations that use the full bandwidth of the bus available seldom benefit from parallelization.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Did I create a concurrent program?
by JavaFan (Canon) on Nov 19, 2008 at 14:05 UTC | |
|
Re^2: Did I create a concurrent program?
by jweden1 (Initiate) on Nov 19, 2008 at 22:30 UTC |