http://qs321.pair.com?node_id=821526


in reply to how do I create parrallel processing in this script?

Additionally to moritz's correct answer, I'll caution that you are unlikely to experience a huge difference in processing time by parallelizing the input operation. IO is limited by the disk speed, and turning a single process reading in one file at a time into several processes that read these files in parallel will likely affect performance detrimentally, because the disk head has to constantly jump to a new position while reading in. So, unless you have a very unusual drive configuration (or weird limits set on your single process by the OS), this will probably slow down the entire process, rather than speeding it up.

Also, reading in the file into an array in a forked child and then printing that array in the parent won't work, data structures don't remain shared in a forked process, you need some form of IPC for that.


All dogma is stupid.