source: rtems/doc/user/concepts.t @ 20515fc

4.104.114.84.95
Last change on this file since 20515fc was 20515fc, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 18:53:17

Nodes, menus, etc are automatically generated now

  • Property mode set to 100644
File size: 11.1 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@c
10@c  The following figure was replaced with an ASCII equivalent.
11@c    Figure 2-1 Object ID Composition
12@c
13
14@chapter Key Concepts
15
16@section Introduction
17
18The facilities provided by RTEMS are built upon a
19foundation of very powerful concepts.  These concepts must be
20understood before the application developer can efficiently
21utilize RTEMS.  The purpose of this chapter is to familiarize
22one with these concepts.
23
24@section Objects
25
26RTEMS provides directives which can be used to
27dynamically create, delete, and manipulate a set of predefined
28object types.  These types include tasks, message queues,
29semaphores, memory regions, memory partitions, timers, ports,
30and rate monotonic periods.  The object-oriented nature of RTEMS
31encourages the creation of modular applications built upon
32re-usable "building block" routines.
33
34All objects are created on the local node as required
35by the application and have an RTEMS assigned ID.  All objects
36have a user-assigned name.  Although a relationship exists
37between an object's name and its RTEMS assigned ID, the name and
38ID are not identical.  Object names are completely arbitrary and
39selected by the user as a meaningful "tag" which may commonly
40reflect the object's use in the application.  Conversely, object
41IDs are designed to facilitate efficient object manipulation by
42the executive.
43
44An object name is an unsigned thirty-two bit entity
45associated with the object by the user.  Although not required
46by RTEMS, object names are typically composed of four ASCII
47characters which help identify that object.  For example, a task
48which causes a light to blink might be called "LITE".  Utilities
49are provided to build an object name from four ASCII characters
50and to decompose an object name into four ASCII characters.
51However, it is not required that the application use ASCII
52characters to build object names.  For example, if an
53application requires one-hundred tasks, it would be difficult to
54assign meaningful ASCII names to each task.  A more convenient
55approach would be to name them the binary values one through
56one-hundred, respectively.
57
58@need 3000
59
60An object ID is a unique unsigned thirty-two bit
61entity composed of three parts: object class, node, and index.
62The most significant six bits are the object class.  The next
63ten bits are the number of the node on which this object was
64created.  The node number is always one (1) in a single
65processor system.  The least significant sixteen bits form an
66identifier within a particular object type.  This identifier,
67called the object index, ranges in value from 1 to the maximum
68number of objects configured for this object type.
69
70@ifset use-ascii
71@example
72@group
73     31        26 25              16 15                             0
74     +-----------+------------------+-------------------------------+
75     |           |                  |                               |
76     |   Class   |       Node       |             Index             |
77     |           |                  |                               |
78     +-----------+------------------+-------------------------------+
79@end group
80@end example
81@end ifset
82
83@ifset use-tex
84@sp 1
85@tex
86\centerline{\vbox{\offinterlineskip\halign{
87\strut#&
88\hbox to 0.50in{\enskip#}&
89\hbox to 0.50in{\enskip#}&
90#&
91\hbox to 0.50in{\enskip#}&
92\hbox to 0.50in{\enskip#}&
93#&
94\hbox to 1.00in{\enskip#}&
95\hbox to 1.00in{\enskip#}&
96#\cr
97\multispan{9}\cr
98\multispan{2}31\hfil&\multispan{2}\hfil26\enskip&
99 \multispan{1}\enskip25\hfil&\multispan{2}\hfil16\enskip&
100 \multispan{1}\enskip15\hfil&\multispan{2}\hfil0\cr
101&&&&&&&&&\cr
102}}\hfil}
103\centerline{\vbox{\offinterlineskip\halign{
104\strut\vrule#&
105\hbox to 0.50in{\enskip#}&
106\hbox to 0.50in{\enskip#}&
107\vrule#&
108\hbox to 0.50in{\enskip#}&
109\hbox to 0.50in{\enskip#}&
110\vrule#&
111\hbox to 0.50in{\enskip#}&
112\hbox to 0.50in{\enskip#}&
113\vrule#\cr
114\multispan{9}\cr
115\noalign{\hrule}
116&&&&&&&&&\cr
117&\multispan{2}\hfil Class\hfil&&
118 \multispan{2}\hfil Node\hfil&&
119 \multispan{2}\hfil Index\hfil&\cr
120&&&&&&&&&\cr
121\noalign{\hrule}
122}}\hfil}
123@end tex
124@end ifset
125
126@ifset use-html
127@html
128<CENTER>
129  <TABLE COLS=6 WIDTH="60%" BORDER=0>
130<TR><TD ALIGN=left><STRONG>31</STRONG></TD>
131    <TD ALIGN=right><STRONG>26</STRONG></TD>
132    <TD ALIGN=left><STRONG>25</STRONG></TD>
133    <TD ALIGN=right><STRONG>16</STRONG></TD>
134    <TD ALIGN=left><STRONG>15</STRONG></TD>
135    <TD ALIGN=right><STRONG>0</STRONG></TD></TR>
136  </TABLE>
137</CENTER>
138<CENTER>
139  <TABLE COLS=6 WIDTH="60%" BORDER=2>
140<TR><TD ALIGN=center COLSPAN=2>Class</TD>
141    <TD ALIGN=center COLSPAN=2>Node</TD>
142    <TD ALIGN=center COLSPAN=2>Index</TD></TD>
143  </TABLE>
144</CENTER>
145@end html
146@end ifset
147
148
149The three components of an object ID make it possible
150to quickly locate any object in even the most complicated
151multiprocessor system.  Object ID's are associated with an
152object by RTEMS when the object is created and the corresponding
153ID is returned by the appropriate object create directive.  The
154object ID is required as input to all directives involving
155objects, except those which create an object or obtain the ID of
156an object.
157
158The object identification directives can be used to
159dynamically obtain a particular object's ID given its name.
160This mapping is accomplished by searching the name table
161associated with this object type.  If the name is non-unique,
162then the ID associated with the first occurrence of the name
163will be returned to the application.  Since object IDs are
164returned when the object is created, the object identification
165directives are not necessary in a properly designed single
166processor application.
167
168An object control block is a data structure defined
169by RTEMS which contains the information necessary to manage a
170particular object type.  For efficiency reasons, the format of
171each object type's control block is different.  However, many of
172the fields are similar in function.  The number of each type of
173control block is application dependent and determined by the
174values specified in the user's Configuration Table.  An object
175control block is allocated at object create time and freed when
176the object is deleted.  With the exception of user extension
177routines, object control blocks are not directly manipulated by
178user applications.
179
180@section Communication and Synchronization
181
182In real-time multitasking applications, the ability
183for cooperating execution threads to communicate and synchronize
184with each other is imperative.  A real-time executive should
185provide an application with the following capabilities:
186
187@itemize @bullet
188@item Data transfer between cooperating tasks
189@item Data transfer between tasks and ISRs
190@item Synchronization of cooperating tasks
191@item Synchronization of tasks and ISRs
192@end itemize
193
194Most RTEMS managers can be used to provide some form
195of communication and/or synchronization.  However, managers
196dedicated specifically to communication and synchronization
197provide well established mechanisms which directly map to the
198application's varying needs.  This level of flexibility allows
199the application designer to match the features of a particular
200manager with the complexity of communication and synchronization
201required.  The following managers were specifically designed for
202communication and synchronization:
203
204@itemize @bullet
205@item Semaphore
206@item Message Queue
207@item Event
208@item Signal
209@end itemize
210
211The semaphore manager supports mutual exclusion
212involving the synchronization of access to one or more shared
213user resources.  Binary semaphores may utilize the optional
214priority inheritance algorithm to avoid the problem of priority
215inversion.  The message manager supports both communication and
216synchronization, while the event manager primarily provides a
217high performance synchronization mechanism.  The signal manager
218supports only asynchronous communication and is typically used
219for exception handling.
220
221@section Time
222
223The development of responsive real-time applications
224requires an understanding of how RTEMS maintains and supports
225time-related operations.  The basic unit of time in RTEMS is
226known as a tick.  The frequency of clock ticks is completely
227application dependent and determines the granularity and
228accuracy of all interval and calendar time operations.
229
230By tracking time in units of ticks, RTEMS is capable
231of supporting interval timing functions such as task delays,
232timeouts, timeslicing, the delayed execution of timer service
233routines, and the rate monotonic scheduling of tasks.  An
234interval is defined as a number of ticks relative to the current
235time.  For example, when a task delays for an interval of ten
236ticks, it is implied that the task will not execute until ten
237clock ticks have occurred.
238
239A characteristic of interval timing is that the
240actual interval period may be a fraction of a tick less than the
241interval requested.  This occurs because the time at which the
242delay timer is set up occurs at some time between two clock
243ticks.  Therefore, the first countdown tick occurs in less than
244the complete time interval for a tick.  This can be a problem if
245the clock granularity is large.
246
247The rate monotonic scheduling algorithm is a hard
248real-time scheduling methodology.  This methodology provides
249rules which allows one to guarantee that a set of independent
250periodic tasks will always meet their deadlines -- even under
251transient overload conditions.  The rate monotonic manager
252provides directives built upon the Clock Manager's interval
253timer support routines.
254
255Interval timing is not sufficient for the many
256applications which require that time be kept in wall time or
257true calendar form.  Consequently, RTEMS maintains the current
258date and time.  This allows selected time operations to be
259scheduled at an actual calendar date and time.  For example, a
260task could request to delay until midnight on New Year's Eve
261before lowering the ball at Times Square.
262
263Obviously, the directives which use intervals or wall
264time cannot operate without some external mechanism which
265provides a periodic clock tick.  This clock tick is typically
266provided by a real time clock or counter/timer device.
267
268@section Memory Management
269
270RTEMS memory management facilities can be grouped
271into two classes: dynamic memory allocation and address
272translation.  Dynamic memory allocation is required by
273applications whose memory requirements vary through the
274application's course of execution.  Address translation is
275needed by applications which share memory with another CPU or an
276intelligent Input/Output processor.  The following RTEMS
277managers provide facilities to manage memory:
278
279@itemize @bullet
280@item Region
281
282@item Partition
283
284@item Dual Ported Memory
285@end itemize
286
287RTEMS memory management features allow an application
288to create simple memory pools of fixed size buffers and/or more
289complex memory pools of variable size segments.  The partition
290manager provides directives to manage and maintain pools of
291fixed size entities such as resource control blocks.
292Alternatively, the region manager provides a more general
293purpose memory allocation scheme that supports variable size
294blocks of memory which are dynamically obtained and freed by the
295application.  The dual-ported memory manager provides executive
296support for address translation between internal and external
297dual-ported RAM address space.
Note: See TracBrowser for help on using the repository browser.