FileExists checks whether file or file.lock exists.
If none of them exists file.lock is created and hostname and
PID are written into file.lock. This is useful if several processes
use the same directory. Further, it is checked whether another process
has tried to create the same file in the same instance. In this case
FileExists returns for at least one of the processes that
file.lock has already been created.
LockFile is the same as FileExists except that it does
not check whether file already exists.
WaitOthers waits for others if more than ideal.processes
processes have
their value is less than i
or if more than cores
processes have
their value is less than i-distance.
It also waits if there are alreay max.processes are active.
Note that WaitOthers write a file with ending
‘.wait’, which is also deleted be LockRemove.