Apr 2, 2008

really nice

if you are using the cfq io scheduler in linux you can use ionice to nice your io. so to really nice something you would do


nice -n 19 ionice -c 3 programname


this may not be the best idea on all programs but it works. If a program is beating your hd and cpu and you don't want it to run this when starting it.

4 comments:

  1. Won't the above make ionice run with a nice value of 19 and leave programname running with the standard nice value? I can see that it should drop the ionice value of programname but not the nice value as well.

    I thought that the reason many examples of ionice use the -ppid interface is so that you can pick the pid of an already nice program.

    ReplyDelete
    Replies
    1. A user can execute:

      $ ionice -c 3 nice -n 19 dd if=/dev/urandom of=my_file &
      $ ionice -p $(pidof dd)

      and it answers: "idle". Also a user can execute "top" and see something like:

      PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
      30950 USER 39 19 94164 636 516 R 84 0.0 1:07.82 dd

      showing a "niceness" value of "19", which is what he wanted.

      Delete
    2. Of course, the user would also execute at the end:
      $ killall dd
      $ rm my_file

      Delete
  2. afaik, a program will inherit the nice, and ionice values of it's parent process. so even if you are nicing ionice the process you're running ionice on will inherit that niceness level. Also tias.

    ReplyDelete

No trolling, profanity, or flame wars :: My Blog, my rules! No crying or arguing about them.