######################### # ionice and nice notes # ######################### # nice -n19 is nicest on CPU priority # ionice -c2 -n7 is nicest on IO priority also so is ionice -c3. ionice -c3 is probably nicer. nice -n19 PROGRAMNAME # starts a program nice (on cpu) ionice -c2 -n7 PROGRAMNAME # starts a program nice (on io) ionice -c3 PROGRAMNAME # starts a program nice (on io) # *** BOTH **** How to ionice and nice at same time ionice -c2 -n7 nice -n19 PROGRAMNAME # starts a program running really nice & ionice (cpu and io) ionice -c3 nice -n19 PROGRAMNAME # starts a program running really nice & ionice (cpu and io) renice -n19 PID # If a program is already running use this method to make it nice, you can make it nice with "renice". First find the PID of the program. # syntax of renice might differ. space after -n and require -p for PID. "renice -n PRIO -p PID" renice -n 19 -p PID ionice -c2 -n7 -p PID # you can re-ionice/reionice using ionice, the same program deals with already running programs and new programs about to run ionice -c3 -p PID # you can re-ionice/reionice using ionice, the same program deals with already running programs and new programs about to run # cant renice and re-ionice at same time, just string them in once command with ";", like this: "renice -n19 PID; ionice -c3 PID" ### To run a couple programs nice ### nice -n19 /bin/bash -c "program1; program2;" ionice -c2 -n7 /bin/bash -c "program1; program2;" ionice -c2 -n7 nice -n19 /bin/bash -c "program1; program2;" ionice -c3 nice -n19 /bin/bash -c "program1; program2;" # note can replace bash with /bin/bash with /bin/sh if thats your shell (usually /bin/sh will point to the correct shell of choice). Find out your shell with "echo $SHELL" # Or if you want them to run at the same time. Change the ; to &, but make sure to have spaces nice -n19 /bin/bash -c "program1 & program2 &" ionice -c2 -n7 /bin/bash -c "program1 & program2 &" ionice -c2 -n7 nice -n19 /bin/bash -c "program1 & program2 &" ionice -c3 nice -n19 /bin/bash -c "program1 & program2 &" ### QUICK NOTES ON nice ### # nice -n0 is default, nice -n19 is lowest cpu priority (-20 is highest priority on cpu, 0 is default, 19 is loweest) * nice of "nice -n19" is the nicest a program can run, therefore it will have lower priority on the CPU and free up CPU time. ### QUICK NOTES ON ionice ### # http://www.linux-commands-examples.com/ionice # ionice -c1 realtime : highest priority # ionice -c2 best effort : average priority and can set a sub priority with -n0 to -n7 (0 is highest priority for -c2, and 7 is lowest priority for -c2) # ionice -c3 idle L this is lowest priority (even lower then -c2 -n7, and it only gets access when the disk is idle and no other program is accessing the disk) # ionice -c1 (highest priority) also ionice -c2 -n0 is high priority (but -c1 is higher) # note with -c1 & -c3 you cant set subpriority but with -c2 you can # ionice -c2 -n7 (lowest priority) # with -c2 you can set sub priority 0 highest, 7 lowest (the numbers are switched dont get confused) # c2 is best effort and now we can set priority 0 to 7 where 0 is highest and 7 is lowest priority to the disk # ionice -c3 (will only let program run when nothing is accessing disk for long time, so it will only let it run when its idleing) * ionice of "ionice -c2 -n7" and "ionice -c3" are the nicest on IO a program can run. Meaning it will have lower priority, giving more to other processes.