Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 4923  / 2 Years ago, thu, june 9, 2022, 12:57:56

I noticed that on my system monitor, one of my processes, titled pulseaudio, had a very high priority, while all of my other running apps had a normal priority. I don't recall ever changing it, so it must have been its default priority, right? Are there any other apps like this?


More From » pulseaudio

 Answers
5

Technically, yes. In Linux — Ubuntu's kernel — all programs start with a priority or "niceness" value of 0. They may, while executing, request a higher or lower priority by making the system call nice(int niceness) from unistd.h.



Normally, programs the user runs only have the permission to lower their priority to positive niceness. This is useful for non-critical janitorial tasks your computer performs from time to time.



However, Ubuntu also uses a framework called AppArmor, which grants specific user programs administrative ("root") level rights. Ubuntu's AppArmor is configured to allow certain important programs to request a high priority (negative niceness), most notably PulseAudio. This prevents breaks in playing audio while your system is under heavy load.



In summary, yes all applications start with a normal priority. However, in practice, many applications request a different priority immediately after launching.



And as a little geeky addendum



You can start (or to be technically accurate, fork) your own programs with low/high priority in a commandline like this:



nice -n 10 my_app                 # this application is low priority, very nice
sudo nice -n -10 my_other_app # this application is high priority, very mean


No guarantees they'll keep it, of course. ;)


[#38706] Friday, June 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sipwing

Total Points: 245
Total Questions: 100
Total Answers: 118

Location: Aland Islands
Member since Thu, Oct 22, 2020
4 Years ago
sipwing questions
Sun, May 29, 22, 22:00, 2 Years ago
Fri, Jun 24, 22, 08:46, 2 Years ago
Fri, Dec 23, 22, 00:04, 1 Year ago
;