Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112921 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 294 invoked from network); 18 Jan 2021 15:20:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jan 2021 15:20:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A68AC1804C6 for ; Mon, 18 Jan 2021 06:59:50 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 18 Jan 2021 06:59:49 -0800 (PST) Received: by mail-wm1-f44.google.com with SMTP id e15so7638772wme.0 for ; Mon, 18 Jan 2021 06:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p42SmyXANfzi0ZW+eWB7FuovFAGS1Y1Zebez2HGxQak=; b=FJqeLxXOe3151FZmM9lQZqZkhgtqOZIgl2uuLWFvp1xc8OJGRAWxrIAVqMO7vc9Zwk PXFsFTTs9WgHW/tUuYfFQ7ho+fIQOMvAv4UEIfd0Wq+vwbDinjQJa/p6YDCow4LSssr0 3PfQSZyd0z5vVlkdPlW2DLFMswtZIZ2etHEaQDgL8LukEvhMas82pqYMxRrsTgNFzhWz rIhk23Wr6liZVWmHTixdyNBSDaQ1ytff1g9er7rfKtvFD+AptCS2nHPsNLODs3n8NAyF 1vUcqbGZhy2mXIYHkPExK+nXJUshftUIPYt2kPS6UYCUm59h0A8zQLmzpRBUQM3gfqOh BcUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p42SmyXANfzi0ZW+eWB7FuovFAGS1Y1Zebez2HGxQak=; b=O6YPoLoZEVyEKQ20Odlr06QmEkZHMiUKy5TdAGIbSPz3EAY3zpBwIdG8+3fRRRFGo9 1FH7kCQueKJmc3X7gWW2l2b2CkkOugLxPD5DvvIe6XnkyPiu3NQW2wbrIdpIGvJLHVRP vA4w1IU9IW/BVX0MBIQ8oQP2W5pY4GdxM1xXppKT++dgTZZADSad+jSx6v5MNJqo5ZVz wrmOJlg6XlRBIt0eKgi200FiVcwkxc9FTXsBbQ5yaBuzIlijqwQ+CqUyPz8mY45Xj1Yh 9zqJaPRTWXyWkP85yDZoUgbCk3iUM+NaWxMuw/tBdkBQnPePvJNZjanrk2ybCXb4r21B 34Ig== X-Gm-Message-State: AOAM530WgbyNrenKA58uxrNEuI/jUHbPCp60BBYL+8NaGweGTEM85oNt r2ePCOKy8kDFkPJuue7plIw17x++exWFmZOHe15bVu9PkP9aWg== X-Google-Smtp-Source: ABdhPJwgGzdFJeitzvsvmtC/lN4pvf5s4JdJW8wjzYETXNtlrYQPl45Bq7aIDga6gSyKKQ2+gCjdV9yTA0XfphC3MHM= X-Received: by 2002:a1c:ed0e:: with SMTP id l14mr3317025wmh.168.1610981986647; Mon, 18 Jan 2021 06:59:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 18 Jan 2021 15:59:35 +0100 Message-ID: To: Aaron Piotrowski Cc: php internals Content-Type: multipart/alternative; boundary="0000000000000dd17c05b92df9c9" Subject: Re: [PHP-DEV] [RFC] Fibers From: kontakt@beberlei.de (Benjamin Eberlei) --0000000000000dd17c05b92df9c9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 17, 2020 at 5:30 PM Aaron Piotrowski wrote: > Hello everyone! > > I would like to introduce an RFC for adding full-stack fibers to PHP: > https://wiki.php.net/rfc/fibers > > Fibers are primarily used to implement green-threads or coroutines for > asynchronous I/O. Fibers are similar to threads, except fibers exist with= in > a single thread and require cooperative scheduling of the fibers by the > process. Since fibers do not require a full CPU context switch, they are > lightweight and more performant than multi-processing or threading for > awaiting I/O. > > An implementation as an extension is at https://github.com/amphp/ext-fibe= r > > Fibers are a complex feature. The RFC contains many examples and links to > code using fibers to help explain and demonstrate what is possible, howev= er > I=E2=80=99m certain many more questions and concerns will arise. Looking = forward to > feedback and discussion. > > Aaron Piotrowski > Hi Aaron, this is a very interesting and welcome piece of functionality. I have gone through the RFC a few times now, it have never thought about or worked with fibers before, additional feedback will be forthcoming once I grasp the details more. From my POV the effects on other extensions are the most important factor, you already have a section with that for Xdebug, Parallel, and pcov. But how does this affect Profilers that manage their own stack of frames, either all function calls or specifically selected ones. I.e. xhprof, tideways, datadog, newrelic and so on. At the moment any PHP Profiler only has to manage a single stack of "open frames". With Fibers for each fiber a new stack must be opened. Does an extension know what the "active" fiber is so that from a zend_execute_data I know on which stack of open frames I need to push a new frame? Could you add a section to the RFC explaining how a switch between fibers works in terms of "the next" and "previous" zend_execute_data that is run? This would also be interesting to understand how stack traces work, for example debug_print_backtrace. > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000000dd17c05b92df9c9--