in reply to Controlling Shared Memory Id's

Unfortunately you have a race condition to deal with here. What I would suggest as a first solution is to use some sort of semaphore or other locking to force your Perl programs to not be in the process of initializing memory devices at the moment you clear. Failing that being convenient, have your shared memory device note which devices have zero processes, wait, then only kill the ones which still do. As long as that wait is significantly longer than the initialization time, you should be fine.

Incidentally your controller should probably go a little more slowly. Right now when it has nothing to do you wait in a tight loop and it probably generates an appreciable load...

  • Comment on Re (tilly) 1: Controlling Shared Memory Id's