Yes there is a clash
The contention is resolved as a race condition... whoever writes first wins
The priority is resolved first come first serve.
The only correct thing to do is to use a semaphore... implemented via IPC.
Thank you for reply arh, I will try using semaphore.