Task child process.

After the initial working version of the task class was up and running it was obvious that two issues needed to be resolved. One was the flooding of multiple file copy requests that could swamp the copy task and also that with any processor heavy custom tasks that could arise in the future then the a sync single threaded nature of Node could have performance issues.

To alleviate these problems a design decision was taken to offload the task to a child process. Of the options available to create the child process spawn was chosen as this best fit the model of what was trying to be achieved. Besides specifying the program to spawn and its arguments the process was also configured to pipe all stdio to the parent process and also the message passing ipc functionality provided by node was also enabled.

The IPC message handling will enable the parent to send filename to be processed to the child task process and for the child to signal its current status back to the parent (i.e. processing file please don not send anymore yet).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s