[SciPy-user] shared memory machines

Sturla Molden sturla@molden...
Mon Feb 9 12:05:35 CST 2009


On 2/9/2009 6:49 PM, Philip Semanchuk wrote:

> If you're destroying the segment when the attach count drops to zero,  
> why not check that immediately after the call to shmdt()?

I thought it was only the owner/creator that was allowed to do that?


> ftok() should probably be avoided as it returns duplicate keys:
> http://nikitathespider.com/python/shm/#ftok

Oh :(

In that case I could rewrite the object to pickle the shmid instead of a 
random name (uuid string) on System V.


> I'd recommend using a random number generator instead. I believe a  
> key_t is guaranteed to fit into an int, so you could generate a random  
> number anywhere from 1 to INT_MAX, taking care not to step on the  
> value IPC_PRIVATE (unless you want to assume that that is always  
> #defined to 0).

I am not sure how big the problem is, as I pass an uuid as filename to ftok.


S.M.


More information about the SciPy-user mailing list