Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113160 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16060 invoked from network); 12 Feb 2021 21:54:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Feb 2021 21:54:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9DF3F1804CF for ; Fri, 12 Feb 2021 13:40:17 -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=-0.0 required=5.0 tests=BAYES_40,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mercury.negativeion.net (mercury.negativeion.net [199.38.81.6]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 12 Feb 2021 13:40:17 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id BDC1C20C674E4F for ; Fri, 12 Feb 2021 16:40:16 -0500 (EST) Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QOne7Ye0HKIk for ; Fri, 12 Feb 2021 16:40:15 -0500 (EST) Received: from [10.0.1.101] (unknown [173.225.146.47]) by mercury.negativeion.net (Postfix) with ESMTPSA id DD44320C674E43 for ; Fri, 12 Feb 2021 16:40:15 -0500 (EST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Date: Fri, 12 Feb 2021 15:40:15 -0600 References: To: php internals In-Reply-To: Message-ID: X-Mailer: Apple Mail (2.3608.120.23.2.1) Subject: Re: [PHP-DEV] [RFC] Fibers From: aaron@trowski.com (Aaron Piotrowski) > On Dec 17, 2020, at 10:30 AM, Aaron Piotrowski = wrote: >=20 > Hello everyone! >=20 > I would like to introduce an RFC for adding full-stack fibers to PHP: = https://wiki.php.net/rfc/fibers >=20 > Fibers are primarily used to implement green-threads or coroutines for = asynchronous I/O. Fibers are similar to threads, except fibers exist = within 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. >=20 > An implementation as an extension is at = https://github.com/amphp/ext-fiber >=20 > Fibers are a complex feature. The RFC contains many examples and links = to code using fibers to help explain and demonstrate what is possible, = however I=E2=80=99m certain many more questions and concerns will arise. = Looking forward to feedback and discussion. >=20 > Aaron Piotrowski > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Hello again everyone! Based upon feedback both on this list and elsewhere, I=E2=80=99ve = decided to remove the FiberScheduler API from the fiber proposal. The FiberScheduler API greatly increased the complexity of the = implementation and the potential for edge cases that would need to be = handled and maintained. The intent of including the FiberScheduler API = as part of the proposed implementation was to require usage of fibers to = be interoperable between various libraries. However, this was perhaps = over-reaching, and the core should only provide the most fundamental = tools for fibers. The Fiber API proposed now resembles that of Ruby and other languages = providing a fiber API. The revised RFC now proposes only a minimal API = required for fibers =E2=80=93 no more, no less. I believe this minimal, = simplified API should resolve any concerns raised about adding the fiber = API to core. I would like to open voting for this RFC around the beginning of March, = so please review the minimal API and provide any feedback soon. As before, amphp v3 (https://github.com/amphp/amp/tree/v3) and = trowski/react-fiber (https://github.com/trowski/react-fiber) provide = real-world examples of how fibers can be used in addition to the = examples in the RFC. Cheers! Aaron Piotrowski=