Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I use some IO intensive application (like Virtualbox, Steam data verification or even dd) my system becomes almost unresponsive. Despite all being started with normal priority, they make the desktop very sluggish and delay a lot the startup of other applications.

I know I can use something like ionice to change the priority to idle for instance, but in the case of Virtualbox which spawns many processes it becomes difficult.

Can I give some type of hints to the system, so when launching some specific applications they are started with the least IO priority?

share|improve this question
    
did you try my solution? Does it do the job? –  sm4rk0 Feb 23 '13 at 12:21
add comment

2 Answers 2

up vote 3 down vote accepted
+50

If I understood correctly, you want some ionice setting to be applied every time you start a command. You can do it this way:

echo 'ionice -c 3 /usr/bin/VirtualBox "$@"' > VirtualBox
chmod a+x VirtualBox
sudo mv VirtualBox /usr/local/bin/

First command creates a file VirtualBox with the single-quoted text as its content. This should have the full path to the program, because if one only specify VirtualBox it can interpret it as the file we just created and create a "loop".

Second command makes it executable, and third moves this new file in a folder which is in front of the "system" bin folder /usr/bin, so our new file gets executed instead of the original. The "$@" part contains all the arguments the command was invoked with, so they get forwarded to the real VirtualBox command.

According to answer ("yes") to this Super User question Do children processes inherit ionice priorities from their parents? How do you check the IO priority of a running process?, it should be enough to ionice the parent process, like this:

ionice -c 3 VirtualBox

From ionice man page, following I/O scheduling class values are available:

  • 0 for none
  • 1 for realtime
  • 2 for best-effort
  • 3 for idle (used in example above)

A number or class name can be used.

Also, -n level option is applicable for realtime and best-effort classes, with 0-7 as valid data (priority levels).

share|improve this answer
1  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Lucio Feb 22 '13 at 0:39
    
@Lucio, thanks for a hint, but isn't "it should be enough to ionice the parent process" essential part? –  sm4rk0 Feb 22 '13 at 0:43
1  
Yes, your right. But, if you can, take a time and then add more information from your own experience about this procedure, creating a better answer :) –  Lucio Feb 22 '13 at 0:45
    
@Lucio, I hope it's good enough now. Thank you for insisting (: –  sm4rk0 Feb 22 '13 at 1:17
    
@sm4rk0 Yes it works, and is pretty clean too (no modification of package/system files). I was looking for something like limits.conf but all alternatives I've found are much more complicated than this. Thanks –  Salem Feb 23 '13 at 21:50
show 1 more comment

You can use the 'renice' command to prioritise processes:

renice -<priority> <application's pid>

It could also be your drive is spinning down too much, so when you want to start application like Virtualbox it has to spin up before you can start working around (this can take a while).

share|improve this answer
    
Thanks for the tip, but i was looking for a way to make that automatically and system wide. For example: when launching Virtualbox, run it with the lowest IO priority possible... –  Salem Feb 16 '13 at 14:37
    
regular nice and renice don't prioritize IO separately. –  Jay _silly_evarlast_ Wren Feb 23 '13 at 21:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.