delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/06/09:24:00

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAB723858030
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709735039;
bh=kKyYrVDEyUD4kcYrbNzrmcaWtJTHM2mypaRQ1xSqIUs=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=rI4gt+xiwgf9s9c1DBga1DCmTMTz2y9huQ6fex6DX+f9zMlDuwuqW8AsF4M7AsO9f
+uqjBG80SGJyznFDfagiWwqzXt/o4fWFTROBMXIepVil6YSnKxs3lWmXtjRHX2GjHv
FtWKH+LJgbOSRJLSIRdEtKpzY0xV71kSyCD2P+vg=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6792A3858D34
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6792A3858D34
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709735020; cv=none;
b=raVaXzJUmVegW62C/nX/Krorr+dWf6oyHlDE2yKdd05m6akD+genj7ko0QkDlDkwNZvdOCNwTmingpazNArzQEcrpJDo87M9XVyaABXzxxJFPkghu3P1a3ubVm59ElonGl3LkZEyCgPbq9N8B8WotLhB9pWgHJwnZBfuZsA20DU=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1709735020; c=relaxed/simple;
bh=I+c+qjxexITCx7CIAOXv15iAamL1SpeZFZy2CMr+jUM=;
h=MIME-Version:From:Date:Message-ID:Subject:To;
b=kyT0M3Ke356ITR0QSNWYhdJJyUz8RmFRwffNeXboTFzeWK/Zp6HGYDxkO3NH1Tlc/6SDttRh5D1wDTJkrwIWkXK76uk5sWZkNzyy59AVZ3pja2indhyqQ6H2in0GhX216hRrUrOFvMENgbA9olAoeaBzc3yGNEu7hJ/CJmsg1QM=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1709735017; x=1710339817;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=8dt1iVex0DYVcrqUGryL1oAfxcyO/qpd7JI7ssdcp3Y=;
b=f8u1enTfPPswqvpvV5VcnRfBOsRaPcTEiClCOS2ni+8WxEo1YM5ezOwwpMFBxQ54bJ
yqbL10Q0aA7kEmIKejebrfRI1FBkHIQ4RM/7rvXL8ZxK9ir19yJfJobEZzG7Q1cQ0qnj
ZBqHWw1f5LPToyvhxZ+D2FmmCgQQGVNhoB9XneGTLynZwFrTeEX7I7VoTuZtGGlJQmtT
dCOzmlUgMNIXA29t5g7o6odAhY3PSjxs1ptyvFNrE1fgmIEGkzELIDz77lGb1NVPxmdX
VSl069meNy45eyk82FTB9Q9K5HUrV4agPiOP6DlXPoB7n/DD2rwl/EC7HC09L3W887UK
rnkQ==
X-Gm-Message-State: AOJu0YzASB3mlI8kky+6cENWQ7aT7vfpNxnX9bAw24Cj2lEP1caV8QIv
zShCiTwK6LTif4+Gkx4oTmXz74HDgFw6GLtYzE5UPpCCTU4BPdnEIgEi04UI+ZoZMjbjY2ND847
SZqRhPnyYEH4i2jff+e68cj5SuvklIyMfGXQ=
X-Google-Smtp-Source: AGHT+IEMVbT93N8HO/H5fYWkak7F72YeaqgHWsH9p2tYUmHzmMdGZpoYbkZurRAqKznvnw6i46QG2q2IS6H+idQDdgk=
X-Received: by 2002:a6b:6f0f:0:b0:7c8:5c91:d6ba with SMTP id
k15-20020a6b6f0f000000b007c85c91d6bamr7742316ioc.8.1709735017043; Wed, 06 Mar
2024 06:23:37 -0800 (PST)
MIME-Version: 1.0
References: <CAAvCNcCSaRBKYwd8-bU_rRh+m9LajyAVSHi3vH_3iaxwg1GE-Q AT mail DOT gmail DOT com>
<00ca6f45-aef6-4d0c-9440-8a00b2de487a AT SystematicSW DOT ab DOT ca>
<CAAvCNcDeYwhpq4Q9ftRgq3oErZNiS=x7DaLr-Lt6gAzG-npGfA AT mail DOT gmail DOT com>
<Zd2ChRq46MUMv0rU AT xps13>
<CAAvCNcBTRkJuD52dZsPePAG_yK_cBc=Ps4QPeG1BBXdZp5OYdg AT mail DOT gmail DOT com>
<da003a14-a7ea-46d8-8ded-0f4e49290704 AT maxrnd DOT com>
<CAAvCNcC6232r+r-a4fme_POrWis_e9yEgMXrLk00E1ptRbS7UA AT mail DOT gmail DOT com>
<4ab591dc-6586-4879-94b1-a3c087af1d4f AT maxrnd DOT com>
In-Reply-To: <4ab591dc-6586-4879-94b1-a3c087af1d4f@maxrnd.com>
Date: Wed, 6 Mar 2024 15:23:10 +0100
Message-ID: <CAKAoaQmJtp+u4AcazjdCT4WwPKa4cK1P+xJ2=NEue-=RFBNdow@mail.gmail.com>
Subject: Re: Native posix_spawn() in Cygwin?
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,
FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,
KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,
SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Roland Mainz via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Roland Mainz <roland DOT mainz AT nrubsig DOT org>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 426ENxQY3754324

