in reply to Simplest Forking

Seriously consider whether multi-threading will hurt or will hinder a process like this. If you are processing a file, then this is an I/O-bound activity: the completion rate depends on how fast the machine can perform I/O, not on the speed of the CPU. Therefore, unless there is truly reasonable opportunity to overlap, the multi-threaded version might run noticeably slower.

Replies are listed 'Best First'.
Re^2: Simplest Forking
by Anonymous Monk on Apr 08, 2014 at 18:31 UTC
    Thanks. When I try to do it using exec and then waitpid it does show substantial speed improvement. I however don't know how to deal with error zombie processes etc.