Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to assign priority to process

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchees...

For performance gain and better usability, I am running some heavy tasks in the background. I want to assign low priority to this new process as otherwise its eating the CPU and the computer remains unusable till the time process finishes off.

If I reduce the priority of this new process using windows task manager, it works just fine. Can anyone please suggest similar (pr different) way to tackle this issue?

Thanks in advance,
mrP
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless there's something new in Java 1.5/5.0/whatever (I still use 1.4), there is no way to set the priority of an external process via pure Java. You can do it via native code and JNI, on a platform-specific basis, of course.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to thread your tasks and them use the method setPriority(int newPriority) from java.lang.Thread?
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to to prioratize the windows processes nor java threads right?
Try playing with task.exe of windows.
 
    Bookmark Topic Watch Topic
  • New Topic