Skip to content

os.cpus() docs misleading #16279

Closed
Closed
@lukechilds

Description

@lukechilds

The docs for os.cpus() state:

The os.cpus() method returns an array of objects containing information about each CPU/core installed.

It would be more accurate to use the word "threads" rather than "CPU/core". Not sure if this behaviour is intentional or due to how the OS reports cores. Either way, a note in the docs would be helpful to clarify this. Do you want a PR?

Example:

$ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz

$ sysctl -n machdep.cpu.core_count
2

$ sysctl -n machdep.cpu.thread_count
4

$ node -e "console.log(require('os').cpus().length)"
4

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.osIssues and PRs related to the os subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions