On Sat, Dec 22, 2007 at 07:09:47PM -0800, Unga wrote: > Hi all > > $ ps -o pri,ni,rtprio,command -p `pgrep amarok` > PRI NI RTPRIO COMMAND > 20 0 normal amarokapp > > 1) Are there are 3 priority values per process, or > just one?
There is really only one priority that is used when scheduling processes. The other two fields (nice and rtprio) modifies how the priority is set, but do not directly affect the priority. The actual priority is handled internally in the kernel and cannot be modified directly from userland. It is always the case that if two (or more) processes both want to use the CPU at the same time, then it is the one with the highest priority which gets to use it. (The term 'highest priority' can be slightly confusing, since it is normally the process with the lowest value in the 'PRI' field which has the highest priority.) For those processes that has a real time priority (rtprio) of 'normal', i.e. most normal processes, the priority is adjusted dynamically depending on how long it has waited for CPU, and how much CPU it used the last time it ran, etc. The 'nice' value affects how quickly the priority is adjusted up or down. A high nice value means that the priority will only increase slowly and decrease quickly, while it is the other way around for processes with a low nice value. Note however that even a process with a high nice value will get at least a little CPU time now and then, even if there are processes around that are much less nice that want the CPU too. For processes with a real time priority of something other than 'normal' the priority is not adjusted dynamically. Processes with rtprio=idle always have lower priority than all other processes. Processes with an actual real time priority set will always have higher priority than non-real time processes. > > 2) How should I read above? Is it Priority=20, ie. > NI=0, RTPRIO=normal? It is: Priority=20; Nice=0; Real time priority=normal > Does it all mean the same thing, > like the bytes=1048576 and KB=1024 and MB=1? No. > > 3) The rtprio(1) says "Priority is an integer between > 0 and RTP_PRIO_MAX (usually 31). 0 is the highest > priority". But when I run following command: > > $ ps aux -o pri,ni,rtprio,command > > USER PID %CPU %MEM VSZ RSS TT STAT STARTED > TIME COMMAND PRI NI RTPRIO COMMAND > > root 10 99.2 0.0 0 8 ?? RL 7:40PM > 0:00.00 [idle: cpu1] 171 0 idle:25 [idle: cpu1] > > root 26 0.0 0.0 0 8 ?? WL 7:40PM > 0:00.02 [irq18: envy24ht -80 0 intr:4 [irq18: > envy24ht > > test 1212 0.0 9.3 58544 48176 ?? S 8:06PM > 0:06.15 amarokapp 20 0 normal amarokapp > > That is, > PID PRI NI RTPRIO > 10 171 0 idle:25 > 26 -80 0 intr:4 > 1212 20 0 normal > > This shows priority ranges at least from -80 to 171 > contrary to the range mentioned in rtprio(1). Does > this means PID=26 has a higher priority than PID=1212? rtprio(1) does not set the PRI field directly. It sets the RTPRIO field. In your example these are 'idle:25' 'intr:4' and 'normal' indicating that these are run with idle priority, interrupt priority, and normal priority respectively. (The 'intr' value in the rtprio field can probably only be set directly by the kernel for interrupt threads, and is a bit outside the normal real time priorities.) The actual idel/real time priority value set by rtprio(1)/idprio(1) is not displayed by ps(1), but can be shown by rtprio(1)/idprio(1). Yes, PID=26 has a much higher priority than PID=1212, as it should considering that PID=26 is an interrupt thread, while PID=1212 is just an ordinary, non-real time, process. > > 4) Can a PRI=0 be considered Realtime? No, not really. If a process does not have rtprio set to something other than 'normal' or 'idle' it is not a real time process. > > 5) What is the meaning of priority=0 in > /etc/login.conf? Is it Realtime? No, the 'priority' field in /etc/login.conf sets the nice value. > > 6) What is the value should I set for priority in > /etc/login.conf if I want Realtime? You can't do that. You should also not set any process to a real-time priority unless you know exactly what you are doing and why you are doing it. The normal way of setting the relative priorities of processes on Unix systems is by setting the nice value (and only root is allowed to lower the nice value.) -- <Insert your favourite quote here.> Erik Trulsson [EMAIL PROTECTED] _______________________________________________ firstname.lastname@example.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"