System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.ComponentModel.Component System.ComponentModel.Designer("System.Diagnostics.Design.ProcessThreadDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

Starting with the .NET Framework version 2.0, the ability to reference performance counter data on other computers has been eliminated for many of the .NET Framework methods and properties. This change was made to improve performance and to enable non-administrators to use the class. As a result, some applications that did not get exceptions in earlier versions of the .NET Framework may now get a . The methods and properties affected are too numerous to list here, but the exception information has been added to the affected member topics.

Use 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.

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 objects associated with the current process, get the property of the instance.

Represents an operating system process thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The base priority of this thread.")
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  The is the starting priority for the process thread. You can view information about the base priority through the System Monitor's Priority Base counter.

  The operating system computes a thread's base priority by combining the thread's priority level range with the process's priority class. You can set the process's property to one of the values in the enumeration, which are , , , , , or . You can set the thread's property to a range of values that bounds the thread's base priority. Win32 uses four priority classes with seven base priority levels per class.

  The thread's current priority might deviate from the base priority. For example, the operating system can change the property based on the time elapsed or other boosts when a process must be put ahead of others for access to the processor. In addition, you can set the property to cause the system to temporarily boost the priority of a thread whenever the process is taken out of the wait state. The priority is reset when the process returns to the wait state.

  Gets the base priority of the thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The current priority of this thread.")
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  The thread's current priority might deviate from the base priority. For example, the operating system can change the property based on the time elapsed, or other boosts, when a process must be put ahead of others for access to the processor. In addition, you can set the property to cause the system to temporarily boost the priority of a thread whenever the process is taken out of the wait state. The priority is reset when the process returns to the wait state.

  Gets the current priority of the thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The ID of this thread.")
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  The operating system reuses thread identification numbers, which identify threads only during their lifetimes.

  Gets the unique identifier of the thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  The value is zero-based. In other words, to set the thread affinity for the first processor, set the property to zero.

  The system schedules threads on their preferred processors whenever possible.

  A process thread can migrate from processor to processor, with each migration reloading the processor cache. Specifying a processor for a thread can improve performance under heavy system loads by reducing the number of times the processor cache is reloaded.

  Sets the preferred processor for this thread to run on.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("Thread gets a priority boot when interactively used by a user.")
  System.MonoTODO
  System.Boolean To be added: an object of type 'bool'

  When is true, the system temporarily boosts the thread's priority whenever its associated process is taken out of the wait state. This action prevents other processes from interrupting the processing of the current thread. The setting affects all existing threads as well as any threads subsequently created by the process. To restore normal behavior, set the property to false.

  has an effect only when the thread is running in a process that has a set to one of the dynamic priority enumeration values (, , or ).

  Boosting the priority too high can drain resources from essential operating system and network functions. This could cause problems with other operating system tasks.

  Gets or sets a value indicating whether the operating system should temporarily boost the priority of the associated thread whenever the main window of the thread's process receives the focus.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The priority level of this thread.")
  System.MonoTODO
  System.Diagnostics.ThreadPriorityLevel To be added: an object of type 'ThreadPriorityLevel'

  The priority level is not a single value, but rather a range of values. The operating system computes the thread's base priority by using the process's to choose a value from the range specified in the property.

  Gets or sets the priority level of the thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The amount of CPU time used in privileged mode.")
  System.MonoTODO
  System.TimeSpan To be added: an object of type 'TimeSpan'

  Windows uses several different protection mechanisms, and at the root of them all is the distinction between user mode and privileged mode. corresponds to the amount of time that the application has spent running in privileged mode, inside the operating system core. The property indicates the amount of time that the application has spent running code in user mode, outside the system core.

  User mode restricts the application in two important ways. First, the application cannot directly access the peripherals, but instead must call the operating system core to get or set peripheral data. The operating system can thus ensure that one application does not destroy peripheral data that is needed by another. Second, the application cannot read or change data that the operating system itself maintains. This restriction prevents applications from either inadvertently or intentionally corrupting the core. If the application needs the operating system to perform an operation, it calls one of the system's routines. Many of these transition into privileged mode, perform the operation, and smoothly return to user mode.

  Gets the amount of time that the thread has spent running code inside the operating system core.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.MonoTODO
  System.IntPtr To be added: an object of type 'IntPtr'

  The processor affinity of a thread is the set of processors it has a relationship to. In other words, those it can be scheduled to run on.

  represents each processor as a bit. Bit 0 represents processor one, bit 1 represents processor two, and so on. The following table shows a subset of the possible for a four-processor system.

  Property value (in hexadecimal)

  Valid processors

  0x0001

  1

  0x0002

  2

  0x0003

  1 or 2

  0x0004

  3

  0x0005

  1 or 3

  0x0007

  1, 2, or 3

  0x000F

  1, 2, 3, or 4

  You can also specify the single, preferred processor for a thread by setting the property. A process thread can migrate from processor to processor, with each migration reloading the processor cache. Specifying a processor for a thread can improve performance under heavy system loads by reducing the number of times the processor cache is reloaded.

  Sets the processors on which the associated thread can run.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void To be added

  Resets the ideal processor for this thread to indicate that there is no single ideal processor. In other words, so that any processor is ideal.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The start address in memory of this thread.")
  System.MonoTODO
  System.IntPtr To be added: an object of type 'IntPtr'

  Each process starts with a single thread, which is known as the primary thread. Any thread can create additional threads.

  A process has a virtual address space, executable code, data, object handles, environment variables, a base priority, and minimum and maximum working set sizes. All the threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, and a set of structures in which the system saves the thread context while the thread is waiting to be scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process.

  Every Windows thread actually begins execution in a system-supplied function, not the application-supplied function. The starting address for the primary thread is, therefore, the same (as it represents the address of the system-supplied function) for every Windows process in the system. However, the property allows you to get the starting function address that is specific to your application.

  Gets the memory address of the function that the operating system called that started this thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The time this thread was started.")
  System.MonoTODO
  System.DateTime To be added: an object of type 'DateTime' To be added

  Gets the time that the operating system started the thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The current state of this thread.")
  System.MonoTODO
  System.Diagnostics.ThreadState To be added: an object of type 'ThreadState'

  The property value is valid only when the value is . Therefore, check the value before you get the property.

  Gets the current state of this thread.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The total amount of CPU time used.")
  System.MonoTODO
  System.TimeSpan To be added: an object of type 'TimeSpan'

  The property indicates the total amount of time that the system has taken the thread out of the wait state and given it priority on any processor. On a multiple processor system, this value would include time spent on each processor, if the thread used more than one processor.

  The property is the sum of the and properties.

  Gets the total amount of time that this thread has spent using the processor.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The amount of CPU time used in user mode.")
  System.MonoTODO
  System.TimeSpan To be added: an object of type 'TimeSpan'

  Windows NT uses several different protection mechanisms, and at the root of them all is the distinction between user mode and privileged mode. corresponds to the amount of time that the application has spent running in user mode, outside the operating system core. The corresponds to the amount of time that the application has spent running code in privileged mode, inside the system core.

  User mode restricts the application in two important ways. First, the application cannot directly access the peripherals, but instead must call the operating system core to get or set peripheral data. The operating system can thus ensure that one application does not destroy peripheral data that is needed by another. Second, the application cannot read or change data that the operating system itself maintains. This restriction prevents applications from either inadvertently or intentionally corrupting the core. If the application needs the operating system to perform an operation, it calls one of the system's routines. Many of these transition into privileged mode, perform the operation, and smoothly return to user mode.

  Gets the amount of time that the associated thread has spent running code inside the application.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.MonitoringDescription("The reason why this thread is waiting.")
  System.MonoTODO
  System.Diagnostics.ThreadWaitReason To be added: an object of type 'ThreadWaitReason'

  The property is valid only when the is . Therefore, check the value before you get the property.

  Gets the reason that the thread is waiting.