Thanks for taking time to work on this.
McA suggested:
Scan the whole directory tree and push all found mp3 files on a array (job queue), then split the queue into N parts (N = number of cores) and start N subprocesses working on their subqueue. In this case you do only fork once per subqueue and not for every file (which is expensive).
I can not find a simple way to split the loop into 2 (my no of cores) independent subprocesses. So I did what
karlgoethebier suggested .
I tried with $MAX_PROCESSES=5 and $MAX_PROCESSES=2. The execution time is about the same and interestingly the unforked script does the job in about half the execution time.