Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:16:18+00:00 2026-06-06T04:16:18+00:00

I have a system with 4 Physical Processor sockets. Running Windows 2003, I would

  • 0

I have a system with 4 Physical Processor sockets. Running Windows 2003, I would like to programmatically find the number of sockets using C++. Is this possible and if so, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:16:19+00:00Added an answer on June 6, 2026 at 4:16 am

    For Windows 7 and 2008 server there is the GetActiveProcessorGroupCount function. But you have 2003 server, so it’s not an option.

    In C++ this requires to write WMI consumer code, which is a clumsy and boring (D)COM stuff.

    One nice solution would be to run systeminfo command and parse the output, but be careful as the output’s column header is localized to system’s locale.

    EDIT

    Just found a much nicer solution, which makes use of the command-line interface to WMI.

    Run the following command and parse output, there is one line per socket

    > wmic.exe cpu get
    AddressWidth  Architecture  Availability  Caption                               ConfigManagerErrorCode  ConfigManagerUserConfig  CpuStatus  CreationClassName  CurrentClockSpeed  CurrentVoltage  DataWidth  Description                           DeviceID  ErrorCleared  ErrorDescription  ExtClock  Family  InstallDate  L2CacheSize  L2CacheSpeed  L3CacheSize  L3CacheSpeed  LastErrorCode  Level  LoadPercentage  Manufacturer  MaxClockSpeed  Name                                             NumberOfCores  NumberOfLogicalProcessors  OtherFamilyDescription  PNPDeviceID  PowerManagementCapabilities  PowerManagementSupported  ProcessorId       ProcessorType  Revision  Role  SocketDesignation  Status  StatusInfo  Stepping  SystemCreationClassName  SystemName       UniqueId  UpgradeMethod  Version  VoltageCaps  
    64            9             3             Intel64 Family 6 Model 23 Stepping 6                                                   1          Win32_Processor    2532               33              64         Intel64 Family 6 Model 23 Stepping 6  CPU0                                      421       2                                               0            0                            6      1               GenuineIntel  2532           Intel(R) Core(TM)2 Duo CPU     T9400  @ 2.53GHz  2              2                                                                                            FALSE                     BFEBFBFF00010676  3              5894      CPU   CPU Socket #0      OK      3                     Win32_ComputerSystem     CHBROSSO-WIN7VM            1                       2            
    

    Running an exe and parsing output in C++ should the easy part. You can also use POCO library or Boost.Process to have cleaner code.

    (this is untested code)

    //get wmic program output 
    FILE* pipe = _popen("wmic.exe cpu get", "r");
    if (!pipe) throw std::exception("error");
    char buffer[128];
    std::string output;
    while(!feof(pipe)) {
      if(fgets(buffer, 128, pipe) != NULL)
          output += buffer;
    }
    _pclose(pipe);
    
    //split lines to a vector<string>
    std::stringstream oss(output);
    std::vector<std::string> processor_description; std::string buffer;
    while (std::getline(oss, buffer))
      processor_description.push_back(buffer);
    //processor_description has n+1 elements, n being nb of sockets, +1 is the header of columns
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know if it is possible to identify physical processor (core)
What factors determine the maximum amount of physical memory a system can have? I
I have a system (Dell laptop) with an English Windows 7 Pro on it.
I would like to limit the amount of physical memory a process can use
I have a program which simulates a physical system that changes over time. I
I have a set of png images that I would like to process with
We have a fairly robust system using NHibernate, we're in the middle of migrating
Operating System question: Say we have a process running in a paged memory system,
I have a program that requires much memory, like 2/3 of all the physical
i do hope this question fits here, otherwise sorry. I have a physical alarm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.