Fidelity Investments Interview Question

How do you handle a situation when two processes are trying to write to a file at the same time?