I had a file opened using vim
editor. It was in a ssh
session and since I had been idle for a long time, the session got closed and I had to establish the connection again. I opened the file again using vim
editor and it reported me saying,
E325: ATTENTION
Found a swap file by the name ".latest2.sh.swp"
owned by: ramesh dated: Sun May 11 11:54:08 2014
file name: ~ramesh/latest2.sh
modified: no
user name: ramesh host name: xxx.xxx.edu
process ID: 1466 (still running)
While opening file "latest2.sh"
Since I did not change much in the file, I did,
kill -9 1466
I checked if the process is gone using,
ps -aef | grep ramesh
and PID 1466 was not there. Now, when I opened the file again, it gave me the same message,
E325: ATTENTION
Found a swap file by the name ".latest2.sh.swp"
owned by: ramesh dated: Sun May 11 11:54:08 2014
file name: ~ramesh/latest2.sh
modified: no
user name: ramesh host name: xxx.xxx.edu
process ID: 1466
While opening file "latest2.sh"
However the process was not in still running state.
Now, I have a question regarding the PID usage. As per the wikipedia entry,
Under Unix, process IDs are usually allocated on a sequential basis, beginning at 0 and rising to a maximum value which varies from system to system. Once this limit is reached, allocation restarts at zero and again increases. However, for this and subsequent passes any PIDs still assigned to processes are skipped.
Now, assuming I have used up all the available PIDs, will the PID 1466 be used or skipped?
Since, I already killed it, I assume it should be used. However, in my second attempt to open the file I still see the PID 1466.
What will happen in this case?
[[ "$$" == 21824 ]] && echo MATCH && sleep 999999
tobash
until you hit bingo (i.e. sawMATCH
on the console) before generating VIM's output above? – h.j.k. May 12 '14 at 09:31while true; do bash -c '[[ "$$" == 21824 ]] && echo MATCH && sleep 999999'; done
and then launched vim after it got the pid. – phemmer May 12 '14 at 12:32