Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Throttle CPU Usage of Application

A new game server just came out which our company would like to offer for rental. However, the game developers did not create any sort of hibernation mode to shut down the physics when no players are connected, so an empty server is eating 30% or so CPU.

I found this game panel addon which limits the CPU usage of Applications.

I have written a few small apps in C# .NET for our company to help improve our services and I am wondering how I would go about creating something like this. Is it possible?

like image 811
Michael Pfiffer Avatar asked Feb 07 '11 17:02

Michael Pfiffer


1 Answers

You might consider simply lowering the priority of the process down. This won't limit CPU directly, but will cause the processes threads to be scheduled less often than processes with normal and higher priorities.

Check System.Diagnostics.Process.PriorityClass (doc)

like image 50
Brad Avatar answered Sep 24 '22 13:09

Brad