flock-fsync problems

Robin Cutshaw robin at itcatl.UUCP
Fri Jan 24 02:42:53 AEST 1986


The problem:

    open-file
    loop
	flock file exclusive
	write special value to location unique to this process only
	fsync
	flock file unlock
	delay
	flock file exclusive
	read value from unique location
	flock file unlock
    endloop


given several processes running the above algorithm and that no process
writes over the unique location allocated to any other process, the
value read is not always the value previously written (when it is wrong
it is the value written on the pass previous to this one).

The question:

    Does the flock-fsync mechanism work for multiple processes accessing
    the same file?  Is their a better/easier/more reliable mechanism to
    do this?


-robin		(uucp: ..!gatech!itcatl!robin)



More information about the Comp.unix.wizards mailing list