[TriLUG] Dual core question

Charles Fischer fischer at 4pi.com
Fri May 20 15:21:17 EDT 2005


Thanks for trying.  I only have a single processor machine to test the code 
on, so I could have a problem.  I am going by the man page for 
sched_getaffinity, which I could have wrong.  It could be that Linux is 
smart enough to know that it only needs one processor for the program and 
sets the affinity to just one processor.  If that is the case the program 
could return 0, if it starts on a processor other then processor 0.

Again thanks for trying,
Charles Fischer

At 03:04 PM 5/20/2005, you wrote:
>Hiho,
>   On a properly-kerneled multiprocessor machine, top will list each CPU's 
> load individually (if you press "1"), allowing one to see how many CPUs 
> are installed.  Or do you mean a way for a program to know, for its own use?
>
>I'm not sure your program works as intended..  I run a Dual Xeon HT box, 
>which appears as four CPUs to my custom-built 2.6.10 SMP kernel and shows 
>as four CPUs to top, but the program you have here says "CPU count: 1".
>
>HTH,
>~Brian
>
>
>Charles Fischer wrote:
>>I would like to get a CPU core count from a Linux box.  Does anybody have 
>>a dual core box running a 2.6 kernel?  If so would you run the following 
>>short program and let me know what it output?  I would also like to know 
>>which version of Linux you are running and how many CPU sockets are 
>>filled and the CPU model numbers.  The program compiles with the 
>>following command line:
>>   cc cpu_core_check.c
>>and runs with the following:
>>   ./a.out
>>I am assuming that you copy the program from this e-mail and call it 
>>cpu_core_check.c.
>>If somebody knows a better way to get a CPU and core count please let me 
>>know.
>>Thanks
>>Charles Fischer
><snip>
>--
>TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
>TriLUG Organizational FAQ  : http://trilug.org/faq/
>TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc




More information about the TriLUG mailing list