Corinna Vinschen wrote at about 10:25:35 +0200 on Wednesday, October 23, 2013: > On Oct 21 18:09, cygwin wrote: > > When I type 'ps', I get as expected the following processes: > > > > PID PPID PGID WINPID TTY UID STIME COMMAND > > 18036 3188 18036 17792 pty0 1001 16:54:33 /usr/bin/ps > > 3188 1688 3188 3212 pty0 1001 06:59:16 /usr/bin/bash > > 1688 1 1688 1688 ? 1001 06:59:15 /usr/bin/mintty > > 2392 1 2392 2392 ? 1001 11:00:03 > > /usr/bin/ssh-agent > > > > When I type 'ps | grep bash', about 2/3 of the time, I get: > > 3188 1688 3188 3212 pty0 1001 06:59:16 /usr/bin/bash > > > > HOWEVER, about 1/3 of the time, I get: > > 16832 3188 17792 16832 pty0 1001 16:56:44 /usr/bin/bash > > 3188 1688 3188 3212 pty0 1001 06:59:16 /usr/bin/bash > > When you pipe ps to grep, the shell forks and execs two processes, ps > and grep. What you see is one of the forked bash processes. They are > shortlived, but depending on the order of execution they may still > linger in the process list when ps creates the process list. > > > And there is no bash process launched in the interim. Moreover, this > > second PID jumps around (both up and down) wildly rather than being > > constant or even relatively sequential. > > PIDs under Windows are not sequential. > > > In such cases, ps -W, similarly generates 2 bash processes: > > > > 3188 1688 3188 3212 pty0 1001 06:59:16 /usr/bin/bash > > 16460 0 0 16460 pty0 1001 17:44:29 > > C:\cygwin\bin\bash.exe > > > > Even more interesting, when I type 'ps | grep ssh-agent', about 2/3 of the > > time, I get: > > 2392 1 2392 2392 ? 1001 11:00:03 /usr/bin/ssh-agent > > > > HOWEVER, about 1/3 of the time, I get: > > 2392 1 2392 2392 ? 1001 11:00:03 /usr/bin/ssh-agent > > 19176 0 0 19176 pty0 1001 Dec 31 > > /usr/bin/ssh-agent > > Hmm, I can't reproduce this one. I tried a hundreds of times, but > there was not a single instance of bash shown as a Windows process.
The Windows case seemed to be less reproducible... but it did happen. Given your explanation as a short-lived forked process, I imagine it would depend to a degree on the speed and architectures (e.g., #cores) of the CPU. HOWEVER, I still don't understand the 'dec 31' date for a short-lived process... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple