How to diagnose abnormal CPU usage by svchost.exe? [duplicate]
Solution 1:
As an instance of svchost.exe hosts multiple system services, here is how to separate the services, each to his own instance of svchost.exe, so as to find out which service consumes the CPU.
The procedure is as follows :
Use Task Manager to show all processes sorted by CPU descending and mark the PID of the processes that consume the CPU
In a Command Prompt (cmd) enter the command
Tasklist /svc /fi "IMAGENAME eq svchost.exe"
The problematic instances of svchost.exe can now be located by their PID and on the right you will find a list of the system services that they host
For each of the names in the list enter the following command in a Command Prompt (cmd) that is Run as administrator:
sc config <name> type= own
(Note the space between the ‘=’ and ‘own’)Reboot
The system services that you separated will now each run in its own instance of svchost.exe and can be seen in Task Manager in the Processes tab. You may right-click on an instance and select "Go to Service(s)" to go directly to the service, or use again the tasklist command.
For more information see the Microsoft article
Getting Started with SVCHOST.EXE Troubleshooting.
Solution 2:
Process Explorer makes this easy. I have confirmed this works with Process Explorer v16.20 on 64-bit Windows 7 Professional and 64-bit Windows 10 Pro.
- Run Process Explorer elevated.
- Locate an
svchost.exe
process with a high (or even just measureable/non-blank) value in theCPU
column. Sorting by theProcess
orCPU
column may assist with this. - Right-click the
svchost.exe
process and selectProperties...
. - In the process properties window, select the
Threads
tab. All of the threads in this process will be displayed. - Locate a thread with a high (or, again, just measurable/non-blank) value in the
CPU
column. Sorting by theCPU
column may assist with this. - The
Service
column will show the name of the service in which that thread is running.
If the service name is not familiar to you...
- In the process properties window, select the
Services
tab. All of the services that run in this process will be displayed. - Match the
Service
column on theServices
tab to the value of theService
column on theThreads
tab you located in step 6. - The
Display Name
column will display the friendly name of the service. The description of the selected service will appear below the list of services.
Solution 3:
You can use Task Manager. There are other ways (command line, or even write some program using WinAPI), but I won't discuss them here. Before going any further, your user should have administrative privileges.
On the Processes tab:
- Check Show processes from all users.
- Right click on the processes "table header" (that contains column names like Image name, PID, User Name, CPU, ...), and select Select Columns....
- On the dialog that pops-up, scroll down and make sure you check Command line, and PID (Process Identifier) then press OK.
Back to the Processes tab, click on CPU column header so that the processes will be ordered by their CPU consumption (note that the processes might be displayed in ascending/descending order - each click on CPU switches the orders), click until the 2 processes appear at the top of the table. Now you''re able to see their command line (I don't know but I have a feeling that one of them is
netsvcs
(Network Services)) and also their PIDs.-
Next, you need to match the 2 processes to the services. For that you can either:
- Right click on them and then Go to service(s).... This will move to the Services tab, having all the service running in that process selected (for this option you don't need any of the previous steps :) ).
- Open the Services snapin in mmc. When double clikc-ing on a service (only makes sense to check the ones that are running), Under Path to executable you can see their command line that you should do the match on.
- On W10 you can view the exact info you need from Resource Monitor (you can start it from Task Manager, Performance tab). There you go to CPU tab and the services and their CPU consumption are listed.
EDIT0: Updated answer to provide a simpler (and making way more sense) approach, instead of scratching my right head side using my left hand style one, that I initially posted.