Re: kill safety
loic-dev_at_gmx.net
Date: 06/04/05
- Previous message: alex goldman: "Re: unexpected abstraction penalty in C++"
- In reply to: rm: "kill safety"
- Next in thread: Ed Prochak: "Re: kill safety"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Jun 2005 13:55:23 -0700
Hello,
> We have situation like this.
>
> Before accessing a directory, a program creates fcntl lock file which
> contains its pid value.
>
> Now another proc which would like to kill the proc which holds fcntl
> lock is to read pid, try locking the file using fcntl lock and if the
> fcntl lock fails, kill the proc which holding the lock.
That's rather an odd way of using fcntl lock...
> How safe is this operation so that the reading of pid and killing does
> not result in killing another proc which got this same pid due to
> recycling of pids.
>
> Even though time gap is very short -- reading pid, try locking and if
> failed, killing; but still how safe even in multi processor situation
> considering all process involved are root procs?
>>From a pure theoritical standpoint, this may happen.
>>From a practical standpoint, it very very very very very likely won't.
But why Do you need such a feature? What are your trying to achieve?
Why Do you need a fcntl lock for a process that you kill anyway? [
Usually the fcntl lock + pid file are used to ensure that only one
instance of a process is running. ]
Cheers,
Loic.
- Previous message: alex goldman: "Re: unexpected abstraction penalty in C++"
- In reply to: rm: "kill safety"
- Next in thread: Ed Prochak: "Re: kill safety"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]