From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MLfdA9f5PmJMfgAAgWs5BA (envelope-from ) for ; Sat, 26 Mar 2022 12:32:39 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eH7lN9b5PmLcKQEAG6o9tA (envelope-from ) for ; Sat, 26 Mar 2022 12:32:38 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AB49E138AF for ; Sat, 26 Mar 2022 12:32:38 +0100 (CET) Received: from localhost ([::1]:51636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nY4er-0007UG-Ox for larch@yhetil.org; Sat, 26 Mar 2022 07:32:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nY4ec-0007U1-AQ for guix-devel@gnu.org; Sat, 26 Mar 2022 07:32:22 -0400 Received: from mail-m971.mail.163.com ([123.126.97.1]:55348) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nY4eW-0003Zy-RG; Sat, 26 Mar 2022 07:32:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=6D55V rqvp96jEUDWDRUsEkdZkUo9gm/KuP4AXTCtq84=; b=mD0gqXDGl7BTz8jmOH2BF JYd8xS1AK/d7Aq6mQpDaJyzIXTk8ZfyeVXeH3RVOUq4eHf7vCZBWE9KYL+KXT7dO zYy5uw+nOfa4ZkyoUZF0K5b0zISnt+6KC+NekdI56z1SN45w0KDAutFFAyO0fxfq 4WPgy16lp1NaDtrqrGOQM8= Received: from asus-laptop (unknown [112.95.108.56]) by smtp1 (Coremail) with SMTP id GdxpCgD3Tca0+T5igO3LFA--.46688S2; Sat, 26 Mar 2022 19:32:05 +0800 (CST) References: <87ee2sfg9d.fsf@inria.fr> <20220326110627.dm3t7u2jtjxz5xf6@pelzflorian.localdomain> <868rsxufwx.fsf@163.com> <20220326111834.zwqeswbc7vrsl4bz@pelzflorian.localdomain> User-agent: mu4e 1.6.10; emacs 27.2 From: Zhu Zihao To: "pelzflorian (Florian Pelz)" Subject: Re: The Shepherd on Fibers Date: Sat, 26 Mar 2022 19:27:00 +0800 In-reply-to: <20220326111834.zwqeswbc7vrsl4bz@pelzflorian.localdomain> Message-ID: <861qypq79p.fsf@163.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-CM-TRANSID: GdxpCgD3Tca0+T5igO3LFA--.46688S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrurW8Gw13Jw48ZF15tw15CFg_yoWkGFb_uF s5JFWv9w1kGrn8KanIgay3WrW3K34UWry5JFs8uF45JFy5Wa1kZFyfu3s7urnrWFnIq3Zx Ar1xXw1ft3s29jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUylk3UUUUU== X-Originating-IP: [112.95.108.56] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/1tbiFBXPr1aD-0gnjAAAso Received-SPF: pass client-ip=123.126.97.1; envelope-from=all_but_last@163.com; helo=mail-m971.mail.163.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648294358; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6D55Vrqvp96jEUDWDRUsEkdZkUo9gm/KuP4AXTCtq84=; b=CCt1XSDOZ49q+x4DlrmQUZW9wSYcLU1uDWUQqrEoJ2AogVNuA+T096Luf+ZzgSyibS+zQx G3PEmYmhrRrMcVi7i6wkkE799Z5633rFuCXHRq4tMnJtO6LNIsvyIezRlOosw9zrmOCz+j UHRw4b4D5VFCojlcrZ9wqXGqpqACq10pGSRvmjdIIGb5P+DItPUKDE2qJIsbIimNrjC0vx Tae8bklPrFOQ5rX7RieZ/8bSvsbE2QbyK7HUqJajJk3PjxEvEfoHg44r0acSBNX7XITL8M xQyuDaZdzZMGe7FMadZtHN/tsTs4s3AX5nL6IT1P890IbejTazntb7W0fJUeaA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648294358; a=rsa-sha256; cv=none; b=WJZ3YUdRUY2d0rGP/lI1rymwYU1cYkcYy4DMb2aRFhmwpVVtOEQUaq0BgF4Ba2EpUV+dkk 1M8/CtqR11nTU/SXaVpSes2iZAdI6IOqda3T2vs2nRsg4Bbh6UmbjOI1NlUgUJZ72IvYZU sqKxn5Jq8vn1xWMol9sxzdzwdLxGab+hrGSIa/rW7cYMrpeECrR8qIf+SN6dKxjFEz63xR Uke8xdPV0TDj52Qv8KI2QPiuxA0P8ZiK0PwXSFf6nxwUMxmSTobJUzWkn7RmJiyia06d+I Xkofx6T7bCZS+0VxrCh6nz6mdMP0vUezQkvty9s+UQOfQQr0FfP4xFmMflUQBA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=163.com header.s=s110527 header.b=mD0gqXDG; dmarc=pass (policy=none) header.from=163.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.48 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=163.com header.s=s110527 header.b=mD0gqXDG; dmarc=pass (policy=none) header.from=163.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: AB49E138AF X-Spam-Score: -7.48 X-Migadu-Scanner: scn0.migadu.com X-TUID: NwkpwpdoIX2G --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable IIUC, After fork and execute the program, shepherd will wait for the pid file to appear. This is a block operation. Shepherd on Fiber make this operation non-blocking (because the pid file is created by Linux kernel, Shepherd just need to wait for it), every service activation runs on its own fiber. after fork+exec, shepherd suspend current fiber, andspawn another fiber to start another service immediately. But finally all fibers are co-operatively scheduled on 1 thread. "pelzflorian (Florian Pelz)" writes: > On Sat, Mar 26, 2022 at 07:09:12PM +0800, Zhu Zihao wrote: >> > So shepherd service authors still cannot write blocking code but need >> > to yield? >>=20 >> IMO, service should not block service, if they have something important >> to do before running a program, why not fork first and do it in the >> child-process (maybe wrap the actual startup program in Guile script)? > > In other words, all stays the same as without fibers? > > Regards, > Florian =2D-=20 Retrieve my PGP public key: gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F Zihao --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYj75shUcYWxsX2J1dF9s YXN0QDE2My5jb20ACgkQZjl/hPdmk/n7QQEAwwWszu5ETiT2xWTnZ7++D2MaPS4Y /6sO/YQnvCwue50BALhVrf/H1LzhKNbTz/E3U8mHo94o+7MDYKoAUNKRQDEP =+yEI -----END PGP SIGNATURE----- --=-=-=--