Tag Info

Hot answers tagged

15

It's for what I'd call policy reasons. The idea is that normal users can't override the actions of privileged users. Let's say you're a user on some enormous shared server. You're running monstrous CPU-hogging processes to the detriment of the other users. The sysadmin renices some of your processes because he doesn't like you very much. The OS doesn't ...


14

Since linux 2.6.12, that depends on the value of the RLIMIT_NICE limit (ulimit -e). Which can take values from 0 to 40. That limit is more the limit on the priority of the process (the greater that number, the higher the priority a user can set for a process). You'll notice the default value is 20 on ubuntu 10.04 and 0 in Debian jessie for instance. A ...


13

Most software build processes use make. Make sure you make make use the -j argument with a number usually about twice the number of CPUs you have, so make -j 8 would be appropriate for your case.


11

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 ...


11

What does a niceness of (-) indicate? Notice those also have a PRI score of -100; this indicates the process is scheduled as a realtime process. Realtime processes do not use nice scores and always have a higher priority than normal ones, but still differ with respect to one another. You can view details per process with the chrt command (e.g. chrt -p ...


10

Reniceing the process group to -20 is a bad idea. This niceness level should be used only by the top-priority system-critical tasks. Otherwise you can loose responsiveness or even freeze the system. And the potential compilation-time benefit would be marginal. Apart from what Caleb already suggested, if you compile a lot, you can also speed up builds using ...


10

Disk and memory scheduling are entirely different. In the absence of an IO priority scheduler, IO will be handled on a first come first served basis. If the system is IO bound, then all processes run in a more or less round robin basis until all are waiting for I/O. The nice priority of a process will have little impact on its scheduling frequency. ...


9

ionice [-p] <pids/> For example: $ ionice -p `pidof X` none: prio 0 This means X is using the none scheduling class (best effort) with priority 0 (highest priority out of 7). Read more with man ionice.


8

I would start it normally and use "renice" afterwards... However I was able to make a quick hack together with "su" which works: sudo nice -n -20 su -c command_to_run user_to_run_as (If you don't have to give sudo a password - perhaps because you've already just given it - you may add an "&" to put the whole thing in the background.) Since you ...


7

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. ...


6

It has to do with boot order. Highest priority is required for booting (/ and in my opinion /usr /var /tmp ...). The /boot filesystem can do with lower priority because by the time the system can start fsck's, it read the necessary files from boot already. Filesystems for home directories etc. are lower priority during boot process.


5

"Real time" means processes that must be finished by their deadlines, or Bad Things (TM) happen. A real-time kernel is one in which the latencies by the kernel are strictly bounded (subject to possiby misbehaving hardware which just doesn't answer on time), and in which most any activity can be interrupted to let higher-priority tasks run. In the case of ...


5

ps is probably the right way to go. You can then grep and awk your way to the relevant row and column


5

renice does affect the priority of a process. But as you've experienced, just because a process has higher priority doesn't imply that it will have all the resources it needs. A higher priority merely gives the process a bigger chance to grab resources. renice only affects CPU time. So it only has an effect if two or more processes are competing for CPU ...


5

To quote Robert Love: The scheduler does not magically know whether a process is interactive. It requires some heuristic that is capable of accurately reflecting whether a task is I/O-bound or processor-bound. The most indicative metric is how long the task sleeps. If a task spends most of its time asleep it is I/O-bound. If a task spends more ...


4

@Goldlilock's answer directed me to do the research in the right path. This is my research details. Scheduling Algorithms available for processes Linux supports 3 scheduling policies. SCHED_FIFO, SCHED_RR, and SCHED_OTHER. SCHED_OTHER is the default universal time-sharing scheduler policy used by most processes; SCHED_FIFO and SCHED_RR are intended for ...


4

The time slice used will matter for CPU intensive jobs that require cache persistency, unless you lock a particular core to each PID. You can increase the time slice with schedular policy SCHED_BATCH and improve performance up to 300% in some cases, while reducing interactive responsiveness. The opposite effect of smaller time slices occurs with SCHED_RR ...


4

The top command lists the priority of running processes under the PR heading. If you have it installed, you can also search for a process and sort by priority in htop.


3

awk '{print $18}' /proc/1337/stat (gets the prio for process 1337). Other options: Use ps -o pri. Specify the process id with -p 1337. Or, use -e to list all processes. Experiment with this as a starting point if you want more than just the priority: ps -e -o uid,pid,ppid,pri,ni,cmd


3

Just use nice (instead of renice). For example: nice -n 10 command This will run command with a low priority.


3

There are several uses for cgroups. From the system administration probably the most important one is limiting resources - the classical example here being is the cpu access. If you create a group for e.g. sshd and give it some non-negligible CPU time share (compared to other groups or the default under which fall all unsorted processes), you are guaranteed ...


3

Under Linux, by default, a process's IO priority is derived from its CPU priority according to the formula io_priority = (cpu_nice + 20) / 5 IO priority ranges from 0 to 7 with 0 being the highest priority. CPU niceness ranges from -20 to 19 with -20 being the highest priority. You can use the ionice command to change a process's IO priority. If you want ...


3

I am wondering why top and htop don't display -100 for higest priority real time processes ? That's because SCHED_RR and SCHED_FIFO have fixed static priorities from 1-99: Source For realtime priorities, the order is reversed: 99 is indeed the highest one, contrary to the ususal "lower is higher". Per your comment I misunderstood your question, ...


3

Have a look at cgroups, it should provide exactly what you need - CPU reservations (and more). I'd suggest reading controlling priority of applications using cgroups. That said, put the important yet often idle processes into group with allocated 95% of CPU and your other applications into another one with allocated 5% - you'll get (almost) all of the power ...


2

In fact, RLIMIT_NICE allows you to bypass the basic rule that says that "a process can raise its nice value only if owned by root". Demonstration: # ulimit -e 30 # su nobody $ nice -n -10 top You will see that your top process runs with niceness -10. Now if you try nice -n -11 top, it will run with niceness 0, because -11 is not allowed by ...


2

The field exists so you can define the order in which filesystems are checked. Different partitions on the same drive should not be checked at the same time since the IO going to each filesystem will compete with one another, and slow the whole process down. Filesystems on different physical disks could be set to check in the same pass to speed up the ...


2

I wrote a small script in perl to do what you ask: http://pastie.org/3460943 It works by getting all the current X11 window IDs using the "xlsclients -l" command, in turn getting the window's PID with xprop. It then uses xprop -root to get the currently focused window, then loops through all the PIDs to change their nice value to 5 (keeping the currently ...


2

You can use the ondemand cpu-freq governor, as long as you set the ignore_nice_load parameter to 1. From Documentation/cpu-freq/governors.txt, ondemand section: ignore_nice_load: this parameter takes a value of '0' or '1'. When set to '0' (its default), all processes are counted towards the 'cpu utilisation' value. When set to '1', the processes ...


2

As I mentioned, @glenn-jackman gave you the answer. But just to elaborate a bit more, if you wish to give higher priority to the command but do not intend to run it as root, you could use a function (and sudo): nice_cmd() { PRIORITY=$1 ; shift CMD=$1 ; shift ${CMD} $@ & cmdpid=$! sudo renice -n ${PRIORITY} -p ${cmdpid} } Then execute it as ...


1

Process priority is not the only thing that comes into play when you are trying to tweak user experience. Compiling the kernel is a rather I/O-heavy thing - lots of reading/writing from/to small files which can stretch the file system quite a bit (there is a reason why it is sometimes used as a benchmark in its own right), especially on a multiprocessor ...



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