Export (0) Print
Expand All

ProcessThread Class

Represents an operating system process thread.

For a list of all members of this type, see ProcessThread Members.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Diagnostics.ProcessThread

[Visual Basic]
Public Class ProcessThread
   Inherits Component
[C#]
public class ProcessThread : Component
[C++]
public __gc class ProcessThread : public Component
[JScript]
public class ProcessThread extends Component

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

Use ProcessThread to obtain information about a thread that is currently running on the system. Doing so allows you, for example, to monitor the thread's performance characteristics.

A thread is a path of execution through a program. It is the smallest unit of execution that Win32 schedules. It consists of a stack, the state of the CPU registers, and an entry in the execution list of the system scheduler.

A process consists of one or more threads and the code, data, and other resources of a program in memory. Typical program resources are open files, semaphores, and dynamically allocated memory. Each resource of a process is shared by all that process's threads.

A program executes when the system scheduler gives execution control to one of the program's threads. The scheduler determines which threads should run and when. A lower-priority thread might be forced to wait while higher-priority threads complete their tasks. On multiprocessor computers, the scheduler can move individual threads to different processors, thus balancing the CPU load.

Each process starts with a single thread, which is known as the primary thread. Any thread can create additional threads. All the threads within a process share the address space of that process.

Note   The primary thread is not necessarily located at the first index in the collection.

The threads of a process execute individually and are unaware of each other unless you make them visible to each other. Threads that share common resources, however, must coordinate their work by using semaphores or another method of interprocess communication.

To get a collection of all the ProcessThread objects associated with the current process, get the Threads property of the Process instance.

Requirements

Namespace: System.Diagnostics

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

ProcessThread Members | System.Diagnostics Namespace | Process | Threads

Show:
© 2014 Microsoft