Two processes are always created while running cygwin program(bash, ls, etc) under windows 2003 x64 R2

Corinna Vinschen corinna-cygwin@cygwin.com
Tue May 3 10:43:00 GMT 2011


On May  3 08:44, Oh, Choong-Hyun (HPSS-BSM) wrote:
> Dear all,
> 
> I found strange behavior of cywin application under windows 2003 x64 R2 version.
> When I run bash, it creates parent bash process and also child bash process as like followings;
> 
> 
> cmd.exe
>   +- bash.exe
>      +- bash.exe
> 
> services.exe
>   +- cygrunsvr.exe
>      +- cygrunsvr.exe
> 
> 
> But on Windows 2008 x64 R2 system, it create only one process as like followings;

I assume you mean non-64 bit here.

> cmd.exe
>   +- bash.exe
> 
> services.exe
>   +- cygrunsvr.exe
> 
> So I am wondering whether it is normal behavior of cygwin on Windows 2003 x64 R2 system or not.
> And also if so, what's a cause of this happening.

This happens if a Cygwin process (which is 32 bit and thus running in
the WOW64 environment) is called from a 64 bit Windows process.

On the older XP and 2003 64 bit systems, the first WOW64 processes
main thread started from a 64 bit process gets a stack address in the
range where usually the application itself resides.  This in turn
breaks Cygwin's fork.

Therefore a Cygwin process checks at process startup if it has been
started by a 64 bit parent process and if the stack address is in the
dangerous region.  If so, it re-spawns itself.  Since this second
process is started from another 32 bit process, its stack address is
useful again.  The intermediate process keeps in memory as long as the
re-spawned process runs.


Corinna

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

--
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



More information about the Cygwin mailing list