This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: 1.5.13:Is it difficult to make cygwin recycle pids when create new process?
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 1 Apr 2005 10:50:12 +0200
- Subject: Re: 1.5.13:Is it difficult to make cygwin recycle pids when create new process?
- References: <d2gufc$m8d$1@sea.gmane.org> <20050331140656.GF2495@cygbert.vinschen.de> <000a01c53658$14130560$0201a8c0@cttcq>
- Reply-to: cygwin at cygwin dot com
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@cygwin.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/