All the applications that we run on the server use processes and processes are at the center of our interest in understanding how our application runs. Process is a task performed by any give OS. Our application can have multiple processes behind it. Process can also be visualized as 4GB of space with the following memory slots from 0x00000000 to 0xFFFFFFF. 4GB is a standard space allocation in 32 bit machine and memory allocates whatever memory is required by the process. There is also concept of Virtual Memory when 4KB of memory saved to disk.
.NET Framework provides Process class that can access OS level process on local machine or on remote machine. Four methods can be used to determine what processes are currently running on the machine.
GetCurrentProcess – it does not take any parameters
Process MyProcess = Process.GetCurrentProcess();
Console.WriteLine("Process: " + MyProcess);
GetProcessById returns information about individual processes.
Process SpecificProcess = null;
SpecificProcess = Process.GetProcessById(2);
catch (ArgumentException Problem)
GetProcessesByName returns information about multiple modules loaded by the process.
Process SpecificProcesses = null;
SpecificProcesses = Process.GetProcessesByName("explorer", "machinename");
foreach (Process ThisProcess in SpecificProcesses)
GetProcesses method takes machine names and returns all processes being currently executed on the machine. It has several Exceptions. They are: PlatformNotSupportedException, ArgumentNullException, InvalidOperationException, Win32Exception, ArgumentException
Process AllMyProcesses = null;
AllMyProcesses = Process.GetProcesses("mymachinename");
foreach (Process MyCurrent in AllMyProcesses)
catch (ArgumentException MyProblem)