Amazon Interview Question

how to control shared memory access problem?