Skip to content

A question about the calculation of the number of cpu #32

Description

@beita1

Hello, I was reading tinypool's source code and had two questions in the src/physicalCpuCount.ts. I don't understand the logic for counting cpu number , could you help me with it?

questions

  • question 1: Why not just use os.cpus().length to get cpu count instead of doing special logic for different plaforms?
  • question 2: Why does the Linux platform get the physical cpu cores by the command cat /proc/cpuinfo | grep "physical id" | sort | wc -l instead of the logical cpu's number by the command cat /proc/cpuinfo| grep "processor"| wc -l?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions