code for shared memory between processes