File: glossary.xml

package info (click to toggle)
boost 1.33.1-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 100,948 kB
  • ctags: 145,103
  • sloc: cpp: 573,492; xml: 49,055; python: 15,626; ansic: 13,588; sh: 2,099; yacc: 858; makefile: 660; perl: 427; lex: 111; csh: 6
file content (300 lines) | stat: -rw-r--r-- 12,552 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" [
  <!ENTITY % threads.entities SYSTEM "entities.xml">
  %threads.entities;
]>
<glossary id="threads.glossary" last-revision="$Date: 2004/07/17 04:33:59 $">
  <title>Glossary</title>
  <para>Definitions are given in terms of the C++ Standard
  &cite.ISO98;. References to the standard are in the form [1.2.3/4], which
  represents the section number, with the paragraph number following the
  "/".</para>
  <para>Because the definitions are written in something akin to "standardese",
  they can be difficult to understand. The intent isn't to confuse, but rather
  to clarify the additional requirements &Boost.Threads; places on a C++
  implementation as defined by the C++ Standard.</para>
  <glossentry id="threads.glossary.thread">
    <glossterm>Thread</glossterm>
    <glossdef>
	  <para>Thread is short for "thread of execution". A thread of execution is
	  an execution environment [1.9/7] within the execution environment of a C++
	  program [1.9]. The main() function [3.6.1] of the program is the initial
	  function of the initial thread. A program in a multithreading environment
	  always has an initial thread even if the program explicitly creates no
	  additional threads.</para>
      <para>Unless otherwise specified, each thread shares all aspects of its
	  execution environment with other threads in the program. Shared aspects of
	  the execution environment include, but are not limited to, the
	  following:</para>
	  <itemizedlist>
        <listitem><para>Static storage duration (static, extern) objects
		[3.7.1].</para></listitem>
	    <listitem><para>Dynamic storage duration (heap) objects [3.7.3]. Thus
		each memory allocation will return a unique addresses, regardless of the
		thread making the allocation request.</para></listitem>
        <listitem><para>Automatic storage duration (stack) objects [3.7.2]
		accessed via pointer or reference from another thread.</para></listitem>
        <listitem><para>Resources provided by the operating system. For example,
		files.</para></listitem>
        <listitem><para>The program itself. In other words, each thread is
		executing some function of the same program, not a totally different
		program.</para></listitem>
      </itemizedlist>
      <para>Each thread has its own:</para>
      <itemizedlist>
        <listitem><para>Registers and current execution sequence (program
		counter) [1.9/5].</para></listitem>
        <listitem><para>Automatic storage duration (stack) objects
		[3.7.2].</para></listitem>
      </itemizedlist>
    </glossdef>
  </glossentry>
  <glossentry id="threads.glossary.thread-safe">
    <glossterm>Thread-safe</glossterm>
	<glossdef>
      <para>A program is thread-safe if it has no <link
	  linkend="threads.glossary.race-condition">race conditions</link>, does
	  not <link linkend="threads.glossary.deadlock">deadlock</link>, and has
	  no <link linkend="threads.glossary.priority-failure">priority
	  failures</link>.</para>
	  <para>Note that thread-safety does not necessarily imply efficiency, and
	  than while some thread-safety violations can be determined statically at
	  compile time, many thread-safety errors can only only be detected at
	  runtime.</para>
	</glossdef>
  </glossentry>
  <glossentry id="threads.glossary.thread-state">
    <glossterm>Thread State</glossterm>
	<glossdef>
      <para>During the lifetime of a thread, it shall be in one of the following
	  states:</para>
	  <table>
		<title>Thread States</title>
		<tgroup cols="2" align="left">
			<thead>
				<row>
					<entry>State</entry>
					<entry>Description</entry>
				</row>
			</thead>
			<tbody>
				<row>
					<entry>Ready</entry>
					<entry>Ready to run, but waiting for a processor.</entry>
				</row>
				<row>
					<entry>Running</entry>
					<entry>Currently executing on a processor. Zero or more threads
					may be running at any time, with a maximum equal to the number of
					processors.</entry>
				</row>
				<row>
					<entry>Blocked</entry>
					<entry>Waiting for some resource other than a processor which is
					not currently available, or for the completion of calls to library
					functions [1.9/6]. The term "waiting" is synonymous with
					"blocked"</entry>
				</row>
				<row>
					<entry>Terminated</entry>
					<entry>Finished execution but not yet detached or joined.</entry>
				</row>
			</tbody>
		</tgroup>
	  </table>
      <para>Thread state transitions shall occur only as specified:</para>
	  <table>
		<title>Thread States Transitions</title>
		<tgroup cols="3" align="left">
			<thead>
				<row>
					<entry>From</entry>
					<entry>To</entry>
					<entry>Cause</entry>
				</row>
			</thead>
			<tbody>
				<row>
					<entry>[none]</entry>
					<entry>Ready</entry>
					<entry><para>Thread is created by a call to a library function. 
					In the case of the initial thread, creation is implicit and 
					occurs during the startup of the main() function [3.6.1].</para></entry>
				</row>
				<row>
					<entry>Ready</entry>
					<entry>Running</entry>
					<entry><para>Processor becomes available.</para></entry>
				</row>
				<row>
					<entry>Running</entry>
					<entry>Ready</entry>
					<entry>Thread preempted.</entry>
				</row>
				<row>
					<entry>Running</entry>
					<entry>Blocked</entry>
					<entry>Thread calls a library function which waits for a resource or
					for the completion of I/O.</entry>
				</row>
				<row>
					<entry>Running</entry>
					<entry>Terminated</entry>
					<entry>Thread returns from its initial function, calls a thread
					termination library function, or is canceled by some other thread
					calling a thread termination library function.</entry>
				</row>
				<row>
					<entry>Blocked</entry>
					<entry>Ready</entry>
					<entry>The resource being waited for becomes available, or the
					blocking library function completes.</entry>
				</row>
				<row>
					<entry>Terminated</entry>
					<entry>[none]</entry>
					<entry>Thread is detached or joined by some other thread calling the
					appropriate library function, or by program termination
					[3.6.3].</entry>
				</row>
			</tbody>
		</tgroup>
      </table>
      <para>[Note: if a suspend() function is added to the threading library,
	  additional transitions to the blocked state will have to be added to the
	  above table.]</para>
    </glossdef>
  </glossentry>
  <glossentry id="threads.glossary.race-condition">
    <glossterm>Race Condition</glossterm>
	<glossdef>
      <para>A race condition is what occurs when multiple threads read from and write
	  to the same memory without proper synchronization, resulting in an incorrect
	  value being read or written. The result of a race condition may be a bit
	  pattern which isn't even a valid value for the data type. A race condition
	  results in undefined behavior [1.3.12].</para>
      <para>Race conditions can be prevented by serializing memory access using
	  the tools provided by &Boost.Threads;.</para>
    </glossdef>
  </glossentry>
  <glossentry id="threads.glossary.deadlock">
    <glossterm>Deadlock</glossterm>
	<glossdef>
      <para>Deadlock is an execution state where for some set of threads, each
	  thread in the set is blocked waiting for some action by one of the other
	  threads in the set. Since each is waiting on the others, none will ever
	  become ready again.</para>
	</glossdef>
  </glossentry>
  <glossentry id="threads.glossary.starvation">
    <glossterm>Starvation</glossterm>
	<glossdef>
	  <para>The condition in which a thread is not making sufficient progress in
	  its work during a given time interval.</para>
	</glossdef>
  </glossentry>
  <glossentry id="threads.glossary.priority-failure">
    <glossterm>Priority Failure</glossterm>
	<glossdef>
	  <para>A priority failure (such as priority inversion or infinite overtaking)
	  occurs when threads are executed in such a sequence that required work is not
	  performed in time to be useful.</para>
	</glossdef>
  </glossentry>
  <glossentry id="threads.glossary.undefined-behavior">
    <glossterm>Undefined Behavior</glossterm>
	<glossdef>
	  <para>The result of certain operations in &Boost.Threads; is undefined;
	  this means that those operations can invoke almost any behavior when
	  they are executed.</para>
	  
	  <para>An operation whose behavior is undefined can work "correctly"
	  in some implementations (i.e., do what the programmer thought it
	  would do), while in other implementations it may exhibit almost
	  any "incorrect" behavior--such as returning an invalid value,
	  throwing an exception, generating an access violation, or terminating 
	  the process.</para>
	  
	  <para>Executing a statement whose behavior is undefined is a
	  programming error.</para>
	</glossdef>
  </glossentry>
  <glossentry id="threads.glossary.memory-visibility">
    <glossterm>Memory Visibility</glossterm>
	<glossdef>
	  <para>An address [1.7] shall always point to the same memory byte,
	  regardless of the thread or processor dereferencing the address.</para>
      <para>An object [1.8, 1.9] is accessible from multiple threads if it is of
	  static storage duration (static, extern) [3.7.1], or if a pointer or
	  reference to it is explicitly or implicitly dereferenced in multiple
	  threads.</para>
	  <para>For an object accessible from multiple threads, the value of the
	  object accessed from one thread may be indeterminate or different from the
	  value accessed from another thread, except under the conditions specified in
	  the following table. For the same row of the table, the value of an object
	  accessible at the indicated sequence point in thread A will be determinate
	  and the same if accessed at or after the indicated sequence point in thread
	  B, provided the object is not otherwise modified. In the table, the
	  "sequence point at a call" is the sequence point after the evaluation of all
	  function arguments [1.9/17], while the "sequence point after a call" is the
	  sequence point after the copying of the returned value... [1.9/17].</para>
      <table>
		<title>Memory Visibility</title>
		<tgroup cols="2">
			<thead>
				<row>
					<entry>Thread A</entry>
					<entry>Thread B</entry>
				</row>
			</thead>
			<tbody>
				<row>
					<entry>The sequence point at a call to a library thread-creation
					function.</entry>
					<entry>The first sequence point of the initial function in the new
					thread created by the Thread A call.</entry>
				</row>
				<row>
					<entry>The sequence point at a call to a library function which
					locks a mutex, directly or by waiting for a condition
					variable.</entry>
					<entry>The sequence point after a call to a library function which
					unlocks the same mutex.</entry>
				</row>
				<row>
					<entry>The last sequence point before thread termination.</entry>
					<entry>The sequence point after a call to a library function which
					joins the terminated thread.</entry>
				</row>
				<row>
					<entry>The sequence point at a call to a library function which
					signals or broadcasts a condition variable.</entry>
					<entry>The sequence point after the call to the library function
					which was waiting on that same condition variable or signal.</entry>
				</row>
			</tbody>
		</tgroup>
      </table>
      <para>The architecture of the execution environment and the observable
	  behavior of the abstract machine [1.9] shall be the same on all
	  processors.</para>
	  <para>The latitude granted by the C++ standard for an implementation to
	  alter the definition of observable behavior of the abstract machine to
	  include additional library I/O functions [1.9/6] is extended to include
	  threading library functions.</para>
	  <para>When an exception is thrown and there is no matching exception handler
	  in the same thread, behavior is undefined. The preferred behavior is the
	  same as when there is no matching exception handler in a program
	  [15.3/9]. That is, terminate() is called, and it is implementation-defined
	  whether or not the stack is unwound.</para>
    </glossdef>
  </glossentry>
  <section>
    <title>Acknowledgements</title>
    <para>This document was originally written by Beman Dawes, and then much
	improved by the incorporation of comments from William Kempf, who now
	maintains the contents.</para>
	<para>The visibility rules are based on &cite.Butenhof97;.</para>
  </section>
</glossary>