Parallel processing and Process management.
Hi guys,
I am trying to write a master script which should pass filename to another script running in background [one file is passed at a time i.e. 1 background process]. Now the contraint is that I can have only 3 instances of the slave script at any point in time.
Initially there will be 3 background processes. Now suppose one finishes. So immedietly the next file should be passed. How can I achieve this. I assume ps command can be used, but correctly how?
Also, I have to update a status log when one background process ends.
The problem is that there is one status log and if 2 scripts complete at the same time, they would try to write to the status log at the same time! I have tried using 'wait' for this. Here process management comes into play.
I am facing some problem on how to implement. Please give a cue and I can go furthur. Some code snippet would be useful.
Any inputs would be helpful.
Thanks in advance...
Kind regards,
indiancosmonaut
|