Often we need to debug our SharePoint solution and we are often presented with multiple w3wp processes running and it is really difficult to figure out which process to attach for the debugger.
Following is the command that will list all the processes and which web application pool it is using. Open command prompt as administrator and go to the inetsrv folder under C:\Windows\System32.
appcmd list wp
Find your application pool and then you will have the Process ID.