I have been doing a bit of reading about semaphores and shared memory for the last few days, in the hope of making an improvement to Mega upload. Unfortunately it does not look like a good solution.
The reason is the String allocation of perl is said to be unpredictable - at least according to the perlipc man page. There are enough problems when interacting between perl and PHP as it is so the last thing I need is another complication.
I have aslo thought about using named pipes which may be superior to the current file locking mechanism in use. However with named pipes the process that writes to it will block until the second process is ready to read in the data so it will slow down the upload.
As they say if it's not broken don't fix it.