Microchip Technology Interview Question

How to deal with multithreading programming in racing conditions for multiple reading and writing disk