Amazon interview question

how to control shared memory access problem?