Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Windows does not provide a mechanism to limit the CPU or memory usage of a thread.

However, you can achieve a similar effect by adjusting the priority of your thread. Threads with a higher priority are given a relatively greater share of the computer's resources, while those with a lower priority are down-scheduled when necessary to make room for threads with a higher priority.

In the world of .NET, this is conveniently exposed through the Thread.Priority property, which accepts one of the ThreadPriority values.

Do note that both threads and processes have priority levels, and the base priority level of your thread will be determined both from the value you set for the Thread.Priority property and its process's priority.

Related question: How can I programmatically limit my program's CPU usage to below 70%?How can I programmatically limit my program's CPU usage to below 70%?

Windows does not provide a mechanism to limit the CPU or memory usage of a thread.

However, you can achieve a similar effect by adjusting the priority of your thread. Threads with a higher priority are given a relatively greater share of the computer's resources, while those with a lower priority are down-scheduled when necessary to make room for threads with a higher priority.

In the world of .NET, this is conveniently exposed through the Thread.Priority property, which accepts one of the ThreadPriority values.

Do note that both threads and processes have priority levels, and the base priority level of your thread will be determined both from the value you set for the Thread.Priority property and its process's priority.

Related question: How can I programmatically limit my program's CPU usage to below 70%?

Windows does not provide a mechanism to limit the CPU or memory usage of a thread.

However, you can achieve a similar effect by adjusting the priority of your thread. Threads with a higher priority are given a relatively greater share of the computer's resources, while those with a lower priority are down-scheduled when necessary to make room for threads with a higher priority.

In the world of .NET, this is conveniently exposed through the Thread.Priority property, which accepts one of the ThreadPriority values.

Do note that both threads and processes have priority levels, and the base priority level of your thread will be determined both from the value you set for the Thread.Priority property and its process's priority.

Related question: How can I programmatically limit my program's CPU usage to below 70%?

Source Link
Cody Gray
  • 246.1k
  • 53
  • 512
  • 591

Windows does not provide a mechanism to limit the CPU or memory usage of a thread.

However, you can achieve a similar effect by adjusting the priority of your thread. Threads with a higher priority are given a relatively greater share of the computer's resources, while those with a lower priority are down-scheduled when necessary to make room for threads with a higher priority.

In the world of .NET, this is conveniently exposed through the Thread.Priority property, which accepts one of the ThreadPriority values.

Do note that both threads and processes have priority levels, and the base priority level of your thread will be determined both from the value you set for the Thread.Priority property and its process's priority.

Related question: How can I programmatically limit my program's CPU usage to below 70%?