From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aIn7K6/yQmKZ5wAAgWs5BA (envelope-from ) for ; Tue, 29 Mar 2022 13:51:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 8KT6JK/yQmIKTAEAG6o9tA (envelope-from ) for ; Tue, 29 Mar 2022 13:51:11 +0200 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 01B9413260 for ; Tue, 29 Mar 2022 13:51:11 +0200 (CEST) Received: from localhost ([::1]:42624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZANS-00075a-4v for larch@yhetil.org; Tue, 29 Mar 2022 07:51:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZAHM-0003oU-J6 for guix-devel@gnu.org; Tue, 29 Mar 2022 07:44:53 -0400 Received: from [2001:470:142:3::e] (port=33784 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZAHL-0003sR-RQ; Tue, 29 Mar 2022 07:44:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=kC+OHuGULgmF/0ST4DvzTugp/qHTvfNbVvUCfDpqV1U=; b=aRl4PeNxJ51gafxqDIEv hjKpg9GcSJNNe3TC1B9YQAOtlNkX261Q0PXmuKBzNiNdqx+Tf27yO53A2NRwOZC93nQBaD3JIHzMG eoCbNmf7xPbrFz3YHlueoNIEEmnq4w9AVVTeoOJ5nNNggvgbUCt5r3HlZwVGnCEyf6UKvNo/uwtw6 UNqp6VgthJt/Zdakbh3gs4PNOyndHAb4kGqTE5lk963pbGL/aSc3r74wdLn4/WDPZvYhXL6kau7hZ Cg3hTo7uWzyAu1Vvq8OlOhoM9+p/dZkueRlzJzAadTPN72fuz3rFIiBGwmFIShiTgOk4KNUusLH1q fVGN5NPr94ZZaA==; Received: from [193.50.110.177] (port=51530 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZAHI-0001yI-LZ; Tue, 29 Mar 2022 07:44:49 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: "pelzflorian (Florian Pelz)" Subject: Re: The Shepherd on Fibers References: <87ee2sfg9d.fsf@inria.fr> <20220326110627.dm3t7u2jtjxz5xf6@pelzflorian.localdomain> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 Germinal an 230 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 29 Mar 2022 13:44:45 +0200 In-Reply-To: <20220326110627.dm3t7u2jtjxz5xf6@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Sat, 26 Mar 2022 12:06:27 +0100") Message-ID: <875ynx0yqa.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=1648554671; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=kC+OHuGULgmF/0ST4DvzTugp/qHTvfNbVvUCfDpqV1U=; b=heywJZ+4PZfqkdXurYZl4TB86p3iPBkKnAbqPP7pWWUhaRUTAcll/JYfrQ7Wkfb5R0Q9IE 0dwpI8YoH+TZop1WIY/M+KsAQj+9SoeLTmsMW5jPEVzYA3/2aRA9siz5gj2EcujVL1itmL taLE9v6jDy9b/lI0UB1G8xl+e+lZiUcQ/grdolQEqJyIaAyNzKzqvqA9PlA+/X78ebYEFm KKSFi5IM2w8CrchqwzenoDFS59I3bhOpPoZHe8kcHG26s/zt3tFeyViIwKN5FFmilNEzcU bcnIUA1p+5BkUSA4ZUihKO6AIqRIY6rg+Ee2lGThqxDqhom9aH+g1L2M51XGQA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648554671; a=rsa-sha256; cv=none; b=i1Kp3u1vWBjxSWTlg9rnRqhleJLkGfCo3O8+hOTN1C19r/EAG0r0bz7i0z1bkG9IwYOe+8 h3fyqe+vEH/Sf6KmNPxCdRag2zpzGioI0jkATQwDm29MOdszsTY7fImsBBjtDyrZrN8Hvi xq0eki7YboZ5QaMRR1ZRpJ4wwQQlSySrygAPCLlkAIi39phKcG9Af/wwakR2SDBkVA1mL5 g9Pep1mMBzT5mlXCGdNxZHKwtUhyaHU1C/oyOvLPBe2fdvWnncE1rmC3XQ76WCvop0MEGv MpPF9tSA8evLvsY4HXJD1T4wx4Uj5ZHoGIyVgmeaM5z/yhbCFmAN1OnjxJxoVQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=aRl4PeNx; dmarc=pass (policy=none) header.from=gnu.org; 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.77 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=aRl4PeNx; dmarc=pass (policy=none) header.from=gnu.org; 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: 01B9413260 X-Spam-Score: -7.77 X-Migadu-Scanner: scn0.migadu.com X-TUID: FSsCUOyD9sJ/ Hi! "pelzflorian (Florian Pelz)" skribis: > On Wed, Mar 23, 2022 at 11:36:30PM +0100, Ludovic Court=C3=A8s wrote: >> Fibers is used in a single-threaded fashion, which is the main >> constraint for shepherd since it forks. That also means that fibers >> cannot be preempted, so it=E2=80=99s fully cooperative scheduling. > > To understand what you mean, I needed to read shepherd commit > 934204fbd158aa9fbd42914b89aa960f99eef125 > > + ;; Run Fibers in such a way that it does not create any POSIX thre= ad, > + ;; because POSIX threads and 'fork' cannot be used together > > So shepherd service authors still cannot write blocking code but need > to yield? Yes. Technically though, =E2=80=9Cyielding=E2=80=9D is transparent: any ti= me you do I/O (=E2=80=98get-bytevector-n=E2=80=99, etc.) or call =E2=80=98sleep=E2=80=99 = (specifically the one provided by Fibers), your code potentially yields, letting Fibers schedule some other activity. What that means in practice is that starting services, waiting for PID files, serving clients=E2=80=94all this happens concurrently. It *is* possible to write service code that would block everything, but with little or no effort, you can make it cooperate with the scheduler. HTH, Ludo=E2=80=99.