summaryrefslogtreecommitdiff
path: root/paper.tex
blob: 30a5c12f748d99e3b60961be51cf94ac8e354f1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% paper.tex = template for real-time Linux workshop papers
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{multicol}
\usepackage{listings}
\usepackage{epsfig}
\newcounter{figcounter}
\def\epsin #1#2#3#4{
	\refstepcounter{figcounter} \label{#3}
	\[
	\mbox{
		\epsfxsize=#2mm
		\epsffile{./img/#1.eps}
	}
	\]
	\begin{center}
		\parbox{7cm}{{\bf FIGURE \arabic{figcounter}:}\quad {\it #4 } } \\
	\end{center}
}

\setlength{\paperheight}{297mm}
\setlength{\paperwidth}{210mm}
\setlength{\voffset}{-12mm}
\setlength{\topmargin}{0mm}
\setlength{\headsep}{8mm}
\setlength{\headheight}{10mm}
\setlength{\textheight}{235mm}
\setlength{\hoffset}{-4mm}
\setlength{\textwidth}{166mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\marginparwidth}{0mm}
\setlength{\marginparpush}{0mm}
\setlength{\columnsep}{6mm}
\setlength{\parindent}{6mm}

%% insert eps pictures
%% use as \epsin{epsfile}{width_in_mm}{label}{caption}

%% insert table
%% use as \tabin{size_in_mm}{label}{caption}{table_data}
\newcounter{tabcounter}
\def\tabin #1#2#3#4{
\refstepcounter{tabcounter} \label{#2}
\[ \makebox[#1mm][c]{#4} \]
%\vspace{0mm}
\begin{center}
  \parbox{7cm}{{\bf TABLE \arabic{tabcounter}:}\quad {\it #3 } } \\
\end{center}
}

\title{\LARGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% TITLE OF PAPER (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Real-time CORBA performance on Linux-RT\_PREEMPT
}

\author{\large
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AUTHOR (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bf Manuel Traut }\\ 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AFFILIATION (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Linutronix GmbH\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% STREET ADDRESS (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Auf dem Berg 3, 88690 Uhldingen, Germany\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% E-MAIL (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
manut$@$linutronix.de \\
\vspace{8mm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AUTHOR (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%{\bf Li Su}\\ 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AFFILIATION (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%CASC Long March Launch Vehicle Technology CO. LTD\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% STREET ADDRESS (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%7 Building, 15 Block, NO.188 West Road, the forth South Round, BeiJing\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% E-MAIL (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%sudanlina$@$yahoo.com.cn \\
}
\date{}


\begin{document}

\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ABSTRACT (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
Automation technology lacks an established platform independent, high-level, object oriented real-time capable communication standard, which is based on standard Ethernet hardware and drivers. ACE/TAO is an Open Source implementation of the OMG Real-Time CORBA Specification and might fill this gap. It is designed platform independent, implemented in C++ and provides a standardized communication framework. Real-Time CORBA is already used in industrial environments, e.g. aircraft, naval equipment and others. This paper explains the basics of the ACE/TAO framework and its usage in industrial communication. On the basis of a real-world example - transmission of an 1 KiB data frame - two communication methods are evaluated: the RT-CORBA Remote Procedure Call and the TAO Real-Time Event-Channel. The performance measurement methods are explained in detail. Measurement results under various system loads and a comparison of ACE/TAO on top of a vanilla Linux kernel and a RT\_PREEMPT enabled Linux kernel provide a meaningful insight in the capabilities of RT-CORBA. Finally, the paper provides an analysis of functionality which needs to be improved in the operating system to provide real deterministic communication through a standardized framework.
\end{abstract}

\vspace{10mm}

\begin{multicols}{2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}

The main communication infrastructure in industrial automation is
based on a broad variety of industrial fieldbusses based on CAN, RS422
and RS485 physical layers. Since 2005 ethernet based communication is
gaining popularity. Aside of this the usage of PC based hardware with
realtime operating systems becomes more wide spread. The systems
provide the usual set of interfaces and capabilities known from the IT
world with specialized software for machine controls.

Combining PC based hardware and ethernet based real-time capable
communication methods utilizing object-oriented middleware could
provide a couple of advantages:
\begin{itemize}
\item fast development cycles
\item ease of maintenance
\item flexible reusability of software modules
\item connection handling is done by the middleware
\item \dots
\end{itemize}
ACE/TAO, a Real-time CORBA implementation, and the RT\_PREEMPT
patch for the Linux kernel provide such a base environment today. 

\subsection{CORBA}
CORBA is a middleware, which allows RPC\footnote{Remote Procedure
  Call}-based IPC\footnote{Inter Process Communication} between
different operating systems and different programming languages
(Figure 1).

The communication interfaces are defined in IDL\footnote{Interface Definition
  Language}. The IDL files are compiled into, e.g. c++, java, \dots,
code which does the (de)serialization of the datatypes. The interface
implementations (CORBA objects) are registered with language
specific ORB\footnote{Object Request Broker}s. Each CORBA process owns
one ORB, which handles the function requests and returns the
calculated values.

\epsin{orb}{80}{fig1:f1}{CORBA Architecture}

\subsection{Real-Time CORBA}
\epsin{rtcorbaext}{70}{fig1:f2}{Real-time CORBA \\(source: [1])} As
shown in figure 2, a real-time capable ORB extends a standard ORB with
the following features: locating objects in constant time,
preallocation of resources, operating system independent priority
handling, priority based scheduling.

\subsection{ACE/TAO}
ACE is an open-source c++ framework for platform-independent system-
and network-programming. TAO is a Real-time CORBA implementation build
on top of ACE (Figure 3).

\epsin{ace}{80}{fig1:f3}{ACE/TAO framework \\(source: [2])}

The ACE/TAO package is available for all important operating
systems. The framework can be trimmed for embedded systems: Each
application described in this paper consumes less than 1 MByte of
RAM. Also the consumed CPU time is suprisingly low.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% NEXT SECTION (OPTIONAL)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Performance Measurements}

The measurements were made on embedded systems (Intel Mobile CPU 600
MHz, 512 MB RAM, Intel e100 NIC) with digital I/0 ports. A
square-pulse generator is connected to a digital input of the
\textit{supplier system} and to channel 1 of the
oscilloscope. The digital outputs of the \textit{receiver systems}
\#I and \#II are connected to channel 2 and 3 of the oscilloscope.

\epsin{versuch4}{80}{fig1:f4}{Measurement environment}

\subsection{RPC}

Each receiver hosts an object, for writing values to its digital
output:

\begin{lstlisting}
module benchmark{
  interface Put{
    void Port( in short portNo, 
               in short value, 
	       in string data  );
  };
};
\end{lstlisting}

The \textit{Port} function is called by the \textit{supplier} as soon as
the state of one of its digital inputs changes. The real end to end
latency is measured with the oscilloscope.

\epsin{sequenzV1}{80}{fig1:f5}{RPC measurement: sequence diagramm}

Figure 6a shows a latency histogram measured on system running a
RT\_PREEMPT enabled kernel. Extra system load is generate by heavy disk
I/O, network traffic on non-prioritized NICs and five low priority CPU
hogs. The RPC \textit{data} string has zero length.

The latency is the total time of the RPC execution. The RPC execution 
is triggered by the rising and the falling edge of the square-wave 
generator connected to the digital input of the supplier system. The 
RPC results in toggling the output on the receiver system. The input 
and the output are monitored by a digital oscilloscope, which provides 
histogram generation functionalities.

\epsin{v1Last}{80}{fig1:f6a}{Latency histogram RT\_PREEMPT, system load}

\epsin{vanilla-ohne-last}{80}{fig1:f6b}{Latency histogram Vanilla, without system load}

The results of the same measurement on a none RT\_PREEMPT enabled
kernel are shown in figure 6b (without system load) and 6c (with
system load).

\epsin{vanilla-mit-last}{80}{fig1:f6c}{Latency histogramm Vanilla, system load}

The same measurement under identical system load was made once again
with both receiving systems active. Receiving system \#I hosts the
object for setting port values with lower priorization than receiving
system \#II. On the supplier system the square-waveform generator is
connected to two digital input ports. Changes on the first port are
commited to the higher prioritized \textit{receiver} on system \#II;
changes on the second port are sent to the lower prioritized receiving
system \#I. Figure 7 shows, that no priority inversion occours.

\epsin{v3Last}{80}{fig1:f7}{Latency histogramm, two priorizations}

To simulate a higher data transmission rate, the parameter 
\textit{in string data} is read in from a text file, so its
length can be changed after compile time by editing the text
file. Figure 8 shows the larger the process data image is the larger
is the difference between immediate and worst case latency.

\epsin{v4plot}{80}{fig1:f8}{dependency between process data image size and latency}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SUB SECTION (OPTIONAL)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{TAO Real-time Event-Channel}

The TAO Real-time Event-Channel is a Messaging Service. Suppliers are
sending messages to the Messaging Service. A client can subscribe for
messages at the Messaging Service.

As soon as the value of the digital input of the Supplier changes, the
new value of the digital input port is send to the Messaging
Service. The Messaging Service sends this value, to all subscribed
clients. The clients write the values from the messages to the digital
outputs.

\epsin{sequenzV2}{80}{fig1:f9}{Event-Channel measurement: sequence diagramm}

The TAO Real-time Event-Channel is an additional CORBA application the
data has to pass, so the latency should be approximately two times the
latency of the RPC measurement. Figure 10 shows, that this is a
correct assumption.

\epsin{v2Last}{80}{fig1:f10}{Latency histogramm, TAO RT Event-Channel}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% NEXT SECTION (OPTIONAL)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Needed operating system functionalities}

A TAO ORB can only schedule its CORBA requests correctly when the
underlying operating system has real-time capabilities with a
deterministic scheduling latency. The programming model expects a
priority based scheduling algorithm. The operating system latencies of
Linux can be tested with cyclictest. cyclictest is an utiliy which
determines the deviation of the expected time line of a periodic
timer. This takes the full chain of timer interrupt, scheduler
invocation, context switch and return to the user space application
into account. On a given test system the maximum latency with a
RT\_PREEMPT enabled kernel was $26 \mu s$, with a vanilla kernel the
maximum latency increased to $39.6 ms$.

Another requirement for deterministic communication is the
priorization of device I/O. Right now this is not fully implemented in
the RT\_PREEMPT kernel. The priority of interrupt service handlers is
only configurable per interrupt line, which causes problems if the
interrupt line is shared between a high priority and a low priority
device. The same applies for the networking soft interrupt which
handles all network interfaces in the same queue.

The kernel community has already recognized the importance of real-time 
networking capabilities and solutions for this problem are already
discussed.

Not all NICs (especially their firmware and drivers) are suitable for
real-time networking. Many modern NICs don't request an interrupt for
each received package. They only request an interrupt if a defined
amount of data is received, or a defined timeout is over. These cards
cause high latencies especially when the transfered data packages are
small.

\section{Conclusion}

Real-time communicaion based on object-orientated middleware over
standard ethernet hardware is a promising solution. Various problems
have been identified, but resolving those is not trivial. 

Interestingly enough of these problems are not restricted to the
communication requirements of the automation industry. The increasing
demands on deterministic networking for other application areas e.g.
telecommunication provide additional momentum for improving the
deterministic behaviour of network communication in the Linux kernel.

ACE/TAO and RT\_PREEMPT enabled Linux are providing a useful and solid
environment today with further improvements in the foreseeable future.

[3] is a good resource for further informations.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% REFERNCES (REQUIRED)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{thebibliography}{9}%use this if you have <=9 bib refs
%\begin{thebibliography}{99}%use this if you have >9 bib refs
\bibitem{paper1},{\it Real-time CORBA Specification},2005, {\sc OMG}
\bibitem{paper2},{\it Overview of ACE},2007\\{\it http://www.cs.wustl.edu/schmidt/ACE-overview.html}
\bibitem{paper3},{\it TAO technical documents},2007\\{\it http://www.cs.wustl.edu/schmidt/corba-research-realtime.html}
\end{thebibliography}

\end{multicols}
\end{document}