Hot answers tagged

6

Internal niceness levels are 0-39, but increments are positive or negative. Source. So the answer is that the numbers (positive and negative) accepted by the nice command are what get you from 20, the default level, to anywhere in the 0-39 range. So why 0-39? The specific range was what worked in the designers' original implementation. The reason more ...


4

This is a job for process scheduler (also, see this). Generally, when you use any command, one can say(without going into too much detail) that you ask Linux kernel(think OS) to create a separate process that will handle its job. Now the process is put in queue, and then all processes are granted access to PC's resources. This is handled by some scheduling ...


4

nice launches a new command with a modified nice level (lower priority than it would have otherwise had, or higher priority if you have permission). You specify which command to launch by providing it as an argument to nice itself. nice actually execs that command, so nice itself doesn't terminate until the command does. renice changes the priority of an ...


3

A list of non-zero CPU % processes: ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1' To count them ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1' | wc -l To see this continuously updated, but them in a file called ...


2

@zuazo's answer is very informative for pulseaudio specifically. For completeness, I'll note that in the general case, there are four circumstances that can cause a process not owned by root to have a high priority: The program being run is setuid-root, and gave itself the high priority and then changed its uid. The process has the SELinux capability ...


2

PulseAudio requires higher priority than other desktop programs mainly to avoid latency problems and get a skip-free audio playback. But the process that allows PulseAudio to have a higher priority is rather complex. To get this special priority, it uses the RealtimeKit (rtkit-daemon) process. This D-Bus service allows some user programs to use real-time ...


2

Add the user to sudoers (actually, a new file in /etc/sudoers.d, but its the same premise): niceuser ALL=NOPASSWD:/usr/bin/nice Then, as the "niceuser": niceuser@localhost $ sudo nice -n -10 command... and it does what I need (that is, my user can now increase the priority of {command ...}). It supports multiple users, etc. - use man 5 sudoers for ...


1

Well if you want to have the control of priority using a standard user you will need to reduce the priority of the less important scripts, so the most important will run faster. For example: mylowpriorityscript: #!/bin/bash renice 20 $$ #lot of nice things mymediumpriorityscript #!/bin/bash renice 10 $$ #lot of nice things myhighpriorityscript #!/...


1

ps -o ni $(pidof processname) For example: ps -o ni $(pidof mysqld) # ps -o ni $(pidof mysqld) NI 15



Only top voted, non community-wiki answers of a minimum length are eligible