Process 1 Process 2 ----------------------------- ----------------------------- die if -e $lockfile; die if -e $lockfile; open(my $fh, '>', $lockfile); # I think I hold the lock. open(my $fh, '>', $lockfile); # I think I hold the lock. . . .