Fork pool - again

I am trying a different design for creating a fork pool (or worker pool)
for the processing of data in parallel on multiple cores. However, the
inter process communication between the processes is hanging and I
struggle to understand what is causing the blockage - and how to go
about debugging this.

Code and output is here:

https://gist.github.com/maasha/af4df2d4f0fe9c6211b7

Hints are most welcome!

Cheers,

Martin

Code now works (gist updated), except for the fact it is suffering from
race conditions. I want the output in order …

M