Each SharePoint web application is run under a dedicated worker processes. Specially when it comes to DEV environments, when debugging a solution it's best to attach the code only to the target worker process. This avoids the hassle among the DEV team :) . It's pretty simple to find the worker process related to the target web application. Follow these simple steps.
1) Start Command prompt with Administrator privileges
2) Navigate to C:\Windows\System32\inetsrv directory
3) Type in appcmd list wp
You get the list of worker processes along with the web application which is running on it. Now in the Visual Studio IDE go to debugger and attach your code by selecting the appropriate worker process. Under the set of w3wp exe's you can pinpoint the exact one.
1) Start Command prompt with Administrator privileges
2) Navigate to C:\Windows\System32\inetsrv directory
3) Type in appcmd list wp
You get the list of worker processes along with the web application which is running on it. Now in the Visual Studio IDE go to debugger and attach your code by selecting the appropriate worker process. Under the set of w3wp exe's you can pinpoint the exact one.