<div dir="ltr">Recently os.cpu_count() on Windows has been fixed in order to take process groups into account and return the number of all available CPUs: <div><a href="http://bugs.python.org/issue30581">http://bugs.python.org/issue30581</a><br clear="all"><div>This made me realize that os.cpu_count() does not return the number of *usable* CPUs, which could possibly represent a better default value for things like multiprocessing and process pools. </div><div>It is currently possible to retrieve this info on UNIX with len(os.sched_getaffinity(0)) which takes CPU affinity and (I think) Linux cgroups into account, but it's not possible to do the same on Windows which provides this value via  GetActiveProcessorCount() API.</div><div>As such I am planning to implement this in psutil but would like to know how python-ideas feels about adding a new os.usable_cpu_count() function (or having os.cpu_count(usable=True)).</div><div><br></div><div>Thoughts?</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Giampaolo - <a href="http://grodola.blogspot.com" target="_blank">http://grodola.blogspot.com</a></div><div><br></div></div></div>
</div></div>