I have several processes that need to write to a certain file or read from it, and this might happen simultaneously.
Currently I have a simple code that changes the filename to "filename.lock" and the process that is trying to use the file at the same time waits until the ".lock" is removed (by the same process that locked the file), but its still creates issues if two processes access the file at the exact same time.
I need to implement a mechanism in python 2.7, that will work with linux (and if possible, also in windows), to prevent those processes from opening the files at the same time, in order to prevent overriding the data and similar issues. This could also be a different method - maybe some db or any other idea or library that I can use.