Hi,
I would like to run this by you and see if you think it is possible.
I am writing a program which can be run on severval machine over a pier to pier network, one of the machines is considered host and holds the main file which each client machine writes to (like a database I suppose).
I am trying to determine a way to control file access to avoid race conditions and deadlock, I have considered having another main file on the host with a switch and once the file has been taken by one program it sets a flag in the access file to 'taken' once it is finished with the file it remarks the file as 'free'. If the file is marked as taken all other programs must wait.
Race conditions arent a massive problem because each machine takes around 10 to 15 seconds to generate the data to be wrtiten however what I would like to know was if a program looks at the file and sees it as 'free' by the time the program writes 'taken' into the file, could another program come along and read the file as 'open' just a fraction of a second before the first program has manged to change it ?....
Any advice would be appriciated or even some differnt ways of implementing semaphores over a network ?..
Regards,
Paul Jackson.
I would like to run this by you and see if you think it is possible.
I am writing a program which can be run on severval machine over a pier to pier network, one of the machines is considered host and holds the main file which each client machine writes to (like a database I suppose).
I am trying to determine a way to control file access to avoid race conditions and deadlock, I have considered having another main file on the host with a switch and once the file has been taken by one program it sets a flag in the access file to 'taken' once it is finished with the file it remarks the file as 'free'. If the file is marked as taken all other programs must wait.
Race conditions arent a massive problem because each machine takes around 10 to 15 seconds to generate the data to be wrtiten however what I would like to know was if a program looks at the file and sees it as 'free' by the time the program writes 'taken' into the file, could another program come along and read the file as 'open' just a fraction of a second before the first program has manged to change it ?....
Any advice would be appriciated or even some differnt ways of implementing semaphores over a network ?..
Regards,
Paul Jackson.