> Using pkill(1) correctly should be more efficient than opening a > file, reading its contents, then passing those as an argument to > kill(1).
None of the mechanisms removes the race. However, of all the mechanisms, pidfiles are the worst. They even persist over reboot.