delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/03/06:43:51

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 3 May 2011 12:43:05 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Two processes are always created while running cygwin program(bash, ls, etc) under windows 2003 x64 R2
Message-ID: <20110503104305.GF22745@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <210B64CF6061D847B4FE2374C8F37C6959DC652E58 AT GVW1160EXB DOT americas DOT hpqcorp DOT net>
MIME-Version: 1.0
In-Reply-To: <210B64CF6061D847B4FE2374C8F37C6959DC652E58@GVW1160EXB.americas.hpqcorp.net>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

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

- Raw text -


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