in reply to Will a shared filehandle processed by multiple threads/processes cause problems?
Much depends on how big the individual lines are vs. how much computation needs to be done on each one. If the latter is what's killing you and you have a true multicore processor (i.e., where multiple processes really can run simultaneously) then this approach could indeed win. If, on the other hand, you're mostly I/O-bound, i.e., reading+writing are what's taking up your time, then probably not.
You may want to consider having one process do all of the reading, giving it outgoing pipes to the other processes, which then all pull lines from the reader on demand (which then involves more games with signals or semaphores), which then gives you benefits of buffering and concurrency. This will be worth it if the lines are generally way smaller than the buffer size.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Will a shared filehandle processed by multiple threads/processes cause problems?
by alanraetz (Novice) on Jul 01, 2014 at 15:32 UTC |