Solved

VB limit itself to X CPU usage and ram usage

Posted on 2010-09-09
2
436 Views
Last Modified: 2012-05-10
Hello,

i would like to know how to have a VB.net software to limit itself to X CPU usage and ram usage. How can this be done?

Thanks
0
Comment
Question by:gb874554
2 Comments
 
LVL 13

Accepted Solution

by:
Corey2 earned 500 total points
ID: 33642789
It really depends on the nature of the process.  I don't know of a way to tell an application to utilize no more than 30% CPU, but depending on what you are trying to accomplish by setting these limits you could use one of the following

Set low priority on the process so that other applications calls get run first

Process.GetCurrentProcess.PriorityClass = ProcessPriorityClass.BelowNormal
'default is normal

You can also strategically pause the process to lower cpu usage on long processes
System.Threading.Thread.CurrentThread.Sleep(50)'50 millisecond process sleep
0
 

Author Closing Comment

by:gb874554
ID: 33670806
Answerd most of what i neeed.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now