By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,532 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,532 IT Pros & Developers. It's quick & easy.

Better utilization of duo-core?

P: n/a
Hi list,

I have a Python ap that starts another non-Pythoon ap for number
crunching. My new notebook comes with a duo-core CPU. I tried
manually running 2 copies of my ap at the same time) and it appears to
run the whole job faster (or at least the CPU loading level as show by
the task manager appears so). So, I want my Python code to do this
automatically.

How do I detect whether I have additional CPUs in the system? The
google search turns up answer about a Sun workstation but not Windows
XP.

Thanks,

Jul 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
John Henry wrote:
How do I detect whether I have additional CPUs in the system? The
google search turns up answer about a Sun workstation but not Windows
XP.
count = int(os.environ.get("NUMBER_OF_PROCESSORS", 1))

</F>

Jul 13 '06 #2

P: n/a
Fredrik Lundh wrote:
>How do I detect whether I have additional CPUs in the system? The
google search turns up answer about a Sun workstation but not Windows
XP.

count = int(os.environ.get("NUMBER_OF_PROCESSORS", 1))
footnote: a more "correct" way to do this is to use WMI. links:

http://timgolden.me.uk/python/wmi.html
http://msdn.microsoft.com/library/en...r_hardware.asp
(look for "determine if a computer has more than one processor"

</F>

Jul 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.