need java algorithm that runs forever with heavy cpu usage
843789Jun 2 2010 — edited Jun 2 2010Hello @ all,
i am trying to create a program that starts some threads depending how many cpu cores are installed in the computer.
these threads should bring up the cpu usage to 100% on every single core (without ending).
why i am doing this? i want to run this program on notebooks to check how long the battery will work under full cpu usage. i know, there are test suite for that but just want to do that by myself.
the code for everything is done already, but i need an algorithm that is running forever with high cpu usage. i was thinking to calculate pi number in each thread. and i found already some code examples how to implement these algorithm. but as i am a java beginner i can hardly understand it. do you know some other, easier ways how to cause full cpu load? or can you provide me some code examples?
the example for the PI calculation you can find here: [java PI calculation|http://java.sun.com/docs/books/tutorial/rmi/client.html]
i hope, you can understand my poor english.
thanks in advance for your help.
greetings nyyrikki