delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/01/03:50:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Fri, 1 Apr 2005 10:50:12 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.13:Is it difficult to make cygwin recycle pids when create new process?
Message-ID: <20050401085012.GB7415@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <d2gufc$m8d$1 AT sea DOT gmane DOT org> <20050331140656 DOT GF2495 AT cygbert DOT vinschen DOT de> <000a01c53658$14130560$0201a8c0 AT cttcq>
Mime-Version: 1.0
In-Reply-To: <000a01c53658$14130560$0201a8c0@cttcq>
User-Agent: Mutt/1.4.2i

On Apr  1 09:13, Merlin Ran wrote:
> > Doesn't http://www.cygwin.com/ml/cygwin/2003-10/msg00169.html explain it?
> > 
> No. I learned why using two pids from the post, but it still doesn't explain
> why winpid is always increasing. Since every process is created by
> CreateProcess() ultimately, why doesn't it behave alike native windows
> process, which reuse the pid of previously exited process? After consult msdn
> online, I haven't found any parameters which can affect the selection of new
> process's pid. How could cygwin achieve this?

Cygwin does nothing and can't do anything to influence the Windows PID
chosen by the system.  Also I can't reproduce any of your assertions.

Windows allocates PIDs using some strategy which I don't quite understand
but it certainly doesn't reuse PIDs trying to get a PID of a just exited
processes.  Actually it seems to me that PID values are nothing else but
handle values like every other handle pointing to a system object.

I also don't see that Windows PIDs are always increasing under Cygwin.
Where did you get this impression from?  I've started a couple of shells
to get a nice process tree.  Look at the Windows PIDs.

$ ps -e
      PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
     4148       1    4148       4148    ?   18 21:15:28 /usr/bin/cygrunsrv
    11032    4148   11032      11540    ?   18 21:15:28 /usr/sbin/sshd
    11144   11032   11144       2672    ?   18 10:31:08 /usr/sbin/sshd
     9076   11144    9076       8336    0 1003 10:31:09 /usr/bin/tcsh
     2888    9076    2888       1408    0 1003 10:31:32 /usr/bin/tcsh
     3944    2888    3944       1468    0 1003 10:31:40 /usr/bin/tcsh
    11340    3944   11340      10080    0 1003 10:31:44 /usr/bin/tcsh
     9088   11340    9088       3092    0 1003 10:32:23 /usr/bin/tcsh
     7348    9088    7348       4936    0 1003 10:32:47 /usr/bin/tcsh
I    9484    7348    9484       5416    0 1003 10:32:55 /usr/bin/tcsh
     9872   11032    9872      10876    ?   18 10:41:43 /usr/sbin/sshd
     1112    9872    1112       9924    1 1003 10:41:44 /usr/bin/tcsh
     3884    1112    3884       1220    1 1003 10:41:49 /usr/bin/tcsh
     2368    3884    2368      10840    1 1003 10:41:50 /usr/bin/tcsh
     7056    2368    7056       7548    1 1003 10:41:52 /usr/bin/tcsh
     6228   11032    6228        252    ?   18 10:43:25 /usr/sbin/sshd
     6836    6228    6836       9512    2 1003 10:43:25 /usr/bin/tcsh
     5192    6836    5192       7784    2 1003 10:43:27 /usr/bin/tcsh
    11544    5192   11544       2668    2 1003 10:43:29 /usr/bin/tcsh
     1640   11544    1640       4496    2 1003 10:43:30 /usr/bin/tcsh
I   10348    1640   10348       3956    2 1003 10:43:31 /usr/bin/tcsh
     9436    7056    9436       8200    1 1003 10:47:01 /usr/bin/ps


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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