Roee Gavirel
Roee Gavirel

Reputation: 19463

Can "num_online_cpus()" return different values in the same run?

The name is suggesting it. If there are online cpus, are there offline cpus? can a offline cpu become online and vice versa?

Thanks in advance. R.g.

Upvotes: 1

Views: 1979

Answers (2)

user149341
user149341

Reputation:

Yes -- some architectures support "hot-pluggable CPUs":

http://www.kernel.org/doc/Documentation/cpu-hotplug.txt

Hardware that actually supports this is rare as hen's teeth, though.

Upvotes: 7

Dan D.
Dan D.

Reputation: 74675

it seems that online in this context means "available for scheduling" and based on what i read in include/linux/cpumask.h where num_online_cpus() is defined. i'd think it would be possible for it to return different values at different times but in any stable system i don't think it would commonly do so.

Upvotes: 0

Related Questions