Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127446 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 lists.php.net (Postfix) with ESMTPS id 780B81A00BC for ; Sat, 24 May 2025 18:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748112414; bh=HeDhH1KF6D9iWoGn/q8L3tFIuG1q/BLXWgsNrHsYGME=; h=Date:From:To:In-Reply-To:References:Subject:From; b=W2v2MRsF00gzsvMQRMzhYKwyE9Nm1B4tFWoTQE4dj/U20wp6tGbykVx1UzGN72HST Qjv4aROtPC7pd9qXHPUIBrSzS8tRrA2AcrV/eZwuyzHRE1HYRmQWqCB9ApLbqGjNP0 GKcra/sIYC7MkAPSpX877XyUE+MvpvdchV79668Zqemv2ZI+M4xzqMFpL/M+WHgcfZ ZuaL94ikItPILMPUba2BfxPik0OqWvZM+HxV6q83qvoYv8Pru968Mvdvay83sX3zd/ a8dMINGlXBrwQDQ5kjoRrhXhqiyRI49yhGelwM9rnmPfuD9uA23PFVATySkGcxeIcv KyNoNRvmbLcSg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B5FA180056 for ; Sat, 24 May 2025 18:46:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 ; Sat, 24 May 2025 18:46:53 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 2815811400C1 for ; Sat, 24 May 2025 14:49:00 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-05.internal (MEProxy); Sat, 24 May 2025 14:49:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1748112540; x=1748198940; bh=HeDhH1KF6D 9iWoGn/q8L3tFIuG1q/BLXWgsNrHsYGME=; b=r/OUZS+G7XjEy/VWNiBbEdr2Xo qx1uPzVoDcnVmI+oDfL4NAJ0R5byaI2+2AL7LLi52buM6fjWhfqrWopAOq5mMsbz dOGf+dq/rM9bsVFZnL7r4P4QExEGHx73zJWWpyy/KyM+0m0KqaI5acssBjfm+LNK GYi7uhM3vLqKtuXtcj0pY7heHSim11i+ENQsUeHFxA3HTbnv08dDV77qwssdlNUD d8WW5M9f0eoBI6VodYGoGHt/Rx9On42AUqpEi2wOYK5qi4R55LsZFwbOe09vkXD0 8OokhP2W+ZAdL3pYJ2nQvgVKc/W6tOXOPAy7gWrJQGMpcyv2UbKi0tCehqtA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1748112540; x=1748198940; bh=HeDhH1KF6D9iWoGn/q8L3tFIuG1q/BLXWgs NrHsYGME=; b=ARqgGoTz6hwzdtH+1yD+K/eqfWk9f5kZZLuw2RYwpsN/gtLj0DC Cz8J8zm8Dd1oKCMZXu2m3M76/bv/kefun0m7OVRFBeODQs4zdFr+DgkkVpFshya3 5YzozPOymYA22TwfbrDjhzZIOlGIBc6VdTYEMAunQXU7hhfwnrPSEvsrzTcrqu1f dXHqcxpj5VRaC/dyWb9IBjNVUZK/ceD7WIIwfP8VnqNkaB0+QmWeNLgY/sBB4jKc ArQkzGB8vhGuciHXd9ewuNKoszHH+jIvvx9iDrwwQevLOgyEKAbVa8f38nHE7BIB AXsQqXsZAi9QddDyzcEZaYOqcO6jfS70W3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdduvdegkeculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecunecujfgurhepofggfffhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedf tfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtghouggvsheqnecugg ftrfgrthhtvghrnhepheeiffekteeljeeufeejffeuffehvedugfetveefieejveffhffh geeuteetffelnecuffhomhgrihhnpehphhhprdhnvghtpdhgihhthhhusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegs ohhtthhlvggurdgtohguvghspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 6D1DE3020061; Sat, 24 May 2025 14:48:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Ta0643016bd41e344 Date: Sat, 24 May 2025 20:48:39 +0200 To: internals@lists.php.net Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] Add num_available_processors Content-Type: multipart/alternative; boundary=9a1243e44a3b4180a1a3a3d42406bb96 From: rob@bottled.codes ("Rob Landers") --9a1243e44a3b4180a1a3a3d42406bb96 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, May 24, 2025, at 19:37, Daniel Kesselberg wrote: > Hi everyone, >=20 > I'm happy to share my first RFC :) It proposes adding a small function=20 > to retrieve the number of available processors; a feature that's=20 > commonly found in other programming languages and one that I believe=20 > would be a useful addition to PHP. >=20 > The related PR has already received a bit of early traction, and now=20 > that the RFC is complete, I'm looking forward to your feedback! >=20 > RFC: https://wiki.php.net/RFC/num_available_processors > Patch: https://github.com/php/php-src/pull/11137 >=20 > Best > Daniel >=20 Looks good! My main question is: what is this actually counting? In the RFC it menti= ons "available processing units" ... which means, what? What counts as a= "processing unit"? Are we talking about CPU Threads/cores; NPU cores; T= PM cores; clocks? GPS? GPU? ... a modern computer has many "processing u= nits" for different purposes and workloads. I=E2=80=99m assuming this is= CPU Threads, not physical cores? I will refer to CPU Threads as "Logica= l Cores" so we all don=E2=80=99t get confused since most of us here are = programmers and saying "thread" has a different meaning. Secondly, how is it counting "available"? If I assign PHP to a specific = CPU affinity mask (say one logical core), will it return 1, or the total= number of logical cores available on my machine? I would expect it to b= e 1, since PHP only has access to 1, but I can also see the logic in ret= urning the total number. =E2=80=94 Rob --9a1243e44a3b4180a1a3a3d42406bb96 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sat, May = 24, 2025, at 19:37, Daniel Kesselberg wrote:
Hi everyone,

I'm = happy to share my first RFC :) It proposes adding a small function =
to retrieve the number of available processors; a feature tha= t's 
commonly found in other programming languages and on= e that I believe 
would be a useful addition to PHP.

The related PR has already received a bit of early = traction, and now 
that the RFC is complete, I'm looking = forward to your feedback!


Best
Daniel

=

Looks good!

<= div>My main question is: what is this actually counting? In the RFC it m= entions "available processing units" ... which means, what? What counts = as a "processing unit"? Are we talking about CPU Threads/cores; NPU core= s; TPM cores; clocks? GPS? GPU? ... a modern computer has many "processi= ng units" for different purposes and workloads. I=E2=80=99m assuming thi= s is CPU Threads, not physical cores? I will refer to CPU Threads as "Lo= gical Cores" so we all don=E2=80=99t get confused since most of us here = are programmers and saying "thread" has a different meaning.
<= br>
Secondly, how is it counting "available"? If I assign PHP = to a specific CPU affinity mask (say one logical core), will it return 1= , or the total number of logical cores available on my machine? I would = expect it to be 1, since PHP only has access to 1, but I can also see th= e logic in returning the total number.

=E2=80=94 Rob
--9a1243e44a3b4180a1a3a3d42406bb96--