CPU utilization
2 posts in topic
Flat View  Flat View

Posted By:   a_p
Posted On:   Sunday, February 6, 2005 10:00 PM

How do I minimise or control CPU utilization of a particular Thread?

Re: CPU utilization

Posted By:   Sanjay_Chittar  
Posted On:   Monday, February 14, 2005 02:46 AM

I can think of 2 ways.

1. By setting priority for the thread we can leave the CPU

utilization to the underlying mechanism.

2. If you are sure that some threads do not need to work at

certain stages. You can make it wait for a shared object.

Hope it answers.

Re: CPU utilization

Posted By:   Anonymous  
Posted On:   Monday, February 7, 2005 12:26 AM

Thread has a method called: setPriority()

You can set it to anywhere in the range from MIN_PRIORITY to MAX_PRIORTY (static fields in the Thread class)

To set it from another thread, you can do the following:

Thrad t = new Thread(this);

t.setPriority(Thread.MIN_PRIORTY); // only eat idle time


Or from your own thread:

// make it as real-time as possible


About | Sitemap | Contact