Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126875 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id A009F1A00BC for ; Thu, 20 Mar 2025 18:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742495195; bh=iD5ItRGXpz8OI22IjmVCdBLPppbR7TFSlCBvvdvZ0TM=; h=References:In-Reply-To:From:Date:Subject:To:From; b=ltO35XWuNsw+OEDYX/YZZt5GgUSMpAAz0n1zI6QHOOlc8LnjPu4+98DSEtwpQ6s6A z0JnVk7Bfxk8LBQSFGBOToTSSUTZkTHII31YszfjUtOAVQYzNhQ5mE/Qo14vsRmbHh lpFQ/cZ+8XBWmQpaoh+3ProzJO3l6J/r7gJR27q3DghDioJ791n/osxset2DvJQbrj Xpao12Nt6cHT6uUw7uOinTtenos8+UEtDE32bvqS8uAYaVHrQ86ifFbpu+qf7OwrXX PERVVSe6mVwAtlZG4xnAAzGVl39OVzYGVPC3JHBOoQB9iWAmCYhIqRJHTKyGjjHnzI 9l93aKa3ks4Lw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8CCB8180088 for ; Thu, 20 Mar 2025 18:26:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 20 Mar 2025 18:26:34 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-30185d00446so1612580a91.0 for ; Thu, 20 Mar 2025 11:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742495344; x=1743100144; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=xZyB47Cbe4nPtZwnHj9M3dnYnMKL8sm3ZqrhwGWS41A=; b=KS3P2KgPj8e07XmV7oU+JdIb1RGyNZxl3RdPWvPspJf6f3Suak/JcboyZ3uNViJwtL HfkvjT03H2u6z3r0GmE6jF8feUFhc0nx9QXDkF68EaFFn94vIgjVkHhWDLxMV5nOlDMu HgPqG4aOoIzMq3Suk9Q8rInjOIB0v1k08Nco0xjyCepup9UbO0+XPoi9LwUUWqDa/648 hTeTsj15xPDaVkPkzmDsVHBLkce04FR5Vq6shSQ22JWyQh9PcVgOk1gDIbImCXHehA8U hOoaLG3wWP+rO5jY9HTbN4X9Y8UE2eNzH3+pFwvwqC/EEKE2aiMNv3Nq2YRsRz1GQ8pq rWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742495344; x=1743100144; h=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=xZyB47Cbe4nPtZwnHj9M3dnYnMKL8sm3ZqrhwGWS41A=; b=ZAEbJRAMEw5rUk8jWFBVJu1laHAiZWao71wVYO8EdA3pUQ0x5OysqViwZpfY68v4LV KjNFG4If7xnYNIYRM+TCmmjFklsn/arPbE6Zo/yB4U4gMmdmRGATzOWnmdQ2yoqF4wft OLQAAGEfBRuzDhNlUMRfEHPZWe3amH6LJ+5JdrI7EBlakx7gbIbWmvLqmU+84c4PKV8/ LZD+ZlW9L6jtVpfThl1xOth+u2l0v0kjUlZHCLJ8d/qw6RiDpoowV9aYstBTq8g/VDnB O9yQLNWnpIm+Ll1zfnKrpb1huqiA8KJ5bMwyyWEmIzJjvsrTFS7JHHK6byuGPm0cdVJN 8H7w== X-Forwarded-Encrypted: i=1; AJvYcCXEV6tEreas+Sk63AF/cFK5FH/KMTiK26cwGnk3xJA9KOra9ffdUuWiFJgkdYfUkFKSYMF/zYNpD50=@lists.php.net X-Gm-Message-State: AOJu0YzCRo3fAQqkqkOiQZ7Ksq7eNJ6UBozUeDKbage6noL+r/IooSOt tFR+V5HGaJbqgU0cu4c0vjjjrjGyXxoTEuZ+R0XsLoa3wJHsSS0/gzZWh81WvdedCDMnPObmX1z AHz1jVHdmWf31zdIPsmBzSLPlOT7jJ8wiN9M1yQ== X-Gm-Gg: ASbGncv4QNK/4/JiRQmFnd9VlIDNFX1OQGt+6uoPcztxBWsha6nKph92UxUMQmClwrv oqAF+BG3d2f7Loqn0zSzs1P6rKjtpOwaffJueoA4pF6NA6cyO12EuAlfBQx2A28S39MZL+1RE4i HiCsax26Rj3d6Op+bKV0J6yfQYKQ== X-Google-Smtp-Source: AGHT+IHujmHjRMejlngNrIjG82afumdRA6WLGEuMSP2v+gA8uhX6dDglZ88+QcYqur3jmVUISqX0nR+l5Fky6Ek8iP4= X-Received: by 2002:a17:90b:1d48:b0:2ff:6e58:89f5 with SMTP id 98e67ed59e1d1-3030ec2648cmr860478a91.6.1742495344082; Thu, 20 Mar 2025 11:29:04 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <72bd5401-53a9-409f-ad45-687333401961@rwec.co.uk> <6987D912-CE46-4145-A8CE-732CA590A522@rwec.co.uk> <2F013672-9937-4AB1-BC46-86F3D342BE6B@rwec.co.uk> <743c84d4-28db-4f68-80e5-3cad2dac6e68@rwec.co.uk> <8b977572-43df-40d8-a950-6789d3242429@app.fastmail.com> In-Reply-To: <8b977572-43df-40d8-a950-6789d3242429@app.fastmail.com> Date: Thu, 20 Mar 2025 20:28:50 +0200 X-Gm-Features: AQ5f1JrDMzgAzoo-hys3GfKuZqPwQil33J9-cAbNXiLgi1fNDd_u5zDr6ZnUDd0 Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC - Stage 2 To: Larry Garfield , Edmond Dantes , php internals Content-Type: multipart/alternative; boundary="00000000000001c86a0630ca5029" From: i.miroslavov@gmail.com (Iliya Miroslavov Iliev) --00000000000001c86a0630ca5029 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >> >> This example highlights one of the concerns I have with fibers and this approach in general. That example will still execute synchronously, taking file_get_contents() * 3, even though it is in a coroutine function. >> >Is that really a problem? If a programmer wrote the code `$x =3D 1 / 0`, then the issue is definitely not with the division operation. It is a problem. IO file operations are async on linux. You have to manually type the `sync` command to be sure if you copy something to another drive. So having a file_get_contents x3 will surely be executed but file_put_contents will delay On Thu, Mar 20, 2025 at 7:57=E2=80=AFPM Larry Garfield wrote: > On Thu, Mar 20, 2025, at 2:06 AM, Edmond Dantes wrote: > > This is simply a wonderful explanation. I will be able to go through > each point. > > > > But before that, let's recall what spawn essentially is. > > Spawn is an operation that creates a separate execution context and > > then calls a function within it. > > To perform this, spawn requires two things: > > 1. **callable** =E2=80=93 something that can be called; this is an expr= ession > > or the result of an expression. > > 2. **argument list** =E2=80=93 a list of arguments. > > Nitpick to make sure we're talking about the same thing: What does > "Separate execution context" mean here? Because a keyword whose > description includes "and" is always a yellow flag at least. (See also: > readonly.) One thing should not do two things. Unless what you mean her= e > is it creates a logical coroutine, within the current async scope. > > (I suspect this level of nitpickiness is where the confusion between us > lies.) > > --Larry Garfield > --=20 Iliya Miroslavov Iliev i.miroslavov@gmail.com --00000000000001c86a0630ca5029 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>>
>>=C2=A0 This example highlights one of the = concerns I have with fibers and this approach in general. That example will= still execute synchronously, taking file_get_contents() * 3, even though i= t is in a coroutine function.
>>

