delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/23/08:56:30

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:mime-version:content-type
:content-transfer-encoding:message-id:date:to:subject
:in-reply-to:references; q=dns; s=default; b=N8Ua+KtEaCsJLt0CFQJ
RYzdnSBVmXQqzHtkrTOhZoFFsX/YclGFR4cVH3wcG2/4gStvrI3Pg+O0x3fY8nt0
+77QyncAf5djeG3KCUX1XR96yb1aVc5zgr5eEmCRFkNe0OfnhLkAiaP93a57OPdj
Nd7IBu528eZTwuNoqE+I6NdU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:mime-version:content-type
:content-transfer-encoding:message-id:date:to:subject
:in-reply-to:references; s=default; bh=2yHzkUYGW0vlYv2f+kIo0ApNI
1o=; b=Xcyt+n3YOWnSiLE4fDrMG7Jf15ZeSSbHe3D7XGF1vw+GNs4+BxHWSKTxG
ueQJ5yvywUD+z/Dnv7amLRmfc+TxAVD225EyGamlU5A5T9CHTzGdDFYOcgsWuyij
2Xd+7G6oH/nMxn1fE3+9DNIWS8nQpL0IAyqz9PkL6h/sUEQUBY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: vms173003pub.verizon.net
From: <cygwin AT kosowsky DOT org>
MIME-version: 1.0
Message-id: <21095.51020.811223.778148@consult.pretender>
Date: Wed, 23 Oct 2013 08:55:40 -0400
To: cygwin AT cygwin DOT com
Subject: Re: ps weirdness...
In-reply-to: <20131023082535.GA5134@calimero.vinschen.de>
References: <21093 DOT 42532 DOT 550364 DOT 992074 AT consult DOT pretender> <20131023082535 DOT GA5134 AT calimero DOT vinschen DOT de>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019