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?
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
os.cpus().lengthto get cpu count instead of doing special logic for different plaforms?cat /proc/cpuinfo | grep "physical id" | sort | wc -linstead of the logical cpu's number by the commandcat /proc/cpuinfo| grep "processor"| wc -l?