Gentoo Archives: gentoo-user

From: Joseph <syscon@×××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] real-time priority
Date: Fri, 12 Aug 2005 00:14:20
Message-Id: 1123805298.11201.21.camel@sysconcept.ca
In Reply to: Re: [gentoo-user] real-time priority by Ian K
1 On Thu, 2005-08-11 at 15:06 +0000, Ian K wrote:
2 > Joseph wrote:
3 >
4 > >How to list real-time priority in Linux for an application (example
5 > >asterisk)?
6 > >
7 > >
8 > >
9 > Do you mean processor scheduling? "This program deserves more processor
10 > time/power than others?"
11 >
12 > If so, find out the process ID of the app you want to 'promote' or 'demote'
13 > and take it with you into a konsole/terminal and type this:
14 >
15 > renice <process ID> <priority>
16 >
17 > The priority is on a scale. -21---0--+21
18 > The negative priorities are promotions. Giving it a -21 would bring down
19 > many
20 > other applications the second they tried to use the processor. I never
21 > really go
22 > above ten, either way.
23 >
24 > HTH,
25 > Ian
26
27 I'm not sure if that what they mean with "real-time priority".
28 All I was able to find out that some of them are running Asterisk with
29 switch -p;
30 so they start asterisk with:
31 asterisk -p
32 This is an explanation what -p switch does (from asterisk man):
33
34 If supported by the operating system (and executing as root), attempt to
35 run with realtime priority for increased performance and
36 responsiveness within the Asterisk process, at the expense of other
37 programs running on the same machine.
38
39 I now that I could start asterisk with higher priority level; so I
40 modified the startup script to start asterisk with "nice -15".
41 But some of the members in asterisk forum insisting that "nice" is not
42 the same as "real-time priority".
43
44 Here are two replies I received form Asterisk forum:
45 ------ reply 1 ------------------
46 What do you mean with listing real-time priority? You can list process
47 priorities with commands like top or "ps -eo pri,nice,%cpu,pid,args
48 --sort pri" (for example).
49
50 If you're interrested in asterisk's real-time responsiveness, the
51 following might be of interrest.
52
53 Real-time priority actually doesn't exist in Linux (you'll need to use
54 a
55 real RTOS for that). Still, Linux makes a destinction between processes
56 that need sort of real-time response times and processes that don't.
57 Controlling this in a direct way is a difficult, if possible at all.
58 Prioritizing processes is done on the fly (in real time) by the
59 scheduling process in the Linux core.
60
61 However, there is a way to manipulate the prioritizing of processes
62 with
63 a command called 'nice'. Normally you use this command (with a positive
64 adjustment value) to make a process to behave 'nice' to other
65 processes.
66 That is, it gives the process a lower priority that it would normally
67 get, thus making it a relative low priority process. By using nice with
68 a negative adjustment (you'll need to be root for that), you're able to
69 give a certain process a higher priority than it would normally get,
70 thus giving the process more of a 'real-time' priority.
71
72 In my experience it proved to be more usefull to give all the
73 processes,
74 that stood in the way of asterisk performance, a positive nice
75 adjustment, rather than giving asterisk a negative nice adjustment. I
76 haven't tested this thoroughly, so I'm not sure about the reasons for
77 this. It could have something to with asterisk getting in the way of
78 Linux's core processes when incresing it's priority. Still, it's
79 nothing
80 more than a guess.
81 --------- end replay 1 ---------------
82
83 -------- reply 2 -------------
84
85 > Real-time priority actually doesn't exist in Linux
86
87 Sure it does.
88
89 > you'll need to use a real RTOS for that
90
91 Thanks to Ingo Molnars' realtime patches, the gnu/linux audio
92 community runs with latencies sub 1ms.
93
94 > Controlling this in a direct way is a difficult, if possible at all
95
96 chrt(1)
97 ------- end reply 2 ---------
98
99 --
100 #Joseph
101 --
102 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] real-time priority Peter Karlsson <petekarl@××××××××××××××××.se>