This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Performance and the fly likes reduce cpu usage in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Performance
Reply locked New topic
Author

reduce cpu usage in thread

Aayush Singhal
Ranch Hand

Joined: Jan 06, 2011
Posts: 47
i am using a thread to update a moving ticker on the screen like the bootom of a news channel.
it's something like this :
while(true)
{
Thread.sleep(10);
x++;
repaint();
}

The trouble is that it is having high CPU usage about 25% due to which my other applications are having trouble.

What should i do to reduce the CPU usage?

Edit : please close it. it is being discussed in the Swings sub-forum. Thanks
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Please do not cross post

http://www.coderanch.com/t/522630/GUI/java/Reduce-CPU-usage-thread


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reduce cpu usage in thread