On Wed, Mar 6, 2024 at 1:08 AM Mark Geisert via Cygwin
<cygwin AT cygwin DOT com> wrote:
> On 3/5/2024 2:42 PM, Dan Shelton via Cygwin wrote:
> > On Mon, 4 Mar 2024 at 07:45, Mark Geisert via Cygwin <cygwin AT cygwin DOT com> wrote:
> >> On 3/3/2024 7:27 PM, Dan Shelton via Cygwin wrote:
> [...]
> >>> strace does not help, as I need the Win32 calls BELOW posix_spawn(),
> >>> to see the implementation details.
> >>
> >> Check the source code, then. It's at:
> >>       https://cygwin.com/cgit/newlib-cygwin/tree/winsup/cygwin/fork.cc
> >>
> >> Look at line 587; there's the static function dofork(). Look at the
> >> thirty or so lines above that; there's both fork() and
> >> __posix_spawn_fork() calling dofork(). So both those user-level
> >> functions call into the exact same internals. (BTW __posix_spawn_fork()
> >> is called from posix_spawn(); the latter is in newlib and not Cygwin.)
> >>
> >> You can even see the reason it's done this way by reading the comment.
> >
> > Yes, but it is as I feared, Cygwin posix_spawn() does not use Win32
> > spawn() at all, and instead uses a rather inefficient vfork()
> > solution.
>
> Cygwin's vfork() is just a wrapper around fork(), so yes. But anyway...
>
> > posix_spawn() was added to POSIX so a Win32 implementation can use Win32 spawn()
>
> ...now I see what you're getting at:
>
> If posix_spawn() is intended to launch truly unrelated processes, with
> minimal or no coordination with the launching process, why can't it just
> use Windows' CreateProcess? I assume here that's what Win32 spawn() does.
>
> That's an interesting research question for somebody. If somebody steps
> up for that, great, otherwise as usual PTC.
> Regards,

Just one note (which applies to UNIX/Linux):
When I was at SUN we had severe performance problems with large
JAVA&&database processes launching little helper apps. It turned out
to be a |fork()|+|exec()| problem - the |fork()| was basically
harmless, but the |exec()| syscall required to tear down all address
space, which involved cross-calls to all other CPUs. The performance
penalty on a 64 CPU Enterprise 10000 or 72 CPU (up to 144 threads)
SF25k was *DEVASTATING* ( <--- understatement).

This was fixed for Solaris 11 in several ways:
1. Solaris 11 got a native |posix_spawn()| syscall, and which avoids
both |fork()| and the (in this context) dreaded |exec()|, and just
sets up a new process with copying only the bare minimum of data from
the parent process.
2. Solaris's ksh93 (which is used as /sbin/sh+/bin/sh) got support for
|posix_spawn()| (thanks for David Korn and Glenn Fowler for doing
that)
3. JAVA was modified to use |posix_spawn()|
4. Oracle was asked to use |posix_spawn()| too

For Cygwin I think it would be good to implement a |posix_spawn()|
using the native Win32 API too...

----

Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland DOT mainz AT nrubsig DOT org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

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

- Raw text -


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