From faf5c2308434f30e6cdb9014b4b60f873f9abfc4 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 18 Dec 2022 10:37:11 -0500 Subject: [PATCH] doc: add parallelism note to os.cpus() With the introduction of os.availableParallelism(), users should no longer rely on os.cpus().length to determine the amount of available parallelism. This commit adds a note to the os.cpus() docs. PR-URL: https://github.com/nodejs/node/pull/45895 Reviewed-By: Moshe Atlow Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/os.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/os.md b/doc/api/os.md index 59ad6224bef431..f2221000cabd45 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -140,6 +140,10 @@ The properties included on each object include: `nice` values are POSIX-only. On Windows, the `nice` values of all processors are always 0. +`os.cpus().length` should not be used to calculate the amount of parallelism +available to an application. Use +[`os.availableParallelism()`](#osavailableparallelism) for this purpose. + ## `os.devNull`