<= /span>
>Is that really a problem? If a programmer wrote = the code `$x =3D 1 / 0`, then the issue is definitely not with the division= operation.

It is a pr= oblem. IO file operations are async on linux. You have to manually type the= `sync` command to be sure if you copy something to=C2=A0another drive. So = having a file_get_contents x3 will surely be executed but file_put_contents= will delay=C2=A0

On Thu, Mar 20, 2025 at 7:57= =E2=80=AFPM Larry Garfield <la= rry@garfieldtech.com> wrote:
On Thu, Mar 20, 2025, at 2:06 AM, Edmond Dantes wrote:<= br> > This is simply a wonderful explanation. I will be able to go through e= ach point.
>
> But before that, let's recall what spawn essentially is.=C2=A0 > Spawn is an operation that creates a separate execution context and > then calls a function within it.=C2=A0
> To perform this, spawn requires two things:
> 1. **callable** =E2=80=93 something that can be called; this is an exp= ression
> or the result of an expression.=C2=A0
> 2. **argument list** =E2=80=93 a list of arguments.=C2=A0

Nitpick to make sure we're talking about the same thing: What does &quo= t;Separate execution context" mean here?=C2=A0 Because a keyword whose= description includes "and" is always a yellow flag at least.=C2= =A0 (See also: readonly.)=C2=A0 One thing should not do two things.=C2=A0 U= nless what you mean here is it creates a logical coroutine, within the curr= ent async scope.

(I suspect this level of nitpickiness is where the confusion between us lie= s.)

--Larry Garfield


--
Iliya Miroslavov Iliev
--00000000000001c86a0630ca5029--