Finished example for shared memory