Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run mplayer with higher priority than any other processes, including the IO-processes. How can I do that?

share|improve this question
There is no cross-unix variant answer to this question. In general it's better to describe what OS you're using (including the distribution for Linux, but here it won't matter much if at all). I've added a linux tag, please change it if that's not what you're using. – Gilles Feb 17 '11 at 18:05
Do you mind if I ask why you're looking to increase the priority of mplayer? I ask because I've had issues before where increasing the priority of mplayer, the effect was opposite what I was trying to accomplish because mplayer would get busy using up CPU time doing post-production cleaning, then grind to a halt as the network finally got a gasp of air to go grab more content, then mplayer would stutter back to life, just to grind to a halt again waiting for network. – killermist Jun 10 '12 at 14:53
I asked this cause, I am playing a movie through mplayer. Whenever I try to download few GB files over network. Mplayer observes slicing and a jerk while playing. – SHW Jun 11 '12 at 7:16

To set niceness (CPU bound) use nice. To set IO niceness (IO bound) use ionice. Refer to the respective man pages for more information. You can use them together as follow:

ionice -c 2 -n 0 nice -n -20 mplayer

Note: the lowest level of niceness (lower means more favorable) you can define is determined by limits.conf. On my computer the file is located at /etc/security/limits.conf.

share|improve this answer
Mentioning the io scheduler classes is good, because that's likely to be a big factor. Worth nothing that for the middle -c2 scheduling class, processes are by default sorted by the nice level, so the example command you've given is really not necessary. One could try putting mplayer in the -c1 realtime class. (With root access.) – mattdm Feb 17 '11 at 16:24

In general, as a non-root user, you can only decrease the priority of your tasks, not increase them. So, one approach would be to lower the priority of everything else. Or, you can set up something at the system level which handles your priorities.

If you're using a relatively modern Linux distribution, the most powerful way would be with control groups. This is in its infancy so basically you'd have to configure everything by hand, but in short what you want is to configure the categorizer to put different processes into different CPU control groups, and then to give the mplayer process more CPU shares.

share|improve this answer

Your Answer


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.