Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

cpu intesive jave program

Thread view: 
puzzlecracker - 11 Feb 2006 17:29 GMT
Is there a java library or "anything" I can use to increment CPU (used
percent) in a controlled matter? For example, I want to write a program
that can increase cpu by 25%. It is probably platform specific.

Any suggestions would be appreciated.

Thanks.
Alun Harford - 11 Feb 2006 19:22 GMT
> Is there a java library or "anything" I can use to increment CPU (used
> percent) in a controlled matter? For example, I want to write a program
> that can increase cpu by 25%. It is probably platform specific.
>
> Any suggestions would be appreciated.

You need to be running in kernel mode on most systems. While, in theory,
there's nothing to stop you putting a JVM in your kernel, it's never been
done (it would be *horrible*, but it would be worth doing for comedy value).

Basically, you need some way of hooking into the scheduler, or know exactly
what the other processes on the system are doing.

Alun Harford
puzzlecracker - 11 Feb 2006 20:27 GMT
> Basically, you need some way of hooking into the scheduler, or know exactly
> what the other processes on the system are doing.

do i really need know what other processes are doing? Let's say I am
not concerned with current percentage, but only with a value I want it
to boost to.

ex. currently cpu%=50
I want to to raise it by 20%,  and that is fine if some other processes
raise it by some value n during interupts....

All I care is to know that my call can raise it  if there is a room.
That is all.
Jon Martin Solaas - 12 Feb 2006 09:58 GMT
>> Basically, you need some way of hooking into the scheduler, or know exactly
>> what the other processes on the system are doing.
[quoted text clipped - 9 lines]
> All I care is to know that my call can raise it  if there is a room.
> That is all.

What exactly are you after? Boosting the jvm process scheduler priority?
 You can use System.execute to run the renice command, but this won't
set a fixed cpu utilization, if the process is given low priority it'll
still consume 100% cpu if there aren't other processes in need of
cpu-cycles. Likewise, your process may be slowed down if it's
io-intensive, and won't be able to consume all cpu-cycles available.

Maybe you should look into a platform with realtime features, like
RT-Linux. And if you describe exactly what you need to do I'm sure
someone will be able to come up with much better answers than this :-)

Signature

jon martin solaas

Alun Harford - 13 Feb 2006 01:25 GMT
> > Basically, you need some way of hooking into the scheduler, or know exactly
> > what the other processes on the system are doing.
>
> do i really need know what other processes are doing? Let's say I am
> not concerned with current percentage, but only with a value I want it
> to boost to.

That's not the problem. The problem is that the scheduler can choose whether
or not to give you the CPU. The operating system controls the CPU, and can
simply not choose to run your code (too low priority, for example), so the
system won't get the load you want. If you're running in kernel mode you can
prevent yourself from being pre-empted.

Alun Harford
puzzlecracker - 16 Feb 2006 03:45 GMT
> > > Basically, you need some way of hooking into the scheduler, or know
> exactly
[quoted text clipped - 11 lines]
>
> Alun Harford

fine, cpu aside. Let me solve a simpler problem: in increase vm memory
heap in controlled fashion,
THanks


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.