Fixed shared memory setup (must be done in every thread)