473,414 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Number of CPU's?

179 100+
I'm wondering if anyone knows of any ways to obtain the number of physical CPU's/Cores a machine has? And preferably in a platform independent way, though suggestions for both Linux/Unix and Windows approaches separately would be great if need be, as I can separate them use preprocessor if blocks.

The reason why I need them is because I'm using some in-house software which is designed to carry out some processing and is designed for multi-threaded use. I'm trying to run a couple of threads which works fine on a dual core machine, but dies a horrible death on a single core machine.

Unfortunately it is not feasible to identify the problem and resolve it within the software at present due to time constraints, and therefore I'd like to have a single and multi threaded version, whereby if I've got more than 1 core/cpu we can fire off 2 or more threads to speed up the process.

If anyone's got any suggestions that'd be great.

Thanks.

Ian
May 8 '08 #1
1 2063
mac11
256 100+
In Linux, the easy way is to go look at /proc/cpuinfo . I have no idea about windows land. I doubt there will be a platform independent way of getting this data reliably.
May 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

79
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
5
by: PaulThomas | last post by:
Using VS.Net 2000 and C# How can I get the CPU Serial Number and the Operating Syatem Serial Number Thanks in advance, Paul
7
by: Jean-David Beyer | last post by:
I have six hard drives (4 SCSI and 2 EIDE) on my main machine with parts of a database on each drive. The main index is on one SCSI drive all to itself. The main data are on the other three SCSI...
5
by: Urs Vogel | last post by:
Hi When measuring the thread pool with ThreadPool.GetMaxThreads(..), it returns 25 threads per CPU. On a hyper threaded machine, though, it returns 50 threads, still only having one CPU. How do...
2
by: Russell Smith | last post by:
Postgresql 7.4.5 The following VACUUMs were run within a couple of minutes of each other completing. This table concerned is a table that has not been changed in a long time. (a month) There...
4
by: Klaas Vantournhout | last post by:
Hi, I am currently using OpenMP (gcc 4.2.0) to do parallel computing on a computer with a certain amount of cpu's. I need the total number of cpu's as a variable in my code. So I was...
3
by: Bayazee | last post by:
Hi, How can I get CPU Serial number , or motherboard serial number with python . I need an idetification of a computer .... ThanX --------------------------------------------------- iranian...
2
by: Lit | last post by:
Hi, How can I get the CPU serial number via C# How can I get a screen shot via C# Thank you, Lit
11
by: John | last post by:
Is there a way to find the number of processors on a machine (on linux/ windows/macos/cygwin) using python code (using the same code/cross platform code)?
1
by: =?Utf-8?B?UGF1bCBIYXRjaGVy?= | last post by:
I have a small program which has a large (~50K) number of objects which need to do work. I create a BackgroundWorker object and fire it off whenever each of the instances needs to do work; this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.