Sigstack is disabled in favour of sigaltstack.
[platform/upstream/pth.git] / rse-pmt.ps
1 %!PS-Adobe-2.0
2 %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software
3 %%Title: pmt.dvi
4 %%Pages: 11
5 %%PageOrder: Ascend
6 %%BoundingBox: 0 0 612 792
7 %%DocumentFonts: Times-Bold Times-Roman Times-Italic Helvetica-Bold
8 %%+ Courier Times-BoldItalic Courier-Bold Courier-BoldOblique Helvetica
9 %%EndComments
10 %DVIPSWebPage: (www.radicaleye.com)
11 %DVIPSCommandLine: dvips -t letter pmt.dvi
12 %DVIPSParameters: dpi=600, compressed
13 %DVIPSSource:  TeX output 2000.06.18:1110
14 %%BeginProcSet: texc.pro
15 %!
16 /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
17 N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
18 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
19 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
20 landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
21 mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
22 matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
23 exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
24 statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
25 N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
26 /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
27 /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
28 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
29 df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
30 definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
31 }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
32 B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
33 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3
34 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx
35 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx
36 sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{
37 rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp
38 gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B
39 /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{
40 /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{
41 A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy
42 get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse}
43 ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp
44 fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17
45 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add
46 chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{
47 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop}
48 forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
49 /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
50 }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
51 bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
52 mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
53 SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
54 userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
55 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
56 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
57 /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{
58 /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT)
59 (LaserWriter 16/600)]{A length product length le{A length product exch 0
60 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse
61 end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask
62 grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot}
63 imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round
64 exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto
65 fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p
66 delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M}
67 B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{
68 p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S
69 rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
70
71 %%EndProcSet
72 %%BeginProcSet: 8r.enc
73 % @@psencodingfile@{
74 %   author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry",
75 %   version = "0.6",
76 %   date = "1 July 1998",
77 %   filename = "8r.enc",
78 %   email = "tex-fonts@@tug.org",
79 %   docstring = "Encoding for TrueType or Type 1 fonts
80 %                to be used with TeX."
81 % @}
82
83 % Idea is to have all the characters normally included in Type 1 fonts
84 % available for typesetting. This is effectively the characters in Adobe
85 % Standard Encoding + ISO Latin 1 + extra characters from Lucida.
86
87 % Character code assignments were made as follows:
88
89 % (1) the Windows ANSI characters are almost all in their Windows ANSI
90 % positions, because some Windows users cannot easily reencode the
91 % fonts, and it makes no difference on other systems. The only Windows
92 % ANSI characters not available are those that make no sense for
93 % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen
94 % (173). quotesingle and grave are moved just because it's such an
95 % irritation not having them in TeX positions.
96
97 % (2) Remaining characters are assigned arbitrarily to the lower part
98 % of the range, avoiding 0, 10 and 13 in case we meet dumb software.
99
100 % (3) Y&Y Lucida Bright includes some extra text characters; in the
101 % hopes that other PostScript fonts, perhaps created for public
102 % consumption, will include them, they are included starting at 0x12.
103
104 % (4) Remaining positions left undefined are for use in (hopefully)
105 % upward-compatible revisions, if someday more characters are generally
106 % available.
107
108 % (5) hyphen appears twice for compatibility with both 
109 % ASCII and Windows.
110
111 /TeXBase1Encoding [
112 % 0x00 (encoded characters from Adobe Standard not in Windows 3.1)
113   /.notdef /dotaccent /fi /fl
114   /fraction /hungarumlaut /Lslash /lslash
115   /ogonek /ring /.notdef
116   /breve /minus /.notdef 
117 % These are the only two remaining unencoded characters, so may as
118 % well include them.
119   /Zcaron /zcaron 
120 % 0x10
121  /caron /dotlessi 
122 % (unusual TeX characters available in, e.g., Lucida Bright)
123  /dotlessj /ff /ffi /ffl 
124  /.notdef /.notdef /.notdef /.notdef
125  /.notdef /.notdef /.notdef /.notdef
126  % very contentious; it's so painful not having quoteleft and quoteright
127  % at 96 and 145 that we move the things normally found there to here.
128  /grave /quotesingle 
129 % 0x20 (ASCII begins)
130  /space /exclam /quotedbl /numbersign
131  /dollar /percent /ampersand /quoteright
132  /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
133 % 0x30
134  /zero /one /two /three /four /five /six /seven
135  /eight /nine /colon /semicolon /less /equal /greater /question
136 % 0x40
137  /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O
138 % 0x50
139  /P /Q /R /S /T /U /V /W
140  /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
141 % 0x60
142  /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o
143 % 0x70
144  /p /q /r /s /t /u /v /w
145  /x /y /z /braceleft /bar /braceright /asciitilde
146  /.notdef % rubout; ASCII ends
147 % 0x80
148  /.notdef /.notdef /quotesinglbase /florin
149  /quotedblbase /ellipsis /dagger /daggerdbl
150  /circumflex /perthousand /Scaron /guilsinglleft
151  /OE /.notdef /.notdef /.notdef
152 % 0x90
153  /.notdef /.notdef /.notdef /quotedblleft
154  /quotedblright /bullet /endash /emdash
155  /tilde /trademark /scaron /guilsinglright
156  /oe /.notdef /.notdef /Ydieresis
157 % 0xA0
158  /.notdef % nobreakspace
159  /exclamdown /cent /sterling
160  /currency /yen /brokenbar /section
161  /dieresis /copyright /ordfeminine /guillemotleft
162  /logicalnot
163  /hyphen % Y&Y (also at 45); Windows' softhyphen
164  /registered
165  /macron
166 % 0xD0
167  /degree /plusminus /twosuperior /threesuperior
168  /acute /mu /paragraph /periodcentered
169  /cedilla /onesuperior /ordmasculine /guillemotright
170  /onequarter /onehalf /threequarters /questiondown
171 % 0xC0
172  /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
173  /Egrave /Eacute /Ecircumflex /Edieresis
174  /Igrave /Iacute /Icircumflex /Idieresis
175 % 0xD0
176  /Eth /Ntilde /Ograve /Oacute
177  /Ocircumflex /Otilde /Odieresis /multiply
178  /Oslash /Ugrave /Uacute /Ucircumflex
179  /Udieresis /Yacute /Thorn /germandbls
180 % 0xE0
181  /agrave /aacute /acircumflex /atilde
182  /adieresis /aring /ae /ccedilla
183  /egrave /eacute /ecircumflex /edieresis
184  /igrave /iacute /icircumflex /idieresis
185 % 0xF0
186  /eth /ntilde /ograve /oacute
187  /ocircumflex /otilde /odieresis /divide
188  /oslash /ugrave /uacute /ucircumflex
189  /udieresis /yacute /thorn /ydieresis
190 ] def
191
192 %%EndProcSet
193 %%BeginProcSet: texps.pro
194 %!
195 TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2
196 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll
197 exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics
198 exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub
199 dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}
200 ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict
201 end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{
202 dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1
203 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def
204 dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}
205 if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}
206 def end
207
208 %%EndProcSet
209 %%BeginProcSet: special.pro
210 %!
211 TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N
212 /vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N
213 /rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N
214 /@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{
215 /hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho
216 X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B
217 /@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{
218 /urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known
219 {userdict/md get type/dicttype eq{userdict begin md length 10 add md
220 maxlength ge{/md md dup length 20 add dict copy def}if end md begin
221 /letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S
222 atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{
223 itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll
224 transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll
225 curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf
226 pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}
227 if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1
228 -1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3
229 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip
230 yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub
231 neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{
232 noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop
233 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get
234 neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr
235 1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr
236 2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4
237 -1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S
238 TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{
239 Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale
240 }if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState
241 save N userdict maxlength dict begin/magscale true def normalscale
242 currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts
243 /psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x
244 psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx
245 psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub
246 TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{
247 psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2
248 roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath
249 moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict
250 begin/SpecialSave save N gsave normalscale currentpoint TR
251 @SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{
252 CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
253 closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx
254 sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR
255 }{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse
256 CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury
257 lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N
258 /@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end}
259 repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N
260 /@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX
261 currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY
262 moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X
263 /yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0
264 1 startangle endangle arc savematrix setmatrix}N end
265
266 %%EndProcSet
267 %%BeginProcSet: color.pro
268 %!
269 TeXDict begin/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop
270 setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll
271 }repeat setrgbcolor pop}ifelse}B}ifelse/TeXcolorcmyk{setcmykcolor}def
272 /TeXcolorrgb{setrgbcolor}def/TeXcolorgrey{setgray}def/TeXcolorgray{
273 setgray}def/TeXcolorhsb{sethsbcolor}def/currentcmykcolor where{pop}{
274 /currentcmykcolor{currentrgbcolor 10}B}ifelse/DC{exch dup userdict exch
275 known{pop pop}{X}ifelse}B/GreenYellow{0.15 0 0.69 0 setcmykcolor}DC
276 /Yellow{0 0 1 0 setcmykcolor}DC/Goldenrod{0 0.10 0.84 0 setcmykcolor}DC
277 /Dandelion{0 0.29 0.84 0 setcmykcolor}DC/Apricot{0 0.32 0.52 0
278 setcmykcolor}DC/Peach{0 0.50 0.70 0 setcmykcolor}DC/Melon{0 0.46 0.50 0
279 setcmykcolor}DC/YellowOrange{0 0.42 1 0 setcmykcolor}DC/Orange{0 0.61
280 0.87 0 setcmykcolor}DC/BurntOrange{0 0.51 1 0 setcmykcolor}DC
281 /Bittersweet{0 0.75 1 0.24 setcmykcolor}DC/RedOrange{0 0.77 0.87 0
282 setcmykcolor}DC/Mahogany{0 0.85 0.87 0.35 setcmykcolor}DC/Maroon{0 0.87
283 0.68 0.32 setcmykcolor}DC/BrickRed{0 0.89 0.94 0.28 setcmykcolor}DC/Red{
284 0 1 1 0 setcmykcolor}DC/OrangeRed{0 1 0.50 0 setcmykcolor}DC/RubineRed{
285 0 1 0.13 0 setcmykcolor}DC/WildStrawberry{0 0.96 0.39 0 setcmykcolor}DC
286 /Salmon{0 0.53 0.38 0 setcmykcolor}DC/CarnationPink{0 0.63 0 0
287 setcmykcolor}DC/Magenta{0 1 0 0 setcmykcolor}DC/VioletRed{0 0.81 0 0
288 setcmykcolor}DC/Rhodamine{0 0.82 0 0 setcmykcolor}DC/Mulberry{0.34 0.90
289 0 0.02 setcmykcolor}DC/RedViolet{0.07 0.90 0 0.34 setcmykcolor}DC
290 /Fuchsia{0.47 0.91 0 0.08 setcmykcolor}DC/Lavender{0 0.48 0 0
291 setcmykcolor}DC/Thistle{0.12 0.59 0 0 setcmykcolor}DC/Orchid{0.32 0.64 0
292 0 setcmykcolor}DC/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}DC/Purple{
293 0.45 0.86 0 0 setcmykcolor}DC/Plum{0.50 1 0 0 setcmykcolor}DC/Violet{
294 0.79 0.88 0 0 setcmykcolor}DC/RoyalPurple{0.75 0.90 0 0 setcmykcolor}DC
295 /BlueViolet{0.86 0.91 0 0.04 setcmykcolor}DC/Periwinkle{0.57 0.55 0 0
296 setcmykcolor}DC/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}DC
297 /CornflowerBlue{0.65 0.13 0 0 setcmykcolor}DC/MidnightBlue{0.98 0.13 0
298 0.43 setcmykcolor}DC/NavyBlue{0.94 0.54 0 0 setcmykcolor}DC/RoyalBlue{1
299 0.50 0 0 setcmykcolor}DC/Blue{1 1 0 0 setcmykcolor}DC/Cerulean{0.94 0.11
300 0 0 setcmykcolor}DC/Cyan{1 0 0 0 setcmykcolor}DC/ProcessBlue{0.96 0 0 0
301 setcmykcolor}DC/SkyBlue{0.62 0 0.12 0 setcmykcolor}DC/Turquoise{0.85 0
302 0.20 0 setcmykcolor}DC/TealBlue{0.86 0 0.34 0.02 setcmykcolor}DC
303 /Aquamarine{0.82 0 0.30 0 setcmykcolor}DC/BlueGreen{0.85 0 0.33 0
304 setcmykcolor}DC/Emerald{1 0 0.50 0 setcmykcolor}DC/JungleGreen{0.99 0
305 0.52 0 setcmykcolor}DC/SeaGreen{0.69 0 0.50 0 setcmykcolor}DC/Green{1 0
306 1 0 setcmykcolor}DC/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}DC
307 /PineGreen{0.92 0 0.59 0.25 setcmykcolor}DC/LimeGreen{0.50 0 1 0
308 setcmykcolor}DC/YellowGreen{0.44 0 0.74 0 setcmykcolor}DC/SpringGreen{
309 0.26 0 0.76 0 setcmykcolor}DC/OliveGreen{0.64 0 0.95 0.40 setcmykcolor}
310 DC/RawSienna{0 0.72 1 0.45 setcmykcolor}DC/Sepia{0 0.83 1 0.70
311 setcmykcolor}DC/Brown{0 0.81 1 0.60 setcmykcolor}DC/Tan{0.14 0.42 0.56 0
312 setcmykcolor}DC/Gray{0 0 0 0.50 setcmykcolor}DC/Black{0 0 0 1
313 setcmykcolor}DC/White{0 0 0 0 setcmykcolor}DC end
314
315 %%EndProcSet
316 TeXDict begin 40258431 52099146 1000 600 600 (pmt.dvi)
317 @start /Fa 165[37 43 1[56 43 43 37 33 40 43 33 43 43
318 53 37 43 23 20 43 43 33 37 43 40 40 43 65[{
319 TeXBase1Encoding ReEncodeFont}25 59.7758 /Times-Roman
320 rf /Fb 140[37 25 12[42 101[{TeXBase1Encoding ReEncodeFont}3
321 74.7198 /Helvetica rf
322 %DVIPSBitmapFont: Fc cmr10 10 2
323 /Fc 2 51 df<15301578B3A6007FB812F8B912FCA26C17F8C80078C8FCB3A6153036367B
324 AF41>43 D<EB0FF0EB7FFE48B57E3903E03FC03907000FE0000E6D7E00186D7E00386D7E
325 00308048130081007C80B41580A27FA36CC7FCA2121CC81300A25D5DA24A5AA24A5A5D4A
326 5A4A5A5D4AC7FC143E5C5C5C495A495A49C8FC130E49EB01805B5B491303491400485A48
327 C7FC00065C000FB6FC5A5A485CB6FCA321387CB72A>50 D E
328 %EndDVIPSBitmapFont
329 %DVIPSBitmapFont: Fd cmsy10 10 1
330 /Fd 1 3 df<0060150600F0150F6C151F007C153E6C157C6C15F86C6CEB01F06C6CEB03
331 E06C6CEB07C06C6CEB0F806C6CEB1F00017C133E6D5B6D5B90380F81F0903807C3E09038
332 03E7C06DB45A6D90C7FC147EA214FF497F903803E7C0903807C3E090380F81F049C67E01
333 3E137C497F497F4848EB0F804848EB07C04848EB03E04848EB01F048C812F8003E157C48
334 153E48151F48150F00601506282874A841>2 D E
335 %EndDVIPSBitmapFont
336 %DVIPSBitmapFont: Fe cmmi10 10 2
337 /Fe 2 79 df<1760177017F01601A21603A21607160FA24C7EA216331673166316C3A2ED
338 0183A2ED0303150683150C160115181530A21560A215C014011580DA03007FA202061300
339 140E140C5C021FB5FC5CA20260C7FC5C83495A8349C8FC1306A25BA25B13381330017016
340 80EA01F0D807F815FF267FFF80013F13FEB516FF18FE383C7DBB3E>65
341 D<902603FFF891381FFFF8495E6D6D80D90007030113006FEC007802061670814A6C1560
342 A26F7EA202186D5C151FA26F7E02304B5A6F7EA282DA60034AC7FCA26F7EA24A6C6C1306
343 A2828249485DEE3F80A217C049C7001F5B17E0160FA201066E6C5AA217F81603495EEE01
344 FCA2EE00FE495E17FF177FA2496F5AA2171F137095C8FC01F081EA07FC267FFFC080B56C
345 14064A140245397DB843>78 D E
346 %EndDVIPSBitmapFont
347 %DVIPSBitmapFont: Ff cmsy8 8 1
348 /Ff 1 3 df<006015C000E01401007014030078EC07806CEC0F006C141E6C5C6C6C5B6C
349 6C5B6C6C485A6C6C485A90387807806D48C7FCEB1E1E6D5AEB07F86D5A6D5A497E497EEB
350 0F3CEB1E1E497E496C7E496C7E48486C7E48486C7E4848137848C77E001E80488048EC07
351 800070EC03C048140100601400222376A137>2 D E
352 %EndDVIPSBitmapFont
353 /Fg 135[45 3[45 6[45 9[45 99[{TeXBase1Encoding ReEncodeFont}4
354 74.7198 /Courier-BoldOblique rf /Fh 135[40 40 2[40 40
355 2[40 40 40 40 40 40 40 40 40 40 1[40 1[40 1[40 12[40
356 1[40 1[40 40 40 4[40 1[40 25[40 45[{TeXBase1Encoding ReEncodeFont}25
357 66.4176 /Courier rf /Fi 133[45 45 1[45 45 45 45 45 45
358 1[45 45 45 1[45 2[45 45 1[45 45 45 45 1[45 1[45 59[45
359 35[{TeXBase1Encoding ReEncodeFont}21 74.7198 /Courier-Bold
360 rf /Fj 133[29 33 37 50 33 42 21 29 29 1[37 37 42 58 21
361 37 21 21 42 37 25 33 37 33 37 37 25 11[46 42 24[25 37
362 37 37 37 37 37 37 37 37 37 1[19 6[25 58 35[42 2[{
363 TeXBase1Encoding ReEncodeFont}43 74.7198 /Times-BoldItalic
364 rf /Fk 103[45 29[45 45 45 45 45 45 45 45 45 1[45 45 45
365 45 45 45 45 45 45 45 45 45 45 45 45 45 1[45 9[45 45 45
366 45 2[45 45 45 45 45 1[45 45 45 45 45 45 45 45 45 2[45
367 45 1[45 9[45 45 45 45 45 45 1[45 45 45 1[45 4[45 33[{
368 TeXBase1Encoding ReEncodeFont}59 74.7198 /Courier rf
369 /Fl 135[29 3[18 1[26 1[33 33 33 48 18 29 1[18 33 2[29
370 1[29 1[33 11[48 1[33 2[41 1[44 55 5[48 3[44 41 19[17
371 46[{TeXBase1Encoding ReEncodeFont}23 66.4176 /Times-Italic
372 rf /Fm 134[33 33 48 33 33 18 26 22 1[33 33 33 52 18 33
373 18 18 33 33 22 29 33 29 33 29 3[22 1[22 2[48 63 48 48
374 41 37 44 1[37 48 48 59 41 48 1[22 48 48 37 41 48 44 44
375 48 6[18 33 33 33 33 33 33 33 33 33 33 18 17 22 17 2[22
376 22 37[37 2[{TeXBase1Encoding ReEncodeFont}66 66.4176
377 /Times-Roman rf /Fn 134[33 33 48 33 37 22 26 29 1[37
378 33 37 55 18 1[22 18 37 33 22 29 37 29 37 33 12[44 37
379 2[41 52 8[41 4[48 6[22 33 33 3[33 33 33 33 33 1[17 4[22
380 22 40[{TeXBase1Encoding ReEncodeFont}40 66.4176 /Times-Bold
381 rf
382 %DVIPSBitmapFont: Fo cmsy9 9 4
383 /Fo 4 111 df<126012F812FEEA7F80EA1FE0EA07F8EA01FE38007F80EB1FE0EB07F8EB
384 01FE9038007FC0EC1FF0EC07FCEC01FF9138003FC0ED0FF0ED03FCED00FFEE3FC0EE0FF0
385 EE03FCEE00FEA2EE03FCEE0FF0EE3FC0EEFF00ED03FCED0FF0ED3FC003FFC7FCEC07FCEC
386 1FF0EC7FC04948C8FCEB07F8EB1FE0EB7F80D801FEC9FCEA07F8EA1FE0EA7F8000FECAFC
387 12F81260CBFCAC007FB712FCB812FEA26C16FC2F3E7AB03C>21 D<EC07E0143FECFE00EB
388 01F8EB03E0495A130F495AB3A649C7FCA2137E5BEA03F8EA7FE048C8FCEA7FE0EA03F8C6
389 7E137E7FA26D7EB3A66D7E13076D7EEB01F8EB00FEEC3FE014071B4B7BB726>102
390 D<127CEAFFC0EA07F0EA01F8EA007C7F133F6D7EB3A66D7EA26D7E6D7E6D7E9038007FC0
391 EC1FE0EC7FC0903801F800495A495A495AA2495AB3A649C7FC133E5B485AEA07F0EAFFC0
392 007CC8FC1B4B7BB726>I<126012F0A21278A37EA37EA37EA36C7EA36C7EA26C7EA36C7E
393 A31378A37FA37FA37FA36D7EA26D7EA36D7EA36D7EA31478A380A380A280A3EC0780A3EC
394 03C0A3EC01E0A3EC00F0A31578A215301D4B7CB726>110 D E
395 %EndDVIPSBitmapFont
396 /Fp 135[50 50 50 50 50 50 50 1[50 50 50 50 50 50 50 50
397 50 50 50 50 50 50 50 50 7[50 1[50 50 50 50 50 50 1[50
398 50 50 2[50 1[50 50 50 1[50 1[50 1[50 12[50 2[50 2[50
399 50 50 1[50 50 50 4[50 35[{TeXBase1Encoding ReEncodeFont}49
400 83.022 /Courier rf /Fq 133[37 3[42 1[28 32 3[42 5[23
401 3[37 46 21[60 78 18[28 8[42 5[47 42 28 28 40[{
402 TeXBase1Encoding ReEncodeFont}16 83.022 /Times-Bold rf
403 /Fr 133[32 37 37 55 37 42 23 32 32 1[42 42 42 60 23 37
404 1[23 42 42 23 37 42 37 42 42 8[51 1[51 60 46 42 51 1[51
405 60 55 69 46 2[28 1[60 51 51 60 55 51 51 3[56 2[28 42
406 42 1[42 42 42 1[42 42 1[23 21 28 42[42 2[{TeXBase1Encoding ReEncodeFont}
407 56 83.022 /Times-Italic rf /Fs 134[60 3[66 40 47 53 1[66
408 60 66 100 33 2[33 2[40 53 66 53 66 60 14[86 1[73 6[47
409 7[86 13[60 60 60 49[{TeXBase1Encoding ReEncodeFont}24
410 119.552 /Times-Bold rf /Ft 134[42 1[58 1[46 1[42 29 2[46
411 46 1[21 2[21 46 46 1[42 46 1[46 17[50 4[54 16[25 58[{
412 TeXBase1Encoding ReEncodeFont}17 74.7198 /Helvetica-Bold
413 rf /Fu 134[33 33 50 33 37 21 29 29 37 37 37 37 54 21
414 33 1[21 37 37 21 33 37 33 37 37 8[46 62 46 54 42 37 46
415 54 46 54 50 62 42 2[25 1[54 46 46 54 50 46 46 5[25 25
416 5[37 37 37 37 37 1[19 25 19 4[25 36[37 2[{TeXBase1Encoding ReEncodeFont}
417 57 74.7198 /Times-Italic rf /Fv 133[33 37 37 54 37 37
418 21 29 25 37 37 37 37 58 21 37 21 21 37 37 25 33 37 33
419 37 33 3[25 1[25 2[54 71 54 54 46 42 50 54 42 54 54 66
420 46 54 29 25 54 54 42 46 54 50 50 54 5[21 21 37 37 37
421 37 37 37 37 37 37 37 21 19 25 19 42 1[25 25 25 58 34[42
422 42 2[{TeXBase1Encoding ReEncodeFont}75 74.7198 /Times-Roman
423 rf /Fw 134[37 37 1[37 42 25 29 33 1[42 37 42 62 21 42
424 1[21 42 37 1[33 42 33 42 37 9[75 54 1[50 42 2[46 58 54
425 71 50 2[29 1[58 1[50 54 54 1[54 18[19 46[{TeXBase1Encoding ReEncodeFont}
426 37 74.7198 /Times-Bold rf /Fx 104[83 42 1[37 37 24[37
427 42 42 60 42 42 23 32 28 42 42 42 42 65 23 42 23 23 42
428 42 28 37 42 37 42 37 3[28 1[28 2[60 78 60 60 51 46 55
429 1[46 60 60 74 51 60 1[28 60 60 46 51 60 55 55 60 76 37
430 4[23 42 42 42 42 42 42 42 42 42 42 23 21 28 21 2[28 28
431 28 5[28 29[46 46 2[{TeXBase1Encoding ReEncodeFont}77
432 83.022 /Times-Roman rf /Fy 87[33 49[44 50 28 39 39 3[50
433 4[28 50 2[44 1[44 1[50 11[72 55 6[83 35[33 33 40[{
434 TeXBase1Encoding ReEncodeFont}17 99.6264 /Times-Italic
435 rf /Fz 140[39 4[50 1[28 3[50 50 33 44 1[44 1[44 13[55
436 66 12[61 22[25 46[{TeXBase1Encoding ReEncodeFont}13 99.6264
437 /Times-Roman rf /FA 134[50 50 72 50 55 33 39 44 1[55
438 50 55 83 28 55 33 28 55 50 33 44 55 44 55 50 9[100 1[72
439 66 55 72 1[61 78 1[94 1[78 1[39 78 78 61 66 72 72 66
440 72 8[50 50 50 50 50 50 50 50 2[25 33 3[33 33 1[83 34[55
441 55 2[{TeXBase1Encoding ReEncodeFont}57 99.6264 /Times-Bold
442 rf /FB 138[96 57 1[76 2[86 96 1[48 2[48 96 86 1[76 96
443 1[96 86 16[105 2[163 77[{TeXBase1Encoding ReEncodeFont}15
444 172.188 /Times-Bold rf end
445 %%EndProlog
446 %%BeginSetup
447 %%Feature: *Resolution 600dpi
448 TeXDict begin
449 %%BeginPaperSize: Letter
450 letter
451 %%EndPaperSize
452
453 %%EndSetup
454 %%Page: 1 1
455 1 0 bop Black Black Black Black 1052 119 a FB(P)m(ortable)44
456 b(Multithr)m(eading)753 254 y FA(The)26 b(Signal)f(Stack)h(T)-7
457 b(rick)26 b(F)n(or)e(User)l(-Space)i(Thr)n(ead)h(Cr)n(eation)1567
458 472 y Fz(Ralf)e(S.)g(Engelschall)1148 595 y Fy(T)-9 b(ec)o(hnisc)o(he)
459 24 b(Univer)o(sit)1988 596 y(\250)1980 595 y(at)f(M)2172
460 596 y(\250)2164 595 y(unc)o(hen)h(\(TUM\))1109 718 y
461 Fx(rse@engelschall.com,)18 b(http://www)-5 b(.engelschall.com)p
462 Black Black 1811 999 a Fw(Abstract)p Black Black 208
463 1136 a Fv(This)23 b(paper)h(describes)g(a)g(pragmatic)g(b)o(ut)f
464 (portable)h(f)o(allback)h(approach)g(for)e(creating)h(and)h
465 (dispatching)f(between)h(the)e(machine)208 1227 y(conte)o(xts)c(of)g
466 (multiple)f(threads)h(of)g(e)o(x)o(ecution)h(on)f(Unix)g(systems)g
467 (that)f(lack)h(a)f(dedicated)i(user)o(-space)f(conte)o(xt)h(switching)f
468 (f)o(acility)-5 b(.)208 1318 y(Such)22 b(a)g(f)o(allback)h(approach)h
469 (for)f(implementing)g(machine)g(conte)o(xts)g(is)f(a)g(vital)g(part)h
470 (of)f(a)g(user)o(-space)h(multithreading)g(en)m(viron-)208
471 1410 y(ment,)g(if)e(it)h(has)h(to)f(achie)n(v)o(e)h(maximum)g
472 (portability)g(across)g(a)f(wide)g(range)h(of)g(Unix)f(\003a)o(v)o
473 (ors.)33 b(The)22 b(approach)i(is)e(entirely)g(based)208
474 1501 y(on)d(standard)h(Unix)g(system)f(f)o(acilities)g(and)h(ANSI-C)e
475 (language)i(features)g(and)g(especially)g(does)g(not)f(require)h(an)o
476 (y)f(assembly)h(code)208 1592 y(or)27 b(platform)h(speci\002c)f(tricks)
477 g(at)h(all.)48 b(The)27 b(most)h(interesting)g(issue)f(is)g(the)h
478 (technique)h(of)e(creating)h(the)g(machine)g(conte)o(xt)g(for)208
479 1684 y(threads,)18 b(which)g(this)f(paper)h(e)o(xplains)h(in)e(detail.)
480 23 b(The)17 b(described)i(approach)g(closely)f(follo)n(ws)g(the)g
481 (algorithm)g(as)f(implemented)i(by)208 1775 y(the)h(author)h(for)f(the)
482 g(popular)h(user)o(-space)g(multithreading)g(library)f
483 Fu(GNU)f(P)-6 b(ortable)21 b(Thr)m(eads)g Fv(\()p Fu(GNU)e(Pth)p
484 Fv(,)h([25)q(]\))f(which)i(this)f(w)o(ay)208 1866 y(quickly)f(gained)h
485 (the)f(status)g(of)g(one)g(of)g(the)g(most)g(portable)h(user)o(-space)f
486 (multithreading)h(libraries.)208 2007 y Ft(K)o(e)o(yw)o(or)o(ds:)e
487 Fv(portability)-5 b(,)15 b(multithreading,)i(Unix,)e(POSIX,)f(SUSv2,)h
488 (ANSI-C,)e(user)o(-space,)j(conte)o(xt)g(creation,)g(conte)o(xt)f
489 (switch-)208 2099 y(ing,)j(signal)i(handler)m(,)f(stack,)g(mak)o
490 (econte)o(xt,)h(switchconte)o(xt,)g(sigaltstack,)e(setjmp,)h(longjmp.)
491 208 2240 y Ft(Pub)o(lishing:)g Fv(Early)f(drafts)f(of)h(this)g(paper)g
492 (were)g(distrib)o(uted)g(with)f(the)h(GNU)g(Pth)f(distrib)o(ution.)22
493 b(The)c(\002nal)g(release)g(v)o(ersion)g(w)o(as)208 2331
494 y(published)i(on)f(the)g(USENIX)f(Annual)h(T)-5 b(echnical)20
495 b(Conference,)f(June)h(18-23,)g(2000,)f(San)g(Die)o(go,)g(California,)f
496 (USA.)0 2711 y Fs(1)119 b(Intr)n(oduction)0 2895 y FA(1.1)99
497 b(Multithr)n(eading)0 3052 y Fx(The)25 b(paradigm)d(of)j(programming)c
498 (with)k(multiple)g(threads)f(of)0 3152 y(e)o(x)o(ecution)c(\(aka)i
499 Fr(multithr)m(eading)p Fx(\))f(is)i(already)f(a)h(v)o(ery)e(old)h(one)0
500 3252 y(and)i(dates)g(back)g(to)g(the)h(decades)f(of)g(programming)c
501 (with)25 b Fr(co-)0 3351 y(r)l(outines)19 b Fx([2,)g(3].)25
502 b(P)o(aradoxically)-5 b(,)17 b(the)i(use)h(of)f(threads)g(on)g(Unix)0
503 3451 y(platforms)g(did)h(not)g(become)f(popular)f(until)i(the)g(early)g
504 (1990s.)0 3602 y FA(Multithr)n(eading)26 b(Adv)o(antages)0
505 3728 y Fx(Multithreading)31 b(can)i(pro)o(vide)f(man)o(y)g(bene\002ts)h
506 (for)g(applica-)0 3828 y(tions)26 b(\(good)f(runtime)g(concurrenc)o(y)
507 -5 b(,)24 b(parallel)i(programming)0 3927 y(techniques)j(can)h(be)g
508 (implemented)e(more)i(easily)-5 b(,)32 b(the)e(popu-)0
509 4027 y(lar)22 b(procedural)d(programming)f(style)k(can)f(be)h(combined)
510 d(with)0 4127 y(multiple)g(threads)f(of)h(e)o(x)o(ecution,)e
511 Fr(etc.)p Fx(\))24 b(b)n(ut)c(the)f(most)g(interest-)0
512 4226 y(ing)25 b(ones)g(are)g(usually)g(performance)d(gains)j(and)f
513 (reduced)g(re-)0 4326 y(source)17 b(consumption.)k(Because)d(in)g
514 (contrast)f(to)h(multiprocess)0 4425 y(applications,)e(multithreaded)f
515 (ones)i(usually)f(require)g(less)i(sys-)0 4525 y(tem)25
516 b(resources)f(\(mainly)g(memory\))e(and)j(their)f(internal)g(com-)0
517 4625 y(munication)33 b(part)i(can)g(le)n(v)o(erage)f(from)g(the)i
518 (shared)e(address)0 4724 y(space.)0 4876 y FA(Multithr)n(eading)26
519 b(and)g(A)n(pplications)0 5001 y Fx(Ne)n(v)o(ertheless)d(there)h(still)
520 h(e)o(xist)g(just)g(a)f(fe)n(w)h(real)f(applications)0
521 5101 y(in)35 b(the)f(free)g(softw)o(are)h(w)o(orld)f(that)g(use)h
522 (multithreading)d(for)0 5201 y(their)20 b(bene\002t,)g(although)f
523 (their)h(application)f(domains)h(are)g(pre-)0 5300 y(destined)32
524 b(for)f(multithreading.)59 b(F)o(or)32 b(instance,)j(the)d(popular)0
525 5400 y(Apache)38 b(webserv)o(er)g(as)i(of)f(v)o(ersion)f(1.3)h(still)h
526 (uses)g(a)f(pre-)2025 2895 y(forking)32 b(process)h(model)g(for)h
527 (serving)f(HTTP)h(requests,)i(al-)2025 2995 y(though)14
528 b(tw)o(o)i(e)o(xperiments)e(with)j(multithreaded)c(Apache)i(v)n(ari-)
529 2025 3095 y(ants)22 b(in)g(1996)e(\(with)i Fr(r)o(sthr)m(eads)g
530 Fx([27)n(]\))g(and)f(1998)f(\(with)i Fr(NSPR)2025 3194
531 y Fx([31)o(]\))37 b(already)f(sho)n(wed)g(great)h(performance)d
532 (boosts.)76 b(The)2025 3294 y(same)20 b(applies)g(to)h(man)o(y)e
533 (similar)h(applications.)2150 3401 y(The)h(reason)g(for)g(this)i
534 (restraint)e(mainly)g(is)i(that)f(for)f(a)h(long)2025
535 3500 y(time,)c(multithreading)e(f)o(acilities)j(under)d(Unix)i(were)g
536 (rare.)24 b(The)2025 3600 y(situation)f(became)f(better)h(after)f(some)
537 h(v)o(endors)f(lik)o(e)h Fr(Sun)f Fx(and)2025 3699 y
538 Fr(DEC)f Fx(incorporated)15 b(threading)h(f)o(acilities)j(into)f(their)
539 g(Unix)f(\003a-)2025 3799 y(v)n(ors)36 b(and)g Fr(POSIX)j
540 Fx(standardized)c(a)i(threading)e Fr(Application)2025
541 3899 y(Pr)l(o)o(gr)o(amming)18 b(Interface)g Fx(\(API\))h(\(aka)f
542 Fr(Pthr)m(eads)g Fx([1]\).)24 b(But)c(an)2025 3998 y(API)e(and)f(a)h
543 (fe)n(w)f(v)o(endor)f(implementations)f(are)j(not)f(enough)e(to)2025
544 4098 y(ful\002ll)29 b(the)g(portability)e(requirements)g(of)h(modern)f
545 (free)i(soft-)2025 4198 y(w)o(are)37 b(packages.)74 b(Here)37
546 b(stand-alone)f(and)g(really)h(portable)2025 4297 y(multithreading)18
547 b(en)m(vironments)f(are)j(needed.)2150 4404 y(The)49
548 b(author)g(collected)h(and)f(e)n(v)n(aluated)g(o)o(v)o(er)g(twenty)2025
549 4503 y(\(mostly)42 b(user)n(-space\))h(a)n(v)n(ailable)f
550 (multithreading)f(f)o(acilities)2025 4603 y(for)15 b(Unix)g(systems)h
551 (\(see)g(T)-7 b(able)16 b(1\),)g(b)n(ut)g(only)e(a)i(fe)n(w)g(of)f
552 (them)h(are)2025 4703 y(freely)27 b(a)n(v)n(ailable)g(and)g(sho)n(wed)g
553 (to)h(be)g(really)f(portable.)46 b(And)2025 4802 y(e)n(v)o(en)19
554 b(the)i(mostly)f(portable)f(ones)h(suf)n(fered)f(from)g(the)i(f)o(act)f
555 (that)2025 4902 y(the)o(y)31 b(partly)g(depend)f(on)h(assembly)g(code)g
556 (or)h(platform)e(spe-)2025 5001 y(ci\002c)e(tricks)f(usually)g(related)
557 g(to)h(the)f(creation)g(and)g(dispatch-)2025 5101 y(ing)d(of)h(the)g
558 (indi)n(vidual)e(threads.)38 b(This)25 b(means)f(that)h(the)g(num-)2025
559 5201 y(ber)c(of)h(platforms)f(the)o(y)g(support)f(is)j(limited)e(and)h
560 (applications)2025 5300 y(which)27 b(are)h(based)g(on)g(these)g(f)o
561 (acilities)h(are)f(only)f(portable)f(to)2025 5400 y(those)c(platforms.)
562 29 b(This)22 b(situation)f(is)i(not)f(satisf)o(actory)-5
563 b(,)21 b(so)h(ap-)p Black 1929 5700 a(1)p Black eop
564 %%Page: 2 2
565 2 1 bop Black Black 0 83 a Fx(plication)25 b(authors)g(still)j(a)n(v)n
566 (oid)d(the)i(use)f(of)g(multithreading)d(if)0 183 y(the)o(y)28
567 b(w)o(ant)g(to)h(\(or)f(ha)n(v)o(e)g(to\))g(achie)n(v)o(e)f(maximum)g
568 (portability)0 282 y(for)20 b(their)f(application.)125
569 387 y(A)25 b(pragmatic)e(and)h(mostly)g(portable)f(f)o(allback)h
570 (technique)0 486 y(for)d(implementing)f(user)n(-space)h(threads)g(can)h
571 (f)o(acilitate)g(wider)0 586 y(use)e(of)g(multithreading)e(in)i(free)g
572 (softw)o(are)g(applications.)0 750 y FA(Ingr)n(edients)26
573 b(of)f(a)g(Thr)n(ead)0 884 y Fx(A)h(Unix)f(process)f(has)i(man)o(y)e
574 (ingredients,)h(b)n(ut)g(the)g(most)h(im-)0 983 y(portant)k(ones)h(are)
575 h(its)g(memory)e(mapping)f(table,)34 b(the)e(signal)0
576 1083 y(dispatching)18 b(table,)h(the)g(signal)g(mask,)g(the)g(set)h(of)
577 f(\002le)h(descrip-)0 1183 y(tors)30 b(and)f(the)h(machine)e(conte)o
578 (xt.)52 b(The)29 b(machine)g(conte)o(xt)f(in)0 1282 y(turn)d(consists)i
579 (of)e(at)i(least)g(the)f(CPU)h(re)o(gisters)e(including)g(the)0
580 1382 y(program)18 b(counter)h(and)h(the)h(stack)f(pointer)-5
581 b(.)25 b(In)20 b(addition,)f(there)0 1482 y(can)28 b(be)f(light-weight)
582 g(processes)g(\(L)-6 b(WP\))28 b(or)f(threads,)i(which)0
583 1581 y(usually)g(share)g(all)h(attrib)n(utes)f(with)g(the)h(underlying)
584 c(\(hea)n(vy-)0 1681 y(weight\))19 b(process)h(e)o(xcept)f(for)h(the)g
585 (machine)f(conte)o(xt.)0 1845 y FA(K)n(er)o(nel-Space)25
586 b(vs.)31 b(User)l(-Space)0 1979 y Fx(Those)c(L)-6 b(WPs)28
587 b(or)f(threads,)h(on)e(a)i(Unix)f(platform)e(classically)0
588 2078 y(can)34 b(be)g(implemented)e(either)i(in)g(k)o(ernel-space)f(or)g
589 (in)i(user)n(-)0 2178 y(space.)76 b(When)38 b(implemented)d(in)j(k)o
590 (ernel-space,)h(one)e(usu-)0 2278 y(ally)22 b(calls)h(them)e(L)-6
591 b(WPs)23 b(or)e(k)o(ernel)g(threads,)h(otherwise)f(\(user)n(-)0
592 2377 y(space\))d(threads.)24 b(If)19 b(threads)f(are)h(implemented)d
593 (by)j(the)g(k)o(ernel,)0 2477 y(the)24 b(thread)g(conte)o(xt)f
594 (switches)h(are)h(performed)c(by)j(the)g(k)o(ernel)0
595 2576 y(without)17 b(notice)f(by)h(the)g(application,)f(similar)i(to)f
596 (the)h(dispatch-)0 2676 y(ing)33 b(of)g(processes.)64
597 b(If)33 b(threads)g(are)g(implemented)e(in)j(user)n(-)0
598 2776 y(space,)20 b(the)g(thread)f(conte)o(xt)g(switches)i(are)f
599 (performed)d(usually)0 2875 y(by)31 b(an)g(application)f(library)g
600 (without)h(notice)f(by)h(the)h(k)o(ernel.)0 2975 y(Additionally)-5
601 b(,)39 b(there)e(e)o(xist)h(hybrid)d(threading)h(approaches,)0
602 3075 y(where)28 b(typically)g(a)h(user)n(-space)g(library)e(binds)i
603 (one)f(or)g(more)0 3174 y(user)n(-space)19 b(threads)h(to)g(one)g(or)g
604 (more)f(k)o(ernel-space)g(L)-6 b(WPs.)0 3338 y FA(Thr)n(ead)27
605 b(Models)0 3472 y Fx(The)h(v)o(endor)d(threading)h(f)o(acilities)j
606 (under)d Fr(Sun)h(Solaris)p Fx(,)i Fr(IBM)0 3572 y(AIX)p
607 Fx(,)h Fr(DEC)h(T)-5 b(ru64)31 b Fx(\(formerly)d Fr(DIGIT)l(AL)i(UNIX)k
608 Fx(or)d Fr(OSF/1)p Fx(\))0 3671 y(and)20 b Fr(SGI)h(IRIX)i
609 Fx(use)e(a)h Fq(M:N)f Fx(mapping)e([21)o(,)i(30)o(],)g
610 Fr(i.e)o(.)p Fx(,)f Fq(M)i Fx(user)n(-)0 3771 y(space)33
611 b(threads)g(are)h(mapped)e(onto)g Fq(N)i Fx(k)o(ernel-space)e(L)-6
612 b(WPs.)0 3871 y(On)20 b(the)h(other)e(hand,)g Fr(LinuxThr)m(eads)g
613 Fx([29)o(])i(under)e Fr(GNU/Linux)0 3970 y Fx(uses)f(a)f
614 Fq(1:1)g Fx(mapping)e(and)i(pure)f(user)n(-space)h(implementations)0
615 4070 y(lik)o(e)k Fr(GNU)g(Pth)p Fx(,)f Fr(FSU)g(pthr)m(eads)f
616 Fx(or)i Fr(MIT)f(pthr)m(eads)p Fx(,)g Fr(etc.)26 b Fx(use)20
617 b(a)0 4170 y Fq(M:1)g Fx(mapping)f([25)n(,)i(22)o(,)f(23)o(].)125
618 4274 y(From)39 b(no)n(w)g(on)h(we)g(focus)g(on)f(such)h
619 Fq(M:1)g Fx(user)g(space)0 4374 y(threading)d(approaches,)42
620 b(where)c(one)h(or)f(more)h(user)g(space)0 4473 y(threads)16
621 b(are)g(implemented)f(inside)i(a)g(single)f(k)o(ernel)g(space)h(pro-)0
622 4573 y(cess.)24 b(The)15 b(e)o(x)o(ercise)f(is)i(to)g(implement)e(this)
623 i(by)e(using)h(standard-)0 4672 y(ized)20 b(Unix)g(system)g(and)g
624 (ANSI-C)g(language)f(f)o(acilities)i Fr(only)p Fx(.)0
625 4936 y FA(1.2)99 b(The)26 b(Exer)n(cise)0 5101 y Fx(As)d(we)g(ha)n(v)o
626 (e)f(mentioned,)e(a)j(thread)e(shares)i(its)g(state)g(with)g(the)0
627 5201 y(underlying)i(process)j(e)o(xcept)f(for)g(the)h(machine)f(conte)o
628 (xt.)46 b(So)0 5300 y(the)17 b(major)e(task)i(for)f(a)h(user)n(-space)f
629 (threading)e(system)j(is)g(to)g(cre-)0 5400 y(ate)k(and)e(dispatch)h
630 (those)g(machine)f(conte)o(xts.)2150 83 y(In)d(practice,)g(the)h
631 (second)f(major)g(task)h(it)g(has)g(to)g(do)f(is)i(to)f(en-)2025
632 183 y(sure)k(that)f(no)h(thread)f(by)g(accident)g(blocks)g(the)h(whole)
633 f(process)2025 282 y(\(and)25 b(thereby)f(all)i(other)f(threads\).)41
634 b(Instead)25 b(when)g(an)h(opera-)2025 382 y(tion)j(w)o(ould)f(block,)i
635 (the)f(threading)e(library)h(should)g(suspend)2025 482
636 y(only)19 b(the)g(e)o(x)o(ecution)e(of)i(the)g(current)g(thread)f(and)h
637 (in)g(the)h(mean-)2025 581 y(time)g(dispatch)f(the)h(remaining)e
638 (threads.)24 b(But)d(this)f(task)g(is)h(out-)2025 681
639 y(side)30 b(the)h(scope)e(of)h(this)h(paper)e(\(see)h([11)o(])h(for)e
640 (details)i(about)2025 780 y(this)24 b(task\).)33 b(W)-7
641 b(e)24 b(focus)f(only)f(on)h(the)g(aspect)g(of)g(machine)e(con-)2025
642 880 y(te)o(xt)f(handling.)2025 1112 y FA(1.3)99 b(The)26
643 b(Curse)g(of)e(P)n(ortability)2025 1267 y Fx(Our)18 b(goal)g(of)f(real)
644 i(portability)d(for)i(a)h(threading)d(system)i(causes)2025
645 1367 y(some)j(non-tri)n(vial)d(problems)i(which)g(ha)n(v)o(e)g(to)h(be)
646 g(solv)o(ed.)26 b(The)2025 1467 y(most)f(ob)o(vious)e(one)h(is)i(that)f
647 (dealing)f(with)h(machine)f(conte)o(xts)2025 1566 y(usually)33
648 b(suf)n(fers)g(from)f(portability)-5 b(,)35 b(because)d(it)j(is)f(a)g
649 (highly)2025 1666 y(CPU)18 b(dependent)d(task)i(for)f(which)g(not)h(e)n
650 (v)o(ery)e(Unix)i(\003a)n(v)n(or)g(pro-)2025 1766 y(vides)25
651 b(a)g(standardized)e(API.)i(Although)e(such)i(an)g(API)g(w)o(ould)2025
652 1865 y(be)f(not)h(too)f(hard)f(for)h(v)o(endors)f(to)i(pro)o(vide,)e
653 (because)h(in)h(prin-)2025 1965 y(ciple)d(it)h(is)g(just)g(a)g(matter)e
654 (of)h(switching)g(a)h(fe)n(w)f(CPU)h(re)o(gisters)2025
655 2064 y(\(mainly)c(the)h(program)e(counter)h(and)h(the)g(stack)g
656 (pointer\).)2025 2201 y FA(Assembly)k(Code)i(Consider)n(ed)g(Harmful)
657 2025 2319 y Fx(Additionally)-5 b(,)21 b(we)j(disallo)n(w)e(the)h(use)h
658 (of)e(an)o(y)g(assembly)h(solu-)2025 2418 y(tions)c(or)g(platform)e
659 (speci\002c)j(tricks,)f(because)f(then)h(the)g(thread-)2025
660 2518 y(ing)e(system)i(again)d(w)o(ould)h(be)h(only)f(semi-portable,)f
661 Fr(i.e)o(.)p Fx(,)i(it)h(can)2025 2617 y(be)e(ported)f(to)i
662 Fq(N)f Fx(platforms)f(b)n(ut)i(on)f(the)g Fq(\(N+1\))p
663 Fx(th)f(platform)g(one)2025 2717 y(has)28 b(to)g(manually)e(adjust)i
664 (or)f(e)n(v)o(en)g(e)o(xtend)f(it)i(to)g(w)o(ork)f(there,)2025
665 2817 y(too.)2150 2916 y(This)e(is)h(usually)f(not)g(acceptable,)h(e)n
666 (v)o(en)e(if)i(it)g(also)g(mak)o(es)2025 3016 y(solving)20
667 b(the)h(problems)f(harder)-5 b(.)26 b(At)c(least)f(most)g(of)g(the)g
668 (kno)n(wn)2025 3116 y(free)26 b(softw)o(are)g(user)n(-space)g
669 (threading)f(systems)i([22)o(,)f(23)o(,)h(24)o(])2025
670 3215 y(do)15 b(not)g(restrict)h(themself)e(to)i(this)g(and)f(therefore)
671 e(are)j(just)g(semi-)2025 3315 y(portable.)24 b(But)c(real)g
672 (portability)f(should)g(be)h(a)h(major)f(goal.)2025 3589
673 y Fs(2)119 b(Pr)n(oblem)30 b(Analysis)2025 3791 y FA(2.1)99
674 b(The)26 b(T)-9 b(ask)25 b(in)g(Detail)2025 3947 y Fx(Our)d(task)h(is)g
675 (simple)f(in)h(principle:)28 b(pro)o(vide)20 b(an)j(API)f(and)g(cor)n
676 (-)2025 4046 y(responding)f(implementation)f(for)j(creating)f(and)g
677 (dispatching)2025 4146 y(machine)15 b(conte)o(xts)g(on)h(which)g(user)n
678 (-space)g(threads)f(can)h(be)h(im-)2025 4246 y(plemented.)2025
679 4382 y FA(The)26 b(Pr)n(oposed)g(API)2025 4500 y Fx(In)18
680 b(detail)g(we)g(propose)f(the)h(follo)n(wing)e Fr(Application)g(Pr)l(o)
681 o(gr)o(am-)2025 4599 y(mer)o(s)21 b(Interface)f Fx(\(API\))g(for)f(the)
682 h(machine)f(conte)o(xt)g(handling:)p Black 2120 4749
683 50 50 v Black 2233 4749 a(A)25 b(data)g(structure)f(of)g(type)h
684 Fp(mctx)p 3266 4749 25 4 v 29 w(t)g Fx(which)f(holds)h(the)2233
685 4849 y(machine)19 b(conte)o(xt.)p Black 2120 5001 50
686 50 v Black 2233 5001 a(A)95 b(function)e(\223)p Fq(v)o(oid)h
687 Fp(mctx)p 3248 5001 25 4 v 29 w(create\(mctx)p 3827 5001
688 V 28 w(t)2233 5101 y(*)p Fr(mctx)p Fx(,)26 b Fq(v)o(oid)g
689 Fp(\(*)p Fr(sf)p 2825 5101 V 30 w(addr)r Fp(\)\()p Fq(v)o(oid)e(*)p
690 Fp(\),)i Fq(v)o(oid)g Fp(*)p Fr(sf)p 3742 5101 V 30 w(ar)m(g)p
691 Fx(,)2233 5201 y Fq(v)o(oid)c Fp(*)p Fr(sk)p 2531 5201
692 V 30 w(addr)p Fx(,)g Fq(size)p 2891 5201 V 30 w(t)h Fr(sk)p
693 3041 5201 V 30 w(size)p Fp(\))p Fx(\224)g(which)g(creates)f(and)2233
694 5300 y(initializes)17 b(a)h(machine)e(conte)o(xt)f(structure)h(in)i
695 Fr(mctx)f Fx(with)2233 5400 y(a)25 b(start)g(function)e
696 Fr(sf)p 2825 5400 V 31 w(addr)p Fx(,)i(a)g(start)h(function)d(ar)o
697 (gument)p Black 1929 5700 a(2)p Black eop
698 %%Page: 3 3
699 3 2 bop Black Black Black 0 3 3864 4 v 0 2441 4 2439
700 v 68 642 a Fw(P)o(ackage)553 642 y
701  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
702 exch translate
703  553 642 a Fw(Genesis)553
704 642 y
705  currentpoint grestore moveto
706  553 642 a 744 642 a
707  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
708 exch translate
709  744 642 a Fw(Latest)19 b(V)-7
710 b(ersion)744 642 y
711  currentpoint grestore moveto
712  744 642 a 1010 642 a
713  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
714 exch translate
715  1010 642 a Fw(Implementation)18
716 b(Space)1010 642 y
717  currentpoint grestore moveto
718  1010 642 a 1404 642 a
719  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
720 exch translate
721  1404 642 a Fw(Thr)o(ead)g
722 (Mapping)1404 642 y
723  currentpoint grestore moveto
724  1404 642 a 1562 642 a
725  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
726 exch translate
727  1562 642 a
728 Fw(Acti)o(v)o(e)h(De)o(v)o(elopment)1562 642 y
729  currentpoint grestore moveto
730  1562 642
731 a 1703 642 a
732  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
733 exch translate
734  1703 642 a Fw(Experimental)f(State)1703
735 642 y
736  currentpoint grestore moveto
737  1703 642 a 1844 642 a
738  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
739 exch translate
740  1844 642 a Fw(Open)g(Sour)o(ce)1844
741 642 y
742  currentpoint grestore moveto
743  1844 642 a 1985 642 a
744  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
745 exch translate
746  1985 642 a Fw(Pthr)o(ead)g(API)1985
747 642 y
748  currentpoint grestore moveto
749  1985 642 a 2126 642 a
750  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
751 exch translate
752  2126 642 a Fw(Pthr)o(ead)g(Shar)o(ed)g
753 (Memory)2126 642 y
754  currentpoint grestore moveto
755  2126 642 a 2267 642 a
756  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
757 exch translate
758  2267 642 a Fw(Nati)o(v)o(e)i
759 (API)2267 642 y
760  currentpoint grestore moveto
761  2267 642 a 2408 642 a
762  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
763 exch translate
764  2408 642 a Fw(Nati)o(v)o(e)g(API)
765 e Fo(\025)h Fw(Pthr)o(ead)f(API)2408 642 y
766  currentpoint grestore moveto
767  2408 642 a
768 2550 642 a
769  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
770 exch translate
771  2550 642 a Fw(Nati)o(v)o(e)h(API)g(is)f(Pthr)o(ead)g(API)
772 2550 642 y
773  currentpoint grestore moveto
774  2550 642 a 2765 642 a
775  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
776 exch translate
777  2765 642 a Fw(Pr)o(eempti)o(v)o(e)h
778 (Scheduling)2765 642 y
779  currentpoint grestore moveto
780  2765 642 a 2906 642 a
781  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
782 exch translate
783  2906 642
784 a Fw(P)o(ortability)2906 642 y
785  currentpoint grestore moveto
786  2906 642 a 3360 642 a
787  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
788 exch translate
789
790 3360 642 a Fw(Assembly)f(Code)3360 642 y
791  currentpoint grestore moveto
792  3360 642 a 3509
793 642 a
794  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
795 exch translate
796  3509 642 a Fw(SysCall)g(Wrap.)3509 642 y
797  currentpoint grestore moveto
798  3509 642
799 a 47 673 3658 4 v 68 737 a Fv(gnu-pth)254 b(1999)43 b(1.3.5)117
800 b(user)270 b(n:1)63 b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67
801 b(yes)42 b(yes)h(no)141 b(no)67 b(full/mcsc+sjlj)42 b(no)75
802 b(partly)68 820 y(cmu-l)o(wp)221 b(1984)43 b(1.4)173
803 b(user)270 b(n:1)63 b(yes)42 b(no)67 b(yes)42 b(no)67
804 b(-)116 b(yes)42 b(yes)h(partly)e(no)67 b(semi/\002x)o(ed:8)86
805 b(yes)50 b(no)68 903 y(fsu-pthread)146 b(1992)43 b(3.13)136
806 b(user)270 b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67
807 b(no)g(-)117 b(-)190 b(yes)42 b(semi/\002x)o(ed:6)86
808 b(yes)50 b(yes)68 986 y(mit-pthread)137 b(1993)43 b(1.8.9)117
809 b(user)270 b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67
810 b(no)g(-)117 b(-)190 b(yes)42 b(semi/\002x)o(ed:17)49
811 b(yes)h(yes)68 1069 y(ptl)406 b(1997)43 b(990622)h(user)270
812 b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67 b(no)g(-)117
813 b(-)190 b(yes)42 b(semi/\002x)o(ed:10)49 b(yes)h(yes)68
814 1152 y(linuxthreads)117 b(1997)43 b(2.1.2)117 b(user+k)o(ernel)43
815 b(1:1)63 b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67 b(no)g(-)117
816 b(-)190 b(yes)42 b(semi/\002x)o(ed:5)86 b(yes)50 b(yes)68
817 1235 y(uthread)262 b(1998)43 b(3.4)173 b(user)270 b(n:1)63
818 b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67 b(no)g(-)117
819 b(-)190 b(yes)42 b(semi/\002x)o(ed:2)86 b(yes)50 b(yes)68
820 1318 y(cthread)266 b(1991)43 b(991115)h(user)270 b(n:1)63
821 b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(yes)h(no)141
822 b(no)67 b(semi/\002x)o(ed:8)86 b(yes)50 b(yes)68 1401
823 y(openthreads/qt)d(1996)c(2.0)173 b(user)270 b(n:1)63
824 b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(no)68 b(no)141
825 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68 1484
826 y(rt++/qt)276 b(1996)43 b(1.0)173 b(user)270 b(n:1)63
827 b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(yes)h(no)141
828 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68 1567
829 y(rsthreads)216 b(1996)43 b(980331)h(user)270 b(n:1)63
830 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42 b(no)68
831 b(no)141 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68
832 1650 y(pcthread)229 b(1996)43 b(1.0)173 b(user)270 b(n:1)63
833 b(no)k(yes)42 b(yes)g(yes)g(no)67 b(no)g(-)117 b(-)190
834 b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50 b(no)68 1733
835 y(bbthreads)196 b(1996)43 b(0.3)173 b(k)o(ernel)209 b(1:1)63
836 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42 b(no)68
837 b(-)190 b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50 b(no)68
838 1816 y(jkthreads)212 b(1998)43 b(1.2)173 b(k)o(ernel)209
839 b(1:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
840 b(no)68 b(-)190 b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50
841 b(no)68 1899 y(nthreads)233 b(1997)43 b(970604)h(user)270
842 b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
843 b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50
844 b(partly)68 1982 y(re)o(xthreads)176 b(1993)43 b(930614)h(user)270
845 b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
846 b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:4)86 b(yes)50
847 b(no)68 2065 y(coro)353 b(1999)43 b(1.0.3)117 b(user)270
848 b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
849 b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:1)86 b(yes)50
850 b(no)68 2148 y(greenthreads)105 b(1995)43 b(1.2)173 b(user)270
851 b(n:1)63 b(no)k(no)g(no)g(no)g(-)116 b(yes)42 b(yes)h(-)190
852 b(yes)42 b(full/mcsc)176 b(no)75 b(no)68 2231 y(solaris-pthread)42
853 b(NN)83 b(2.7)173 b(user+k)o(ernel)43 b(n:m)f(yes)g(no)67
854 b(no)g(yes)42 b(yes)g(yes)g(yes)h(no)141 b(yes)42 b(NN)346
855 b(NN)41 b(yes)68 2314 y(tru64-pthread)80 b(NN)j(5.0)173
856 b(user+k)o(ernel)43 b(n:m)f(yes)g(no)67 b(no)g(yes)42
857 b(yes)g(no)67 b(no)h(no)141 b(yes)42 b(NN)346 b(NN)41
858 b(yes)68 2397 y(aix-pthread)146 b(NN)83 b(4.3)173 b(user+k)o(ernel)43
859 b(1:1)63 b(yes)42 b(no)67 b(no)g(yes)42 b(yes)g(no)67
860 b(no)h(no)141 b(yes)42 b(NN)346 b(NN)41 b(yes)p 3860
861 2441 4 2439 v 0 2444 3864 4 v 0 2532 a Fn(T)-6 b(able)18
862 b(1:)67 b Fm(Summary)20 b(of)h(e)n(v)n(aluated)j(multithreading)g
863 (packages)f(and)e(some)g(of)f(their)i(determined)h(characteristics.)36
864 b(Notice)22 b(that)g(mostly)f(all)h(packages)g(contain)295
865 2600 y(assembly)17 b(code)h(and)g(are)g(just)f(semi-portable,)j
866 Fl(i.e)o(.)p Fm(,)c(the)o(y)i(support)g(only)g(a)f(\002x)o(ed)g(set)g
867 (of)g(platforms)i(and)e(do)g(not)h(automatically)j(adjust)d(for)f(ne)n
868 (w)h(ones.)p Black 208 2864 a Fr(sf)p 268 2864 25 4 v
869 30 w(ar)m(g)p Fx(,)36 b(and)d(a)h(stack)f(starting)g(at)h
870 Fr(sk)p 1343 2864 V 30 w(addr)p Fx(,)i(which)d(is)208
871 2963 y Fr(sk)p 282 2963 V 30 w(size)21 b Fx(bytes)f(in)g(size.)p
872 Black 95 3115 50 50 v Black 208 3115 a(A)i(function)f(\223)p
873 Fq(v)o(oid)h Fp(mctx)p 1006 3115 25 4 v 30 w(save\(mctx)p
874 1486 3115 V 28 w(t)h(*)p Fr(mctx)p Fp(\))p Fx(\224)208
875 3215 y(which)j(sa)n(v)o(es)i(the)g(current)e(machine)g(conte)o(xt)g
876 (into)i(the)208 3314 y(machine)19 b(conte)o(xt)g(structure)g
877 Fr(mctx)p Fx(.)p Black 95 3466 50 50 v Black 208 3466
878 a(A)78 b(function)e(\223)p Fq(v)o(oid)i Fp(mctx)p 1173
879 3466 25 4 v 30 w(restore\(mctx)p 1803 3466 V 27 w(t)208
880 3566 y(*)p Fr(mctx)p Fp(\))p Fx(\224)40 b(which)g(restores)g(the)h(ne)n
881 (w)f(machine)f(con-)208 3666 y(te)o(xt)18 b(from)g(the)h(machine)e
882 (conte)o(xt)h(structure)g Fr(mctx)p Fx(.)24 b(This)208
883 3765 y(function)29 b(does)i(not)g(return)f(to)h(the)h(caller)-5
884 b(.)58 b(Instead)31 b(it)208 3865 y(does)18 b(return)g(at)i(the)f
885 (location)g(stored)f(in)i Fr(mctx)f Fx(\(which)g(is)208
886 3964 y(either)d Fr(sf)p 474 3964 V 30 w(addr)i Fx(from)e(a)h(pre)n
887 (vious)f Fp(mctx)p 1415 3964 V 29 w(create)g Fx(call)208
888 4064 y(or)j(the)i(location)e(of)h(a)g(pre)n(vious)f Fp(mctx)p
889 1365 4064 V 29 w(save)h Fx(call\).)p Black 95 4216 50
890 50 v Black 208 4216 a(A)95 b(function)e(\223)p Fq(v)o(oid)h
891 Fp(mctx)p 1223 4216 25 4 v 29 w(switch\(mctx)p 1802 4216
892 V 28 w(t)208 4316 y(*)p Fr(mctx)p 420 4316 V 29 w(old)p
893 Fx(,)19 b Fp(mctx)p 796 4316 V 29 w(t)h(*)p Fr(mctx)p
894 1102 4316 V 30 w(ne)o(w)p Fp(\))p Fx(\224)f(which)g(switches)208
895 4415 y(from)59 b(the)i(current)e(machine)g(conte)o(xt)h(\(sa)n(v)o(ed)f
896 (to)208 4515 y Fr(mctx)p 370 4515 V 29 w(old)28 b Fx(for)e(later)g
897 (use\))g(to)g(a)h(ne)n(w)f(conte)o(xt)f(\(restored)208
898 4615 y(from)c Fr(mctx)p 554 4615 V 30 w(ne)o(w)p Fx(\).)31
899 b(This)22 b(function)f(returns)g(only)h(to)h(the)208
900 4714 y(caller)39 b(if)h Fp(mctx)p 728 4714 V 30 w(restore)f
901 Fx(or)g Fp(mctx)p 1456 4714 V 29 w(switch)h Fx(is)208
902 4814 y(again)19 b(used)h(on)f Fr(mctx)p 846 4814 V 30
903 w(old)p Fx(.)0 5045 y FA(2.2)99 b(T)-9 b(echnical)26
904 b(P)n(ossibilities)0 5201 y Fx(Poking)18 b(around)f(in)i(the)f
905 (references)g(of)g(the)h(ANSI-C)g(language)0 5300 y(reference)36
906 b(and)i(the)g(Unix)f(standards)g(sho)n(w)h(the)g(follo)n(wing)0
907 5400 y(functions)19 b(on)h(which)f(an)h(implementation)e(can)i(be)g
908 (based:)p Black 2120 2864 50 50 v Black 2233 2864 a(There)55
909 b(is)h(the)g Fp(ucontext)p Fx(\(3\))e(f)o(acility)i(with)g(the)2233
910 2963 y(functions)34 b Fp(getcontext)p Fx(\(3\),)j Fp(makecontext)p
911 Fx(\(3\),)2233 3063 y Fp(swapcontext)p Fx(\(3\))31 b(and)j
912 Fp(setcontext)p Fx(\(3\))e(which)2233 3162 y(conform)21
913 b(to)j(the)g Fr(Single)f(Unix)h(Speci\002cation)p Fx(,)e(V)-9
914 b(ersion)2233 3262 y(2)38 b(\()p Fr(SUSv2)e Fx([20)o(],)42
915 b(aka)c Fr(Unix95/98)p Fx(\).)76 b(Unfortunately)2233
916 3362 y(these)16 b(are)g(a)n(v)n(ailable)f(on)h(modern)e(Unix)h
917 (platforms)g(only)-5 b(.)p Black 2120 3625 V Black 2233
918 3625 a(There)87 b(are)h(the)h Fp(jmp)p 3051 3625 25 4
919 v 29 w(buf)f Fx(based)g(functions)2233 3724 y Fp(setjmp)p
920 Fx(\(3\))29 b(and)h Fp(longjmp)p Fx(\(3\))f(which)i(conform)d(to)2233
921 3824 y(ISO)41 b(9899:1990)c(\(ISO-C\))k(and)f(the)h Fp(sigjmp)p
922 3727 3824 V 29 w(buf)2233 3924 y Fx(based)71 b Fp(sigsetjmp)p
923 Fx(\(3\))f(and)i Fp(siglongjmp)p Fx(\(3\))2233 4023 y(functions)17
924 b(which)h(conform)f(to)i(IEEE)f(Std1003.1-1988)2233 4123
925 y(\()p Fr(POSIX)t Fx(\),)f(and)j Fr(Single)f(Unix)h(Speci\002cation)p
926 Fx(,)d(V)-9 b(ersion)19 b(2)2233 4222 y(\()p Fr(SUSv2)j
927 Fx([20)o(],)j(aka)f Fr(Unix95/98)p Fx(\).)35 b(The)24
928 b(\002rst)h(tw)o(o)g(func-)2233 4322 y(tions)17 b(are)h(a)n(v)n
929 (ailable)f(really)h(on)f(all)h(Unix)g(platforms,)f(the)2233
930 4422 y(last)k(tw)o(o)f(are)g(a)n(v)n(ailable)g(only)f(on)h(some)g(of)g
931 (them.)2233 4603 y(On)h(some)h(platforms)e Fp(setjmp)p
932 Fx(\(3\))g(and)i Fp(longjmp)p Fx(\(3\))2233 4703 y(sa)n(v)o(e)45
933 b(and)h(restore)f(also)h(the)f(signal)h(mask)f(\(if)h(one)2233
934 4802 y(does)e(not)g(w)o(ant)g(this)h(semantics,)50 b(one)44
935 b(has)h(to)f(call)p 2233 4902 V 2257 4902 a Fp(setjmp)p
936 Fx(\(3\))36 b(and)p 2854 4902 V 67 w Fp(longjmp)p Fx(\(3\))g(there\))g
937 (while)i(on)2233 5001 y(others)23 b(one)h(has)g(to)g(e)o(xplicitly)g
938 (use)g(the)g(superset)g(func-)2233 5101 y(tions)36 b
939 Fp(sigsetjmp)p Fx(\(3\))f(and)h Fp(siglongjmp)p Fx(\(3\))e(for)2233
940 5201 y(this.)115 b(In)50 b(our)f(discussion)h(we)g(can)g(assume)g(that)
941 2233 5300 y Fp(setjmp)p Fx(\(3\))40 b(and)j Fp(longjmp)p
942 Fx(\(3\))d(sa)n(v)o(e)j(and)f(restore)2233 5400 y(the)36
943 b(signal)f(mask,)40 b(because)35 b(if)h(this)h(is)g(not)e(the)h(case)p
944 Black 1929 5700 a(3)p Black eop
945 %%Page: 4 4
946 4 3 bop Black Black 208 83 a Fx(in)46 b(practice,)53
947 b(one)46 b(easily)h(can)f(replace)g(them)g(with)208 183
948 y Fp(sigsetjmp)p Fx(\(3\))41 b(and)i Fp(siglongjmp)p
949 Fx(\(3\))e(calls)k(\(if)208 282 y(a)n(v)n(ailable\))30
950 b(or)h(\(if)g(not)g(a)n(v)n(ailable\))f(emulate)h(the)g(miss-)208
951 382 y(ing)d(functionality)g(manually)f(with)j(additional)e
952 Fp(sig-)208 482 y(procmask)p Fx(\(2\))j(calls)i(\(see)h
953 Fp(pth)p 1245 482 25 4 v 29 w(mctx.c)f Fx(in)g Fr(GNU)208
954 581 y(Pth)20 b Fx([25)n(]\).)p Black 95 739 50 50 v Black
955 208 739 a(There)37 b(is)i(the)f(function)e Fp(sigaltstack)p
956 Fx(\(2\))f(which)208 839 y(conforms)f(to)j(the)g Fr(Single)f(Unix)h
957 (Speci\002cation)p Fx(,)h(V)-9 b(er)n(-)208 938 y(sion)34
958 b(2)g(\()p Fr(SUSv2)f Fx([20)n(],)38 b(aka)c Fr(Unix95/98)p
959 Fx(\))e(and)i(its)h(an-)208 1038 y(cestor)25 b(function)f
960 Fp(sigstack)p Fx(\(2\))f(from)h Fr(4.2BSD)p Fx(.)g(The)208
961 1137 y(last)d(one)e(e)o(xists)i(only)e(on)h Fr(BSD)p
962 Fx(-deri)n(v)o(ed)d(platforms,)i(b)n(ut)208 1237 y(the)g(\002rst)h
963 (function)e(already)h(e)o(xists)h(on)f(all)h(current)e(Unix)208
964 1337 y(platforms.)0 1571 y FA(2.3)99 b(Maximum)25 b(P)n(ortability)f
965 (Solution)0 1726 y Fx(The)44 b(maximum)e(portable)h(solution)g(ob)o
966 (viously)f(is)j(to)f(use)0 1826 y(the)j(standardized)f
967 Fp(makecontext)p Fx(\(3\))e(function)i(to)h(cre-)0 1926
968 y(ate)k(threads)f(and)g Fp(switchcontext)p Fx(\(3\))e(or)i
969 Fp(getcon-)0 2025 y(text)p Fx(\(3\)/)p Fp(setcontext)p
970 Fx(\(3\))18 b(to)23 b(dispatch)e(them.)31 b(And)22 b(actu-)0
971 2125 y(ally)h(these)f(are)h(the)f(preferred)f(functions)g(modern)f
972 (user)n(-space)0 2224 y(multithreading)25 b(systems)k(are)e(using.)48
973 b(W)-7 b(e)29 b(could)e(easily)h(im-)0 2324 y(plement)20
974 b(our)g(proposed)f(API)i(as)g(follo)n(wing)e(\(all)i(error)f(checks)0
975 2424 y(omitted)f(for)h(better)g(readability\):)p Black
976 Black 0 2561 a Fk(/*)63 b Fj(mac)o(hine)19 b(context)g(data)g
977 (structure)44 b Fk(*/)0 2635 y Fi(typedef)g(struct)f
978 Fk(mctx_st)h Fo(f)179 2710 y Fk(ucontext_t)f(uc;)0 2785
979 y Fo(g)i Fk(mctx_t;)0 2934 y(/*)63 b Fj(sav)o(e)20 b(mac)o(hine)e
980 (context)45 b Fk(*/)0 3009 y Fi(#define)f Fk(mctx_save\(mctx\))e
981 Fo(n)179 3084 y Fk(\()p Fi(void)p Fk(\)getcontext\(&\(mctx\)->uc\))0
982 3233 y(/*)63 b Fj(restore)20 b(mac)o(hine)e(context)45
983 b Fk(*/)0 3308 y Fi(#define)f Fk(mctx_restore\(mctx\))d
984 Fo(n)179 3383 y Fk(\()p Fi(void)p Fk(\)setcontext\(&\(mctx\)->uc\))0
985 3532 y(/*)63 b Fj(switc)o(h)18 b(mac)o(hine)h(context)45
986 b Fk(*/)0 3607 y Fi(#define)f Fk(mctx_switch\(mctx_old,mctx_new\))39
987 b Fo(n)179 3681 y Fk(\()p Fi(void)p Fk
988 (\)swapcontext\(&\(\(mctx_old\)->uc\),)g Fo(n)986 3756
989 y Fk(&\(\(mctx_new\)->uc\)\))0 3906 y(/*)63 b Fj(create)20
990 b(mac)o(hine)e(context)45 b Fk(*/)0 3980 y Fi(void)f
991 Fk(mctx_create\()179 4055 y(mctx_t)g(*mctx,)179 4130
992 y Fi(void)g Fk(\(*sf_addr\)\()p Fi(void)f Fk(*\),)h Fi(void)g
993 Fk(*sf_arg,)179 4204 y Fi(void)g Fk(*sk_addr,)g(size_t)g(sk_size\))0
994 4279 y Fo(f)179 4429 y Fk(/*)64 b Fj(f)o(etc)o(h)18 b(current)g
995 (context)45 b Fk(*/)179 4503 y(getcontext\(&\(mctx->uc\)\);)179
996 4653 y(/*)64 b Fj(adjust)18 b(to)h(new)f(context)45 b
997 Fk(*/)179 4728 y(mctx->uc.uc_link)491 b(=)44 b(NULL;)179
998 4802 y(mctx->uc.uc_stack.ss_sp)176 b(=)44 b(sk_addr;)179
999 4877 y(mctx->uc.uc_stack.ss_size)86 b(=)44 b(sk_size;)179
1000 4952 y(mctx->uc.uc_stack.ss_flags)d(=)j(0;)179 5101 y(/*)64
1001 b Fj(mak)n(e)19 b(new)f(context)45 b Fk(*/)179 5176 y
1002 (makecontext\(&\(mctx->uc\),)717 5251 y(sf_addr,)f(1,)g(sf_arg\);)179
1003 5325 y Fi(return)p Fk(;)0 5400 y Fo(g)2025 83 y Fx(Unfortunately)14
1004 b(there)j(are)g(still)h(lots)g(of)f(Unix)f(platforms)g(where)2025
1005 183 y(this)43 b(approach)d(cannot)h(be)h(used,)47 b(because)42
1006 b(the)g(standard-)2025 282 y(ized)e Fp(ucontext)p Fx(\(3\))d(API)j(is)g
1007 (not)g(pro)o(vided)d(by)i(the)h(v)o(en-)2025 382 y(dor)-5
1008 b(.)80 b(Actually)38 b(the)h(platform)e(test)i(results)g(for)f
1009 Fr(GNU)i(Pth)2025 482 y Fx(\(see)29 b(T)-7 b(able)29
1010 b(2)g(belo)n(w\))f(sho)n(wed)g(that)h(only)f(7)h(of)g(21)f(success-)
1011 2025 581 y(fully)e(tested)g(Unix)g(\003a)n(v)n(ors)g(pro)o(vided)e(the)
1012 i(standardized)e(API)2025 681 y(\()p Fp(makecontext)p
1013 Fx(\(3\),)19 b Fr(etc.)p Fx(\).)31 b(On)22 b(all)h(other)f(platforms,)f
1014 Fr(GNU)2025 780 y(Pth)31 b Fx(w)o(as)h(forced)e(to)h(use)h(the)f(f)o
1015 (allback)f(approach)f(of)i(imple-)2025 880 y(menting)25
1016 b(the)h(machine)f(conte)o(xt)f(as)j(we)f(will)h(describe)e(in)i(the)
1017 2025 980 y(follo)n(wing.)44 b(Ob)o(viously)25 b(this)j(f)o(allback)e
1018 (approach)f(has)i(to)g(use)2025 1079 y(the)36 b(remaining)f(technical)g
1019 (possibilities)h(\()p Fp(sigsetjmp)p Fx(\(3\),)2025 1179
1020 y Fr(etc.)p Fx(\).)p 2025 1271 1899 4 v 2025 3174 4 1904
1021 v 2103 1351 a Fn(Operating)18 b(System)p 2837 1374 4
1022 79 v 277 w(Ar)o(chitectur)o(e\(s\))p 3450 1374 V 188
1023 w(mcsc)p 3694 1374 V 104 w(sjlj)2103 1430 y Fm(FreeBSD)g(2.x/3.x)p
1024 2837 1453 V 339 w(Intel)p 3450 1453 V 494 w(no)p 3694
1025 1453 V 177 w(yes)2103 1508 y(FreeBSD)g(3.x)p 2837 1532
1026 V 440 w(Intel,)g(Alpha)p 3450 1532 V 298 w(no)p 3694
1027 1532 V 177 w(yes)2103 1587 y(NetBSD)g(1.3/1.4)p 2837
1028 1611 V 361 w(Intel,)g(PPC,)e(M68K)p 3450 1611 V 135 w(no)p
1029 3694 1611 V 177 w(yes)2103 1666 y(OpenBSD)i(2.5/2.6)p
1030 2837 1690 V 313 w(Intel,)g(SP)-6 b(ARC)p 3450 1690 V
1031 255 w(no)p 3694 1690 V 177 w(yes)2103 1745 y(BSDI)17
1032 b(4.0)p 2837 1769 V 536 w(Intel)p 3450 1769 V 494 w(no)p
1033 3694 1769 V 177 w(yes)2103 1824 y(Linux)g(2.0.x)g(glibc)h(1.x/2.0)p
1034 2837 1848 V 129 w(Intel,)g(SP)-6 b(ARC,)16 b(PPC)p 3450
1035 1848 V 104 w(no)p 3694 1848 V 177 w(yes)2103 1903 y(Linux)h(2.2.x)g
1036 (glibc)h(2.0/2.1)p 2837 1926 V 129 w(Intel,)g(Alpha,)g(ARM)p
1037 3450 1926 V 112 w(no)p 3694 1926 V 177 w(yes)2103 1982
1038 y(Sun)f(SunOS)g(4.1.x)p 2837 2005 V 329 w(SP)-6 b(ARC)p
1039 3450 2005 V 410 w(no)p 3694 2005 V 177 w(yes)2103 2060
1040 y(Sun)17 b(Solaris)h(2.5/2.6/2.7)p 2837 2084 V 181 w(SP)-6
1041 b(ARC)p 3450 2084 V 410 w(yes)p 3694 2084 V 155 w(yes)2103
1042 2139 y(SCO)17 b(UnixW)-5 b(are)18 b(2.x/7.x)p 2837 2163
1043 V 169 w(Intel)p 3450 2163 V 494 w(yes)p 3694 2163 V 155
1044 w(yes)2103 2218 y(SCO)f(OpenServ)o(er)i(5.0.x)p 2837
1045 2242 V 175 w(Intel)p 3450 2242 V 494 w(no)p 3694 2242
1046 V 177 w(yes)2103 2297 y(IBM)e(AIX)g(4.1/4.2/4.3)p 2837
1047 2321 V 225 w(RS6000,)g(PPC)p 3450 2321 V 249 w(yes)p
1048 3694 2321 V 155 w(yes)2103 2376 y(HP)g(HPUX)f(9.10/10.20)p
1049 2837 2400 V 205 w(HPP)-6 b(A)p 3450 2400 V 450 w(no)p
1050 3694 2400 V 177 w(yes)2103 2455 y(HP)17 b(HPUX)f(11.0)p
1051 2837 2479 V 372 w(HPP)-6 b(A)p 3450 2479 V 450 w(yes)p
1052 3694 2479 V 155 w(yes)2103 2534 y(SGI)17 b(IRIX)g(5.3)p
1053 2837 2557 V 427 w(MIPS)g(32/64)p 3450 2557 V 292 w(no)p
1054 3694 2557 V 177 w(yes)2103 2613 y(SGI)g(IRIX)g(6.2/6.5)p
1055 2837 2636 V 326 w(MIPS)g(32/64)p 3450 2636 V 292 w(yes)p
1056 3694 2636 V 155 w(yes)2103 2691 y(ISC)g(4.0)p 2837 2715
1057 V 584 w(Intel)p 3450 2715 V 494 w(no)p 3694 2715 V 177
1058 w(yes)2103 2770 y(Apple)h(MacOS)f(X)p 2837 2794 V 341
1059 w(PPC)p 3450 2794 V 496 w(no)p 3694 2794 V 177 w(yes)2103
1060 2849 y(DEC)f(OSF1/T)n(ru64)i(4.0/5.0)p 2837 2873 V 103
1061 w(Alpha)p 3450 2873 V 453 w(yes)p 3694 2873 V 155 w(yes)2103
1062 2928 y(SNI)f(ReliantUNIX)p 2837 2952 V 308 w(MIPS)p 3450
1063 2952 V 459 w(yes)p 3694 2952 V 155 w(yes)2103 3007 y(AmigaOS)p
1064 2837 3031 V 522 w(M68K)p 3450 3031 V 441 w(no)p 3694
1065 3031 V 177 w(yes)p 3921 3174 4 1904 v 2025 3177 1899
1066 4 v 2025 3264 a Fn(T)-6 b(able)18 b(2:)67 b Fm(Summary)20
1067 b(of)h(operating)j(system)d(support.)33 b(The)20 b(le)n(v)o(el)j(and)f
1068 (type)2320 3332 y(of)h(support)h(found)f(on)g(each)i(tested)g
1069 (operating)g(system.)39 b Fh(mcsc)p Fm(:)2320 3400 y(functional)168
1070 b Fh(makecontext)p Fm(\(3\)/)p Fh(switchcontext)p Fm(\(3\),)2320
1071 3466 y Fh(sjlj)p Fm(:)83 b(functional)51 b Fh(setjmp)p
1072 Fm(\(3\)/)p Fh(longjmp)p Fm(\(3\))c(or)i Fh(sig-)2320
1073 3531 y(setjmp)p Fm(\(3\)/)p Fh(siglongjmp)p Fm(\(3\).)25
1074 b(See)19 b(\002le)h Fh(PORTING)d Fm(in)j Fl(GNU)2320
1075 3597 y(Pth)c Fm([25)q(])h(for)g(more)g(details.)2025
1076 3834 y FA(2.4)99 b(Remaining)25 b(P)n(ossibilities)2025
1077 3999 y Fx(Our)f(problem)e(can)i(be)g(di)n(vided)f(into)h(tw)o(o)g
1078 (parts,)h(an)f(easy)g(one)2025 4099 y(and)c(a)g(dif)n(\002cult)g(one.)
1079 2025 4264 y FA(The)26 b(Easy)f(P)o(art)2025 4399 y Fx(That)k
1080 Fp(setjmp)p Fx(\(3\))e(and)h Fp(longjmp)p Fx(\(3\))f(can)i(be)g(used)g
1081 (to)g(im-)2025 4498 y(plement)20 b(user)n(-space)g(threads)g(is)i
1082 (commonly)c(kno)n(wn)h([24)o(,)i(27)o(,)2025 4598 y(28)o(].)57
1083 b(Mostly)31 b(all)g(older)g(portable)e(user)n(-space)h(threading)f(li-)
1084 2025 4697 y(braries)c(are)h(based)g(on)f(them,)i(although)d(some)h
1085 (problems)g(are)2025 4797 y(kno)n(wn)h(with)h(these)g(f)o(acilities)h
1086 (\(see)f(belo)n(w\).)45 b(So)28 b(it)g(becomes)2025 4897
1087 y(clear)g(that)f(we)h(also)g(ha)n(v)o(e)f(to)h(use)g(these)g(functions)
1088 e(and)h(base)2025 4996 y(our)h(machine)f(conte)o(xt)g(\()p
1089 Fp(mctx)p 2980 4996 25 4 v 29 w(t)p Fx(\))i(on)f(their)g
1090 Fp(jmp)p 3559 4996 V 29 w(buf)h Fx(data)2025 5096 y(structure.)2150
1091 5201 y(W)-7 b(e)39 b(immediately)e(recognize)f(that)j(this)f(w)o(ay)h
1092 (we)f(ha)n(v)o(e)2025 5300 y(at)j(least)g(solv)o(ed)f(the)g
1093 (dispatching)f(problem,)44 b(because)39 b(our)2025 5400
1094 y Fp(mctx)p 2230 5400 V 29 w(save)p Fx(,)73 b Fp(mctx)p
1095 2753 5400 V 29 w(restore)62 b Fx(and)g Fp(mctx)p 3577
1096 5400 V 29 w(switch)p Black 1929 5700 a Fx(4)p Black eop
1097 %%Page: 5 5
1098 5 4 bop Black Black 0 83 a Fx(functions)32 b(can)h(be)g(easily)g
1099 (implemented)e(with)i Fp(setjmp)p Fx(\(3\))0 183 y(and)20
1100 b Fp(longjmp)p Fx(\(3\).)0 358 y FA(The)26 b(Dif\002cult)g(P)o(art)0
1101 500 y Fx(Ne)n(v)o(ertheless,)g(the)h(dif)n(\002cult)e(problem)g(of)h
1102 (ho)n(w)f(to)i(create)f(the)0 600 y(machine)k(conte)o(xt)f(remains.)56
1103 b(Ev)o(en)29 b(kno)n(wing)g(that)i(our)f(ma-)0 699 y(chine)17
1104 b(conte)o(xt)f(is)i Fp(jmp)p 687 699 25 4 v 30 w(buf)f
1105 Fx(based)g(is)i(no)e(adv)n(antage)e(to)j(us.)24 b(A)0
1106 799 y Fp(jmp)p 155 799 V 29 w(buf)18 b Fx(has)f(to)g(be)g(treated)g(by)
1107 g(us)g(as)h(an)f(opaque)f(data)h(struc-)0 899 y(ture)26
1108 b(\227)h(for)e(portability)g(reasons.)42 b(The)26 b(only)g(operations)e
1109 (we)0 998 y(can)15 b(perform)f(on)h(it)h(are)f Fp(setjmp)p
1110 Fx(\(3\))f(and)h Fp(longjmp)p Fx(\(3\))e(calls,)0 1098
1111 y(of)23 b(course.)32 b(Additionally)-5 b(,)21 b(we)j(are)f(forced)e(to)
1112 i(use)g Fp(sigalt-)0 1198 y(stack)p Fx(\(3\))f(for)h(our)g(stack)h
1113 (manipulations,)e(because)h(it)h(is)h(the)0 1297 y(only)19
1114 b(portable)g(function)g(which)g(actually)h(deals)g(with)h(stacks.)125
1115 1406 y(So)33 b(it)g(is)h(clear)f(that)g(our)f(implementation)f(for)h
1116 Fp(mctx)p 1801 1406 V 29 w(-)0 1505 y(create)k Fx(has)h(to)g(play)f(a)i
1117 (fe)n(w)e(tricks)h(to)g(use)g(a)g Fp(jmp)p 1701 1505
1118 V 30 w(buf)0 1605 y Fx(for)44 b(passing)h(e)o(x)o(ecution)e(control)h
1119 (to)h(an)g(arbitrary)e(startup)0 1704 y(routine.)82 b(And)39
1120 b(our)g(approach)f(has)i(to)g(be)f(careful)g(to)h(en-)0
1121 1804 y(sure)51 b(that)h(it)g(does)f(not)h(suf)n(fer)e(from)h(une)o
1122 (xpected)e(side-)0 1904 y(ef)n(fects.)131 b(It)56 b(should)e(be)i(also)
1123 g(ob)o(vious)d(that)j(we)g(can-)0 2003 y(not)e(again)f(e)o(xpect)g(to)i
1124 (\002nd)f(an)g(easy)g(solution)g(\(as)g(for)0 2103 y
1125 Fp(mctx)p 205 2103 V 29 w(save)p Fx(,)g Fp(mctx)p 709
1126 2103 V 29 w(restore)47 b Fx(and)h Fp(mctx)p 1504 2103
1127 V 29 w(switch)p Fx(\),)0 2203 y(because)29 b Fp(setjmp)p
1128 Fx(\(3\))f(and)i Fp(sigaltstack)p Fx(\(3\))d(cannot)i(be)0
1129 2302 y(tri)n(vially)20 b(combined)e(to)i(form)f Fp(mctx)p
1130 1102 2302 V 29 w(create)p Fx(.)0 2630 y Fs(3)119 b(Implementation)0
1131 2833 y Fx(As)24 b(we)g(ha)n(v)o(e)f(already)g(discussed,)g(our)g
1132 (implementation)e(con-)0 2932 y(tains)31 b(an)f(easy)h(part)f(\()p
1133 Fp(mctx)p 869 2932 V 29 w(save)p Fx(,)i Fp(mctx)p 1351
1134 2932 V 29 w(restore)e Fx(and)0 3032 y Fp(mctx)p 205 3032
1135 V 29 w(switch)p Fx(\))i(and)h(a)h(dif)n(\002cult)e(part)h(\()p
1136 Fp(mctx)p 1504 3032 V 29 w(create)p Fx(\).)0 3131 y(Let)23
1137 b(us)h(start)f(with)g(the)g(easy)g(part,)g(whose)g(implementation)e(is)
1138 0 3231 y(ob)o(vious)26 b(\(all)i(error)e(checks)i(again)e(omitted)h
1139 (for)g(better)g(read-)0 3331 y(ability\):)p Black Black
1140 0 3532 a Fk(/*)63 b Fj(mac)o(hine)19 b(context)g(data)g(structure)44
1141 b Fk(*/)0 3607 y Fi(typedef)g(struct)f Fk(mctx_st)h Fo(f)179
1142 3681 y Fk(jmp_buf)g(jb;)0 3756 y Fo(g)h Fk(mctx_t;)0
1143 3906 y(/*)63 b Fj(sav)o(e)20 b(mac)o(hine)e(context)45
1144 b Fk(*/)0 3980 y Fi(#define)f Fk(mctx_save\(mctx\))e
1145 Fo(n)179 4055 y Fk(\()p Fi(void)p Fk(\)setjmp\(\(mctx\)->jb\))0
1146 4204 y(/*)63 b Fj(restore)20 b(mac)o(hine)e(context)45
1147 b Fk(*/)0 4279 y Fi(#define)f Fk(mctx_restore\(mctx\))d
1148 Fo(n)179 4354 y Fk(longjmp\(\(mctx\)->jb,)h(1\))0 4503
1149 y(/*)63 b Fj(switc)o(h)18 b(mac)o(hine)h(context)45 b
1150 Fk(*/)0 4578 y Fi(#define)f Fk(mctx_switch\(mctx_old,mctx_new\))39
1151 b Fo(n)179 4653 y Fi(if)45 b Fk(\(setjmp\(\(mctx_old\)->jb\))c(==)j
1152 (0\))h Fo(n)359 4728 y Fk(longjmp\(\(mctx_new\)->jb,)c(1\))0
1153 4877 y(/*)63 b Fj(create)20 b(mac)o(hine)e(context)45
1154 b Fk(*/)0 4952 y Fi(void)f Fk(mctx_create\()179 5026
1155 y(mctx_t)g(*mctx,)179 5101 y Fi(void)g Fk(\(*sf_addr\)\()p
1156 Fi(void)f Fk(*\),)h Fi(void)g Fk(*sf_arg,)179 5176 y
1157 Fi(void)g Fk(*sk_addr,)g(size_t)g(sk_size\))0 5251 y
1158 Fo(f)198 5325 y Fj(...initialization)16 b(of)j Fg(mctx)f
1159 Fj(to)h(be)g(\002lled)f(in...)0 5400 y Fo(g)2025 83 y
1160 Fx(There)23 b(is)i(one)f(subtle)f(b)n(ut)h(important)f(point)g(we)h
1161 (should)f(men-)2025 183 y(tion:)45 b(The)30 b(use)h(of)f(the)h(C)g
1162 (pre-processor)d Fp(#define)h Fx(direc-)2025 282 y(ti)n(v)o(e)36
1163 b(to)g(implement)f Fp(mctx)p 2881 282 V 29 w(save)p Fx(,)40
1164 b Fp(mctx)p 3371 282 V 29 w(restore)35 b Fx(and)2025
1165 382 y Fp(mctx)p 2230 382 V 29 w(switch)40 b Fx(is)i(intentional.)86
1166 b(F)o(or)40 b(technical)g(reasons)2025 482 y(related)35
1167 b(to)h Fp(setjmp)p Fx(\(3\))e(semantics)h(and)g Fp(return)g
1168 Fx(related)2025 581 y(stack)h(beha)n(vior)e(\(which)h(we)i(will)f(e)o
1169 (xplain)f(later)h(in)g(detail\))2025 681 y(we)25 b Fr(cannot)g
1170 Fx(implement)f(these)h(three)g(functions)e(\(at)i(least)h(not)2025
1171 780 y Fp(mctx)p 2230 780 V 29 w(switch)p Fx(\))32 b(as)h(C)g(functions)
1172 e(if)h(we)h(w)o(ant)f(to)h(achie)n(v)o(e)2025 880 y(maximum)25
1173 b(portability)g(across)i(all)g(platforms.)43 b(Instead)26
1174 b(the)o(y)2025 980 y(ha)n(v)o(e)20 b(to)g(be)g(implemented)e(as)j
1175 (pre-processor)d(macros.)2025 1217 y FA(3.1)99 b(Algorithm)25
1176 b(Ov)o(er)o(view)2025 1373 y Fx(The)g(general)e(idea)i(for)f
1177 Fp(mctx)p 2940 1373 V 29 w(create)h Fx(is)h(to)f(con\002gure)e(the)2025
1178 1472 y(gi)n(v)o(en)14 b(stack)i(as)g(a)g(signal)f(stack)h(via)f
1179 Fp(sigaltstack)p Fx(\(2\),)f(send)2025 1572 y(the)33
1180 b(current)f(process)g(a)i(signal)e(to)i(transfer)e(e)o(x)o(ecution)e
1181 (con-)2025 1672 y(trol)e(onto)g(this)h(stack,)h(sa)n(v)o(e)f(the)f
1182 (machine)f(conte)o(xt)h(there)g(via)2025 1771 y Fp(setjmp)p
1183 Fx(\(3\),)16 b(get)h(rid)h(of)f(the)g(signal)h(handler)e(scope)h(and)g
1184 (boot-)2025 1871 y(strap)j(into)g(the)g(startup)g(routine.)2150
1185 1970 y(The)31 b(real)g(problem)f(in)i(this)g(approach)d(comes)i(from)g
1186 (the)2025 2070 y(signal)e(handler)f(scope)h(which)g(implies)h(v)n
1187 (arious)e(restrictions)2025 2170 y(on)21 b(Unix)g(platforms)f(\(the)h
1188 (signal)g(handler)f(scope)g(often)h(is)h(just)2025 2269
1189 y(a)i(\003ag)h(in)f(the)g(process)f(control)g(block)g(\(PCB\))i(which)f
1190 (v)n(arious)2025 2369 y(system)30 b(calls,)j(lik)o(e)e
1191 Fp(sigaltstack)p Fx(\(2\),)e(check)h(before)e(al-)2025
1192 2469 y(lo)n(wing)c(the)h(operation)f(\226)h(b)n(ut)g(because)g(it)h(is)
1193 g(part)f(of)f(the)i(pro-)2025 2568 y(cess)20 b(state)g(the)f(k)o(ernel)
1194 g(manages,)f(the)h(process)g(cannot)f(change)2025 2668
1195 y(it)i(itself\).)25 b(As)20 b(we)f(will)h(see,)g(we)g(ha)n(v)o(e)e(to)i
1196 (perform)d(a)i(fe)n(w)h(tricks)2025 2767 y(to)i(get)f(rid)h(of)f(it.)29
1197 b(The)22 b(second)e(main)h(problem)f(is:)29 b(ho)n(w)21
1198 b(do)g(we)2025 2867 y(prepare)k(the)h(calling)g(of)g(the)g(start)h
1199 (routine)e(without)h(immedi-)2025 2967 y(ately)20 b(entering)f(it?)2025
1200 3204 y FA(3.2)99 b(Algorithm)2025 3360 y Fx(The)20 b(input)f(to)i(the)f
1201 Fp(mctx)p 2779 3360 V 29 w(create)g Fx(function)e(is)j(the)g(machine)
1202 2025 3459 y(conte)o(xt)30 b(structure)h Fr(mctx)h Fx(which)f(should)f
1203 (be)i(initialized,)i(the)2025 3559 y(thread)15 b(startup)h(function)e
1204 (address)i Fr(sf)p 3111 3559 V 30 w(addr)p Fx(,)h(the)f(thread)f
1205 (startup)2025 3659 y(function)24 b(ar)o(gument)g Fr(sf)p
1206 2727 3659 V 30 w(ar)m(g)i Fx(and)f(a)i(chunk)d(of)i(memory)e(start-)
1207 2025 3758 y(ing)31 b(at)i Fr(sk)p 2330 3758 V 30 w(addr)g
1208 Fx(and)e Fr(sk)p 2772 3758 V 30 w(size)i Fx(bytes)e(in)h(size,)j(which)
1209 d(should)2025 3858 y(become)19 b(the)h(threads)g(stack.)2150
1210 3958 y(The)33 b(follo)n(wing)f(algorithm)g(for)h Fp(mctx)p
1211 3361 3958 V 29 w(create)g Fx(is)i(di-)2025 4057 y(rectly)21
1212 b(modeled)f(after)h(the)h(implemented)e(algorithm)g(one)h(can)2025
1213 4157 y(\002nd)28 b(in)h Fr(GNU)h(Pth)e Fx([25)o(],)j(which)d(in)h(turn)
1214 f(w)o(as)i(deri)n(v)o(ed)d(from)2025 4256 y(techniques)19
1215 b(originally)f(found)h(in)h Fr(r)o(sthr)m(eads)h Fx([27)n(]:)p
1216 Black 2129 4438 a(1.)p Black 41 w(Preserv)o(e)i(the)h(current)g(signal)
1217 g(mask)g(and)g(block)f(an)i(ar)n(-)2233 4537 y(bitrary)f(w)o(ork)o(er)h
1218 (signal)h(\(we)g(use)g Fp(SIGUSR1)p Fx(,)g(b)n(ut)g(an)o(y)2233
1219 4637 y(signal)d(can)f(be)i(used)e(for)h(this)g(\226)h(e)n(v)o(en)e(an)h
1220 (already)f(used)2233 4736 y(one\).)53 b(This)30 b(w)o(ork)o(er)f
1221 (signal)g(is)i(later)f(temporarily)e(re-)2233 4836 y(quired)18
1222 b(for)i(the)g(trampoline)f(step.)p Black 2129 5001 a(2.)p
1223 Black 41 w(Preserv)o(e)28 b(a)h(possibly)g(e)o(xisting)f(signal)h
1224 (action)g(for)g(the)2233 5101 y(w)o(ork)o(er)19 b(signal)i(and)g
1225 (con\002gure)e(a)i(trampoline)e(function)2233 5201 y(as)g(the)h(ne)n(w)
1226 f(temporary)e(signal)i(action.)24 b(The)19 b(signal)g(de-)2233
1227 5300 y(li)n(v)o(ery)g(is)j(con\002gured)d(to)i(occur)f(on)g(an)h
1228 (alternate)g(signal)2233 5400 y(stack)f(\(see)g(ne)o(xt)g(step\).)p
1229 Black 1929 5700 a(5)p Black eop
1230 %%Page: 6 6
1231 6 5 bop Black Black Black 104 83 a Fx(3.)p Black 41 w(Preserv)o(e)35
1232 b(a)h(possibly)g(acti)n(v)o(e)f(alternate)g(signal)h(stack)208
1233 183 y(and)56 b(con\002gure)f(the)h(memory)f(chunk)h(starting)g(at)208
1234 282 y Fr(sk)p 282 282 25 4 v 30 w(addr)47 b Fx(as)f(the)g(ne)n(w)f
1235 (temporary)f(alternate)h(signal)208 382 y(stack)20 b(of)g(length)f
1236 Fr(sk)p 791 382 V 30 w(size)p Fx(.)p Black 104 566 a(4.)p
1237 Black 41 w(Sa)n(v)o(e)40 b(parameters)g(for)g(the)h(trampoline)e(step)i
1238 (\()p Fr(mctx)p Fx(,)208 666 y Fr(sf)p 268 666 V 30 w(addr)p
1239 Fx(,)25 b Fr(sf)p 557 666 V 30 w(ar)m(g)p Fx(,)h Fr(etc.)p
1240 Fx(\))39 b(in)26 b(global)e(v)n(ariables,)h(send)g(the)208
1241 766 y(current)20 b(process)g(the)i(w)o(ork)o(er)e(signal,)h
1242 (temporarily)e(un-)208 865 y(block)d(it)i(and)f(this)h(w)o(ay)f(allo)n
1243 (w)h(it)g(to)g(be)f(deli)n(v)o(ered)f(on)h(the)208 965
1244 y(signal)25 b(stack)h(in)g(order)f(to)h(transfer)f(e)o(x)o(ecution)f
1245 (control)208 1065 y(to)c(the)g(trampoline)f(function.)p
1246 Black 104 1249 a(5.)p Black 41 w(After)24 b(the)h(trampoline)e
1247 (function)g(asynchronously)f(en-)208 1349 y(tered,)27
1248 b(sa)n(v)o(e)g(its)h(machine)e(conte)o(xt)g(in)h(the)g
1249 Fr(mctx)g Fx(struc-)208 1448 y(ture)j(and)g(immediately)g(return)f
1250 (from)h(it)h(to)g(terminate)208 1548 y(the)20 b(signal)g(handler)f
1251 (scope.)p Black 104 1732 a(6.)p Black 41 w(Restore)29
1252 b(the)g(preserv)o(ed)f(alternate)h(signal)g(stack,)i(pre-)208
1253 1832 y(serv)o(ed)18 b(signal)h(action)g(and)g(preserv)o(ed)e(signal)i
1254 (mask)g(for)208 1932 y(w)o(ork)o(er)30 b(signal.)59 b(This)32
1255 b(w)o(ay)g(an)f(e)o(xisting)g(application)208 2031 y(con\002guration)17
1256 b(for)j(the)g(w)o(ork)o(er)f(signal)h(is)h(restored.)p
1257 Black 104 2216 a(7.)p Black 41 w(Sa)n(v)o(e)115 b(the)g(current)f
1258 (machine)g(conte)o(xt)g(of)208 2315 y Fp(mctx)p 413 2315
1259 V 29 w(create)p Fx(.)52 b(This)30 b(allo)n(ws)g(us)g(to)g(return)e(to)i
1260 (this)208 2415 y(point)19 b(after)h(the)g(ne)o(xt)g(trampoline)e(step.)
1261 p Black 104 2599 a(8.)p Black 41 w(Restore)30 b(the)g(pre)n(viously)e
1262 (sa)n(v)o(ed)i(machine)f(conte)o(xt)g(of)208 2699 y(the)15
1263 b(trampoline)g(function)f(\()p Fr(mctx)p Fx(\))h(to)h(again)f(transfer)
1264 g(e)o(x-)208 2799 y(ecution)31 b(control)h(onto)g(the)h(alternate)f
1265 (stack,)k(b)n(ut)d(this)208 2898 y(time)20 b(without\(!\))j(signal)d
1266 (handler)f(scope.)p Black 104 3083 a(9.)p Black 41 w(After)50
1267 b(reaching)f(the)i(trampoline)e(function)g(\()p Fr(mctx)p
1268 Fx(\))208 3182 y(again,)40 b(immediately)c(bootstrap)g(into)h(a)g
1269 (clean)g(stack)208 3282 y(frame)19 b(by)h(just)g(calling)g(a)h(second)e
1270 (function.)p Black 62 3467 a(10.)p Black 41 w(Set)51
1271 b(the)h(ne)n(w)f(signal)g(mask)g(to)g(be)g(the)g(same)h(as)208
1272 3566 y(the)32 b(original)e(signal)i(mask)g(which)g(w)o(as)h(acti)n(v)o
1273 (e)e(when)208 3666 y Fp(mctx)p 413 3666 V 29 w(create)e
1274 Fx(w)o(as)i(called.)53 b(This)30 b(is)h(required)d(be-)208
1275 3765 y(cause)19 b(in)g(the)g(\002rst)h(trampoline)e(step)h(we)h
1276 (usually)e(had)h(at)208 3865 y(least)h(the)h(w)o(ork)o(er)e(signal)h
1277 (block)o(ed.)p Black 62 4050 a(11.)p Black 41 w(Load)51
1278 b(the)i(passed)f(startup)g(information)f(\()p Fr(sf)p
1279 1673 4050 V 29 w(addr)p Fx(,)208 4149 y Fr(sf)p 268 4149
1280 V 30 w(ar)m(g)p Fx(\))46 b(from)g Fp(mctx)p 894 4149
1281 V 29 w(create)g Fx(into)g(local)h(\(stack-)208 4249 y(based\))27
1282 b(v)n(ariables.)47 b(This)28 b(is)h(important)e(because)g(their)208
1283 4348 y(v)n(alues)17 b(ha)n(v)o(e)f(to)i(be)f(preserv)o(ed)f(in)i
1284 (machine)e(conte)o(xt)g(de-)208 4448 y(pendent)g(memory)g(until)h(the)h
1285 (created)f(machine)g(conte)o(xt)208 4548 y(is)k(the)f(\002rst)h(time)f
1286 (restored)f(by)h(the)g(application.)p Black 62 4732 a(12.)p
1287 Black 41 w(Sa)n(v)o(e)26 b(the)g(current)f(machine)h(conte)o(xt)f(for)h
1288 (later)g(restor)n(-)208 4832 y(ing)19 b(by)h(the)g(calling)g
1289 (application.)p Black 62 5016 a(13.)p Black 41 w(Restore)30
1290 b(the)g(pre)n(viously)e(sa)n(v)o(ed)i(machine)f(conte)o(xt)g(of)208
1291 5116 y Fp(mctx)p 413 5116 V 29 w(create)20 b Fx(to)i(transfer)e(e)o(x)o
1292 (ecution)f(control)h(back)208 5216 y(to)g(it.)p Black
1293 62 5400 a(14.)p Black 41 w(Return)f(to)i(the)f(calling)g(application.)
1294 2025 83 y(When)d(the)h(calling)f(application)e(no)n(w)i(again)g
1295 (switches)g(into)h(the)2025 183 y(established)25 b(machine)f(conte)o
1296 (xt)g Fr(mctx)p Fx(,)i(the)f(thread)g(starts)h(run-)2025
1297 282 y(ning)h(at)i(routine)e Fr(sf)p 2614 282 V 31 w(addr)i
1298 Fx(with)g(ar)o(gument)d Fr(sf)p 3405 282 V 30 w(ar)m(g)p
1299 Fx(.)49 b(Figure)27 b(1)2025 382 y(illustrates)g(the)g(algorithm)e
1300 (\(the)i(numbers)e(refer)h(to)i(the)e(algo-)2025 482
1301 y(rithm)20 b(steps)g(listed)h(abo)o(v)o(e\).)2025 1015
1302 y
1303  14669332 30325391 0 0 14669332 30325391 startTexFig
1304  2025 1015 a
1305 %%BeginDocument: pmt-fig.eps
1306 %!PS-Adobe-2.0 EPSF-2.0
1307 %%Title: pmt-fig.eps
1308 %%Creator: fig2dev Version 3.2.3 Patchlevel 
1309 %%CreationDate: Sat Apr 22 23:14:14 2000
1310 %%For: rse@en1.engelschall.com (Ralf S. Engelschall)
1311 %%BoundingBox: 0 0 223 461
1312 %%Magnification: 1.0000
1313 %%EndComments
1314 /$F2psDict 200 dict def
1315 $F2psDict begin
1316 $F2psDict /mtrx matrix put
1317 /col-1 {0 setgray} bind def
1318 /col0 {0.000 0.000 0.000 srgb} bind def
1319 /col1 {0.000 0.000 1.000 srgb} bind def
1320 /col2 {0.000 1.000 0.000 srgb} bind def
1321 /col3 {0.000 1.000 1.000 srgb} bind def
1322 /col4 {1.000 0.000 0.000 srgb} bind def
1323 /col5 {1.000 0.000 1.000 srgb} bind def
1324 /col6 {1.000 1.000 0.000 srgb} bind def
1325 /col7 {1.000 1.000 1.000 srgb} bind def
1326 /col8 {0.000 0.000 0.560 srgb} bind def
1327 /col9 {0.000 0.000 0.690 srgb} bind def
1328 /col10 {0.000 0.000 0.820 srgb} bind def
1329 /col11 {0.530 0.810 1.000 srgb} bind def
1330 /col12 {0.000 0.560 0.000 srgb} bind def
1331 /col13 {0.000 0.690 0.000 srgb} bind def
1332 /col14 {0.000 0.820 0.000 srgb} bind def
1333 /col15 {0.000 0.560 0.560 srgb} bind def
1334 /col16 {0.000 0.690 0.690 srgb} bind def
1335 /col17 {0.000 0.820 0.820 srgb} bind def
1336 /col18 {0.560 0.000 0.000 srgb} bind def
1337 /col19 {0.690 0.000 0.000 srgb} bind def
1338 /col20 {0.820 0.000 0.000 srgb} bind def
1339 /col21 {0.560 0.000 0.560 srgb} bind def
1340 /col22 {0.690 0.000 0.690 srgb} bind def
1341 /col23 {0.820 0.000 0.820 srgb} bind def
1342 /col24 {0.500 0.190 0.000 srgb} bind def
1343 /col25 {0.630 0.250 0.000 srgb} bind def
1344 /col26 {0.750 0.380 0.000 srgb} bind def
1345 /col27 {1.000 0.500 0.500 srgb} bind def
1346 /col28 {1.000 0.630 0.630 srgb} bind def
1347 /col29 {1.000 0.750 0.750 srgb} bind def
1348 /col30 {1.000 0.880 0.880 srgb} bind def
1349 /col31 {1.000 0.840 0.000 srgb} bind def
1350
1351 end
1352 save
1353 newpath 0 461 moveto 0 0 lineto 223 0 lineto 223 461 lineto closepath clip newpath
1354 -21.0 477.0 translate
1355 1 -1 scale
1356
1357 /cp {closepath} bind def
1358 /ef {eofill} bind def
1359 /gr {grestore} bind def
1360 /gs {gsave} bind def
1361 /sa {save} bind def
1362 /rs {restore} bind def
1363 /l {lineto} bind def
1364 /m {moveto} bind def
1365 /rm {rmoveto} bind def
1366 /n {newpath} bind def
1367 /s {stroke} bind def
1368 /sh {show} bind def
1369 /slc {setlinecap} bind def
1370 /slj {setlinejoin} bind def
1371 /slw {setlinewidth} bind def
1372 /srgb {setrgbcolor} bind def
1373 /rot {rotate} bind def
1374 /sc {scale} bind def
1375 /sd {setdash} bind def
1376 /ff {findfont} bind def
1377 /sf {setfont} bind def
1378 /scf {scalefont} bind def
1379 /sw {stringwidth} bind def
1380 /tr {translate} bind def
1381 /tnt {dup dup currentrgbcolor
1382   4 -2 roll dup 1 exch sub 3 -1 roll mul add
1383   4 -2 roll dup 1 exch sub 3 -1 roll mul add
1384   4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
1385   bind def
1386 /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
1387   4 -2 roll mul srgb} bind def
1388 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
1389 /$F2psEnd {$F2psEnteredState restore end} def
1390
1391 $F2psBegin
1392 %%Page: 1 1
1393 10 setmiterlimit
1394  0.06299 0.06299 sc
1395 % Polyline
1396 15.000 slw
1397 n 780 705 m 750 705 750 855 30 arcto 4 {pop} repeat
1398   750 885 900 885 30 arcto 4 {pop} repeat
1399   930 885 930 735 30 arcto 4 {pop} repeat
1400   930 705 780 705 30 arcto 4 {pop} repeat
1401  cp gs 0.00 setgray ef gr gs col0 s gr 
1402 % Polyline
1403 n 1035 1185 m 1005 1185 1005 1335 30 arcto 4 {pop} repeat
1404   1005 1365 1155 1365 30 arcto 4 {pop} repeat
1405   1185 1365 1185 1215 30 arcto 4 {pop} repeat
1406   1185 1185 1035 1185 30 arcto 4 {pop} repeat
1407  cp gs 0.00 setgray ef gr gs col0 s gr 
1408 % Polyline
1409 n 3075 2760 m 3045 2760 3045 2910 30 arcto 4 {pop} repeat
1410   3045 2940 3195 2940 30 arcto 4 {pop} repeat
1411   3225 2940 3225 2790 30 arcto 4 {pop} repeat
1412   3225 2760 3075 2760 30 arcto 4 {pop} repeat
1413  cp gs 0.00 setgray ef gr gs col0 s gr 
1414 % Polyline
1415 n 3105 885 m 3075 885 3075 1035 30 arcto 4 {pop} repeat
1416   3075 1065 3225 1065 30 arcto 4 {pop} repeat
1417   3255 1065 3255 915 30 arcto 4 {pop} repeat
1418   3255 885 3105 885 30 arcto 4 {pop} repeat
1419  cp gs 0.00 setgray ef gr gs col0 s gr 
1420 % Polyline
1421 n 2040 1500 m 2010 1500 2010 1650 30 arcto 4 {pop} repeat
1422   2010 1680 2160 1680 30 arcto 4 {pop} repeat
1423   2190 1680 2190 1530 30 arcto 4 {pop} repeat
1424   2190 1500 2040 1500 30 arcto 4 {pop} repeat
1425  cp gs 0.00 setgray ef gr gs col0 s gr 
1426 % Polyline
1427 n 2040 2100 m 2010 2100 2010 2250 30 arcto 4 {pop} repeat
1428   2010 2280 2160 2280 30 arcto 4 {pop} repeat
1429   2190 2280 2190 2130 30 arcto 4 {pop} repeat
1430   2190 2100 2040 2100 30 arcto 4 {pop} repeat
1431  cp gs 0.00 setgray ef gr gs col0 s gr 
1432 % Polyline
1433 n 1035 705 m 1005 705 1005 855 30 arcto 4 {pop} repeat
1434   1005 885 1155 885 30 arcto 4 {pop} repeat
1435   1185 885 1185 735 30 arcto 4 {pop} repeat
1436   1185 705 1035 705 30 arcto 4 {pop} repeat
1437  cp gs 0.00 setgray ef gr gs col0 s gr 
1438 % Polyline
1439 n 2040 2640 m 2010 2640 2010 2790 30 arcto 4 {pop} repeat
1440   2010 2820 2160 2820 30 arcto 4 {pop} repeat
1441   2190 2820 2190 2670 30 arcto 4 {pop} repeat
1442   2190 2640 2040 2640 30 arcto 4 {pop} repeat
1443  cp gs 0.00 setgray ef gr gs col0 s gr 
1444 % Polyline
1445 n 2040 525 m 2010 525 2010 675 30 arcto 4 {pop} repeat
1446   2010 705 2160 705 30 arcto 4 {pop} repeat
1447   2190 705 2190 555 30 arcto 4 {pop} repeat
1448   2190 525 2040 525 30 arcto 4 {pop} repeat
1449  cp gs 0.00 setgray ef gr gs col0 s gr 
1450 % Polyline
1451 n 3075 2505 m 3045 2505 3045 2655 30 arcto 4 {pop} repeat
1452   3045 2685 3195 2685 30 arcto 4 {pop} repeat
1453   3225 2685 3225 2535 30 arcto 4 {pop} repeat
1454   3225 2505 3075 2505 30 arcto 4 {pop} repeat
1455  cp gs 0.00 setgray ef gr gs col0 s gr 
1456 % Polyline
1457 n 1305 1500 m 1275 1500 1275 1650 30 arcto 4 {pop} repeat
1458   1275 1680 1425 1680 30 arcto 4 {pop} repeat
1459   1455 1680 1455 1530 30 arcto 4 {pop} repeat
1460   1455 1500 1305 1500 30 arcto 4 {pop} repeat
1461  cp gs 0.00 setgray ef gr gs col0 s gr 
1462 % Polyline
1463 n 1545 3225 m 1515 3225 1515 3375 30 arcto 4 {pop} repeat
1464   1515 3405 1665 3405 30 arcto 4 {pop} repeat
1465   1695 3405 1695 3255 30 arcto 4 {pop} repeat
1466   1695 3225 1545 3225 30 arcto 4 {pop} repeat
1467  cp gs 0.00 setgray ef gr gs col0 s gr 
1468 % Polyline
1469 n 1350 570 m 1320 570 1320 720 30 arcto 4 {pop} repeat
1470   1320 750 1470 750 30 arcto 4 {pop} repeat
1471   1500 750 1500 600 30 arcto 4 {pop} repeat
1472   1500 570 1350 570 30 arcto 4 {pop} repeat
1473  cp gs 0.00 setgray ef gr gs col0 s gr 
1474 % Polyline
1475 n 3345 2505 m 3315 2505 3315 2655 30 arcto 4 {pop} repeat
1476   3315 2685 3465 2685 30 arcto 4 {pop} repeat
1477   3495 2685 3495 2535 30 arcto 4 {pop} repeat
1478   3495 2505 3345 2505 30 arcto 4 {pop} repeat
1479  cp gs 0.00 setgray ef gr gs col0 s gr 
1480 /Times-Bold ff 150.00 scf sf
1481 3068 2895 m
1482 gs 1 -1 sc (12) col7 sh gr
1483 % Polyline
1484 7.500 slw
1485 n 630 270 m 1890 270 l 1890 3600 l 630 3600 l
1486  cp gs col0 s gr 
1487 % Polyline
1488 n 2340 270 m 3600 270 l 3600 1800 l 2340 1800 l
1489  cp gs col0 s gr 
1490 % Polyline
1491 n 2340 2070 m 3600 2070 l 3600 3600 l 2340 3600 l
1492  cp gs col0 s gr 
1493 % Polyline
1494  [15 15] 15 sd
1495 n 1980 810 m 2025 720 l 2070 900 l 2115 720 l 2160 900 l
1496  2205 810 l gs col0 s gr  [] 0 sd
1497 % Polyline
1498  [15 15] 15 sd
1499 n 1980 1170 m 2014 1081 l 2059 1261 l 2104 1081 l 2149 1261 l
1500  2205 1170 l gs col0 s gr  [] 0 sd
1501 % Polyline
1502 15.000 slw
1503 gs  clippath
1504 1275 660 m 1275 600 l 1124 600 l 1244 630 l 1124 660 l cp
1505 eoclip
1506 n 1260 4586 m 1980 4593 l 1980 3690 l 450 3690 l 450 630 l 990 630 l
1507
1508  1260 630 l gs col0 s gr gr
1509
1510 % arrowhead
1511 7.500 slw
1512 n 1124 660 m 1244 630 l 1124 600 l 1124 660 l  cp gs 0.00 setgray ef gr  col0 s
1513 % Polyline
1514 15.000 slw
1515 gs  clippath
1516 1995 840 m 1995 780 l 1844 780 l 1964 810 l 1844 840 l cp
1517 eoclip
1518 n 1260 630 m 1260 810 l
1519  1980 810 l gs col0 s gr gr
1520
1521 % arrowhead
1522 7.500 slw
1523 n 1844 840 m 1964 810 l 1844 780 l 1844 840 l  cp gs 0.00 setgray ef gr  col0 s
1524 % Polyline
1525 15.000 slw
1526 gs  clippath
1527 2985 840 m 2985 780 l 2834 780 l 2954 810 l 2834 840 l cp
1528 eoclip
1529 n 2205 810 m
1530  2970 810 l gs col0 s gr gr
1531
1532 % arrowhead
1533 7.500 slw
1534 n 2834 840 m 2954 810 l 2834 780 l 2834 840 l  cp gs 0.00 setgray ef gr  col0 s
1535 % Polyline
1536 15.000 slw
1537 gs  clippath
1538 2940 1185 m 3000 1185 l 3000 1034 l 2970 1154 l 2940 1034 l cp
1539 eoclip
1540 n 2970 810 m
1541  2970 1170 l gs col0 s gr gr
1542
1543 % arrowhead
1544 7.500 slw
1545 n 2940 1034 m 2970 1154 l 3000 1034 l 2940 1034 l  cp gs 0.00 setgray ef gr  col0 s
1546 % Polyline
1547 15.000 slw
1548 gs  clippath
1549 2190 1140 m 2190 1200 l 2341 1200 l 2221 1170 l 2341 1140 l cp
1550 eoclip
1551 n 2205 1170 m
1552  2970 1170 l gs col0 s gr gr
1553
1554 % arrowhead
1555 7.500 slw
1556 n 2341 1140 m 2221 1170 l 2341 1200 l 2341 1140 l  cp gs 0.00 setgray ef gr  col0 s
1557 % Polyline
1558 15.000 slw
1559 gs  clippath
1560 1245 1140 m 1245 1200 l 1396 1200 l 1276 1170 l 1396 1140 l cp
1561 eoclip
1562 n 1260 1170 m
1563  1980 1170 l gs col0 s gr gr
1564
1565 % arrowhead
1566 7.500 slw
1567 n 1396 1140 m 1276 1170 l 1396 1200 l 1396 1140 l  cp gs 0.00 setgray ef gr  col0 s
1568 % Polyline
1569 15.000 slw
1570 gs  clippath
1571 2985 1470 m 2985 1410 l 2834 1410 l 2954 1440 l 2834 1470 l cp
1572 eoclip
1573 n 1260 1440 m
1574  2970 1440 l gs col0 s gr gr
1575
1576 % arrowhead
1577 7.500 slw
1578 n 2834 1470 m 2954 1440 l 2834 1410 l 2834 1470 l  cp gs 0.00 setgray ef gr  col0 s
1579 % Polyline
1580 15.000 slw
1581 n 1260 1170 m
1582  1260 1440 l gs col0 s gr 
1583 % Polyline
1584 gs  clippath
1585 2985 2550 m 2985 2490 l 2834 2490 l 2954 2520 l 2834 2550 l cp
1586 eoclip
1587 n 2970 1440 m 2970 1890 l 2250 1890 l 2250 2520 l
1588  2970 2520 l gs col0 s gr gr
1589
1590 % arrowhead
1591 7.500 slw
1592 n 2834 2550 m 2954 2520 l 2834 2490 l 2834 2550 l  cp gs 0.00 setgray ef gr  col0 s
1593 % Polyline
1594 15.000 slw
1595 n 2970 2520 m
1596  2970 2883 l gs col0 s gr 
1597 % Polyline
1598 gs  clippath
1599 1230 2852 m 1229 2912 l 1380 2913 l 1261 2883 l 1381 2853 l cp
1600 eoclip
1601 n 2970 2891 m
1602  1245 2883 l gs col0 s gr gr
1603
1604 % arrowhead
1605 7.500 slw
1606 n 1381 2853 m 1261 2883 l 1380 2913 l 1381 2853 l  cp gs 0.00 setgray ef gr  col0 s
1607 % Polyline
1608 15.000 slw
1609 gs  clippath
1610 1229 4751 m 1230 4811 l 1381 4809 l 1261 4781 l 1380 4749 l cp
1611 eoclip
1612 n 1260 2880 m 1260 3150 l 2070 3150 l 2062 4773 l
1613  1245 4781 l gs col0 s gr gr
1614
1615 % arrowhead
1616 7.500 slw
1617 n 1380 4749 m 1261 4781 l 1381 4809 l 1380 4749 l  cp gs 0.00 setgray ef gr  col0 s
1618 % Polyline
1619 15.000 slw
1620 gs  clippath
1621 1230 4601 m 1290 4601 l 1290 4450 l 1260 4570 l 1230 4450 l cp
1622 eoclip
1623 n 450 4050 m 1260 4050 l
1624  1260 4586 l gs col0 s gr gr
1625
1626 % arrowhead
1627 7.500 slw
1628 n 1230 4450 m 1260 4570 l 1290 4450 l 1230 4450 l  cp gs 0.00 setgray ef gr  col0 s
1629 % Polyline
1630 15.000 slw
1631 gs  clippath
1632 1230 5235 m 1290 5234 l 1287 5083 l 1260 5204 l 1227 5084 l cp
1633 eoclip
1634 n 1252 4773 m
1635  1260 5220 l gs col0 s gr gr
1636
1637 % arrowhead
1638 7.500 slw
1639 n 1227 5084 m 1260 5204 l 1287 5083 l 1227 5084 l  cp gs 0.00 setgray ef gr  col0 s
1640 % Polyline
1641 1 slc
1642 15.000 slw
1643  [15 45] 45 sd
1644 gs  clippath
1645 2985 4260 m 2985 4200 l 2834 4200 l 2954 4230 l 2834 4260 l cp
1646 eoclip
1647 n 2970 3150 m 2970 3690 l 2250 3690 l 2250 4230 l
1648  2970 4230 l gs col0 s gr gr
1649  [] 0 sd
1650 % arrowhead
1651 0 slc
1652 7.500 slw
1653 n 2834 4260 m 2954 4230 l 2834 4200 l 2834 4260 l  cp gs 0.00 setgray ef gr  col0 s
1654 % Polyline
1655 n 630 6300 m 1890 6300 l
1656  1890 7290 l gs col0 s gr 
1657 % Polyline
1658 gs  clippath
1659 3660 7575 m 3720 7575 l 3720 7424 l 3690 7544 l 3660 7424 l cp
1660 3720 6285 m 3660 6285 l 3660 6436 l 3690 6316 l 3720 6436 l cp
1661 eoclip
1662 n 3690 6300 m
1663  3690 7560 l gs col0 s gr gr
1664
1665 % arrowhead
1666 n 3720 6436 m 3690 6316 l 3660 6436 l 3720 6436 l  cp gs 0.00 setgray ef gr  col0 s
1667 % arrowhead
1668 n 3660 7424 m 3690 7544 l 3720 7424 l 3660 7424 l  cp gs 0.00 setgray ef gr  col0 s
1669 % Polyline
1670 n 2340 6300 m 3600 6300 l 3600 7560 l 2340 7560 l
1671  cp gs col0 s gr 
1672 % Polyline
1673 n 630 3780 m 1890 3780 l 1890 6120 l 630 6120 l
1674  cp gs col0 s gr 
1675 % Polyline
1676 n 2340 3780 m 3600 3780 l 3600 6120 l 2340 6120 l
1677  cp gs col0 s gr 
1678 % Polyline
1679 1 slc
1680 15.000 slw
1681  [15 45] 45 sd
1682 gs  clippath
1683 2985 3180 m 2985 3120 l 2834 3120 l 2954 3150 l 2834 3180 l cp
1684 eoclip
1685 n 1260 5220 m 2160 5220 l 2160 3150 l
1686  2970 3150 l gs col0 s gr gr
1687  [] 0 sd
1688 % arrowhead
1689 0 slc
1690 7.500 slw
1691 n 2834 3180 m 2954 3150 l 2834 3120 l 2834 3180 l  cp gs 0.00 setgray ef gr  col0 s
1692 % Polyline
1693 n 630 6300 m
1694  630 7380 l gs col0 s gr 
1695 % Polyline
1696 1 slc
1697 n 630 6570 m
1698  900 6300 l gs col0 s gr 
1699 % Polyline
1700 n 630 6840 m
1701  1170 6300 l gs col0 s gr 
1702 % Polyline
1703 n 630 7110 m
1704  1440 6300 l gs col0 s gr 
1705 % Polyline
1706 n 630 7380 m
1707  1710 6300 l gs col0 s gr 
1708 % Polyline
1709 n 810 7470 m
1710  1890 6435 l gs col0 s gr 
1711 % Polyline
1712 n 1080 7515 m
1713  1890 6750 l gs col0 s gr 
1714 % Polyline
1715 n 1665 7245 m
1716  1890 7020 l gs col0 s gr 
1717 % Polyline
1718 n 2340 6570 m
1719  2610 6300 l gs col0 s gr 
1720 % Polyline
1721 n 2340 6840 m
1722  2925 6300 l gs col0 s gr 
1723 % Polyline
1724 n 2340 7110 m
1725  3240 6300 l gs col0 s gr 
1726 % Polyline
1727 n 2340 7380 m
1728  3510 6300 l gs col0 s gr 
1729 % Polyline
1730 n 2520 7560 m
1731  3600 6570 l gs col0 s gr 
1732 % Polyline
1733 n 2880 7560 m
1734  3600 6930 l gs col0 s gr 
1735 % Polyline
1736 n 3240 7560 m
1737  3600 7245 l gs col0 s gr 
1738 % Polyline
1739 15.000 slw
1740  [15 45] 45 sd
1741 gs  clippath
1742 2940 5325 m 3000 5325 l 3000 5174 l 2970 5294 l 2940 5174 l cp
1743 eoclip
1744 n 2970 4230 m
1745  2970 5310 l gs col0 s gr gr
1746  [] 0 sd
1747 % arrowhead
1748 0 slc
1749 7.500 slw
1750 n 2940 5174 m 2970 5294 l 3000 5174 l 2940 5174 l  cp gs 0.00 setgray ef gr  col0 s
1751 % Polyline
1752 1 slc
1753 15.000 slw
1754  [15 45] 45 sd
1755 gs  clippath
1756 1245 5280 m 1245 5340 l 1396 5340 l 1276 5310 l 1396 5280 l cp
1757 eoclip
1758 n 2970 5310 m
1759  1260 5310 l gs col0 s gr gr
1760  [] 0 sd
1761 % arrowhead
1762 0 slc
1763 7.500 slw
1764 n 1396 5280 m 1276 5310 l 1396 5340 l 1396 5280 l  cp gs 0.00 setgray ef gr  col0 s
1765 % Polyline
1766 1 slc
1767 15.000 slw
1768  [15 45] 45 sd
1769 gs  clippath
1770 1245 5640 m 1245 5700 l 1396 5700 l 1276 5670 l 1396 5640 l cp
1771 eoclip
1772 n 2970 5580 m 2970 5670 l
1773  1260 5670 l gs col0 s gr gr
1774  [] 0 sd
1775 % arrowhead
1776 0 slc
1777 7.500 slw
1778 n 1396 5640 m 1276 5670 l 1396 5700 l 1396 5640 l  cp gs 0.00 setgray ef gr  col0 s
1779 % Polyline
1780 1 slc
1781 15.000 slw
1782  [15 45] 45 sd
1783 gs  clippath
1784 345 5910 m 345 5970 l 496 5970 l 376 5940 l 496 5910 l cp
1785 eoclip
1786 n 1260 5670 m 1260 5940 l
1787  360 5940 l gs col0 s gr gr
1788  [] 0 sd
1789 % arrowhead
1790 0 slc
1791 7.500 slw
1792 n 496 5910 m 376 5940 l 496 5970 l 496 5910 l  cp gs 0.00 setgray ef gr  col0 s
1793 % Polyline
1794 1 slc
1795 15.000 slw
1796  [15 45] 45 sd
1797 gs  clippath
1798 2985 5610 m 2985 5550 l 2834 5550 l 2954 5580 l 2834 5610 l cp
1799 eoclip
1800 n 1260 5355 m 1260 5580 l
1801  2970 5580 l gs col0 s gr gr
1802  [] 0 sd
1803 % arrowhead
1804 0 slc
1805 7.500 slw
1806 n 2834 5610 m 2954 5580 l 2834 5550 l 2834 5610 l  cp gs 0.00 setgray ef gr  col0 s
1807 % Polyline
1808 n 630 7380 m 631 7381 l 634 7383 l 639 7388 l 647 7394 l 657 7402 l
1809  670 7412 l 686 7423 l 703 7435 l 723 7448 l 744 7460 l
1810  766 7472 l 791 7483 l 817 7493 l 845 7502 l 877 7509 l
1811  911 7514 l 949 7517 l 991 7518 l 1035 7515 l 1076 7510 l
1812  1115 7502 l 1150 7493 l 1181 7483 l 1207 7473 l 1228 7463 l
1813  1245 7453 l 1259 7443 l 1269 7433 l 1278 7423 l 1286 7414 l
1814  1294 7404 l 1303 7394 l 1314 7384 l 1327 7373 l 1344 7362 l
1815  1364 7350 l 1390 7338 l 1419 7326 l 1454 7313 l 1491 7301 l
1816  1530 7290 l 1576 7279 l 1619 7271 l 1657 7265 l 1690 7262 l
1817  1720 7261 l 1747 7261 l 1771 7263 l 1793 7266 l 1813 7269 l
1818  1831 7273 l 1847 7277 l 1861 7280 l 1872 7284 l 1880 7286 l
1819  1885 7288 l 1889 7289 l
1820  1890 7290 l gs col0 s gr 
1821 /Times-Bold ff 150.00 scf sf
1822 2430 6480 m
1823 gs 1 -1 sc (sk_addr) col0 sh gr
1824 /Times-Bold ff 150.00 scf sf
1825 720 6480 m
1826 gs 1 -1 sc (main stack) col0 sh gr
1827 /Times-Bold ff 150.00 scf sf
1828 720 3960 m
1829 gs 1 -1 sc (main) col0 sh gr
1830 /Times-Bold ff 150.00 scf sf
1831 2430 3960 m
1832 gs 1 -1 sc (sf_addr\(sf_arg\)) col0 sh gr
1833 /Times-Bold ff 150.00 scf sf
1834 2430 2250 m
1835 gs 1 -1 sc (mctx_create) col0 sh gr
1836 /Times-Bold ff 150.00 scf sf
1837 2430 450 m
1838 gs 1 -1 sc (mctx_create) col0 sh gr
1839 /Times-Bold ff 150.00 scf sf
1840 720 450 m
1841 gs 1 -1 sc (mctx_create) col0 sh gr
1842 /Times-Bold ff 150.00 scf sf
1843 3150 2250 m
1844 gs 1 -1 sc (_boot) col0 sh gr
1845 /Times-Bold ff 150.00 scf sf
1846 2790 585 m
1847 gs 1 -1 sc (_trampoline) col0 sh gr
1848 /Times-Bold ff 150.00 scf sf
1849 3870 7110 m
1850 gs 1 -1 sc  90.0 rot (sk_size) col0 sh gr
1851 /Times-Bold ff 150.00 scf sf
1852 1350 5175 m
1853 gs 1 -1 sc (mctx_switch) col0 sh gr
1854 /Times-Bold ff 150.00 scf sf
1855 2385 5445 m
1856 gs 1 -1 sc (mctx_switch) col0 sh gr
1857 /Times-Bold ff 150.00 scf sf
1858 1350 5535 m
1859 gs 1 -1 sc (mctx_switch) col0 sh gr
1860 /Times-Bold ff 150.00 scf sf
1861 2385 5805 m
1862 gs 1 -1 sc (mctx_switch) col0 sh gr
1863 /Times-Bold ff 150.00 scf sf
1864 1305 4725 m
1865 gs 1 -1 sc (mctx_create) col0 sh gr
1866 /Times-Bold ff 150.00 scf sf
1867 810 840 m
1868 gs 1 -1 sc (1) col7 sh gr
1869 /Times-Bold ff 150.00 scf sf
1870 1065 840 m
1871 gs 1 -1 sc (2) col7 sh gr
1872 /Times-Bold ff 150.00 scf sf
1873 1065 1320 m
1874 gs 1 -1 sc (6) col7 sh gr
1875 /Times-Bold ff 150.00 scf sf
1876 1335 1635 m
1877 gs 1 -1 sc (7) col7 sh gr
1878 /Times-Bold ff 150.00 scf sf
1879 2070 1635 m
1880 gs 1 -1 sc (8) col7 sh gr
1881 /Times-Bold ff 150.00 scf sf
1882 2070 660 m
1883 gs 1 -1 sc (4) col7 sh gr
1884 /Times-Bold ff 150.00 scf sf
1885 1380 705 m
1886 gs 1 -1 sc (3) col7 sh gr
1887 /Times-Bold ff 150.00 scf sf
1888 3135 1020 m
1889 gs 1 -1 sc (5) col7 sh gr
1890 /Times-Bold ff 150.00 scf sf
1891 2070 2235 m
1892 gs 1 -1 sc (9) col7 sh gr
1893 /Times-Bold ff 150.00 scf sf
1894 2040 2775 m
1895 gs 1 -1 sc (13) col7 sh gr
1896 /Times-Bold ff 150.00 scf sf
1897 3068 2640 m
1898 gs 1 -1 sc (10) col7 sh gr
1899 /Times-Bold ff 150.00 scf sf
1900 1545 3360 m
1901 gs 1 -1 sc (14) col7 sh gr
1902 /Times-Bold ff 150.00 scf sf
1903 3337 2640 m
1904 gs 1 -1 sc (11) col7 sh gr
1905 $F2psEnd
1906 rs
1907
1908 %%EndDocument
1909
1910  endTexFig
1911  2025 4944 a Fn(Figur)o(e)d(1:)66 b Fm(Illustration)18
1912 b(of)c(the)h(machine)h(conte)o(xt)g(creation)h(procedure.)22
1913 b(The)2350 5012 y(thick)h(solid)f(lines)h(and)e(numeric)i(marks)e
1914 (correspond)i(to)f(the)g(al-)2350 5080 y(gorithm)c(steps)g(as)f
1915 (described)i(in)f(section)h(3.2.)h(The)d(thick)i(dotted)2350
1916 5148 y(lines)h(sho)n(w)f(a)g(possible)h(further)g(processing)h(where)f
1917 (a)f(fe)n(w)g(con-)2350 5216 y(te)o(xt)i(switches)h(are)e(performed)i
1918 (to)e(dispatch)i(between)f(the)g(main)2350 5284 y(thread)e(and)e(the)h
1919 (ne)n(w)g(created)h(thread.)p Black 1929 5700 a Fx(6)p
1920 Black eop
1921 %%Page: 7 7
1922 7 6 bop Black Black 0 83 a FA(3.3)99 b(Sour)n(ce)27 b(Code)0
1923 239 y Fx(The)43 b(corresponding)d(ANSI-C)k(code,)49 b(which)43
1924 b(implements)0 338 y Fp(mctx)p 205 338 25 4 v 29 w(create)p
1925 Fx(,)37 b(is)d(a)h(little)f(bit)h(more)e(complicated.)64
1926 b(But)0 438 y(with)23 b(the)g(presented)e(algorithm)g(in)i(mind,)f(it)i
1927 (is)f(no)n(w)f(straight-)0 538 y(forw)o(ard.)p Black
1928 Black 0 693 a Fi(static)44 b Fk(mctx_t)313 b(mctx_caller;)0
1929 767 y Fi(static)44 b Fk(sig_atomic_t)f(mctx_called;)0
1930 917 y Fi(static)h Fk(mctx_t)268 b(*mctx_creat;)0 992
1931 y Fi(static)44 b(void)313 b Fk(\(*mctx_creat_func\)\()p
1932 Fi(void)41 b Fk(*\);)0 1066 y Fi(static)j(void)358 b
1933 Fk(*mctx_creat_arg;)0 1141 y Fi(static)44 b Fk(sigset_t)223
1934 b(mctx_creat_sigs;)0 1290 y Fi(void)44 b Fk(mctx_create\()179
1935 1365 y(mctx_t)g(*mctx,)179 1440 y Fi(void)g Fk(\(*sf_addr\)\()p
1936 Fi(void)f Fk(*\),)h Fi(void)g Fk(*sf_arg,)179 1515 y
1937 Fi(void)g Fk(*sk_addr,)g Fi(size_t)g Fk(sk_size\))0 1589
1938 y Fo(f)179 1664 y Fi(struct)g Fk(sigaction)f(sa;)179
1939 1739 y Fi(struct)h Fk(sigaction)f(osa;)179 1813 y Fi(struct)h
1940 Fk(sigaltstack)f(ss;)179 1888 y Fi(struct)h Fk(sigaltstack)f(oss;)179
1941 1963 y(sigset_t)h(osigs;)179 2038 y(sigset_t)g(sigs;)179
1942 2187 y(/*)64 b Fj(Step)18 b(1:)45 b Fk(*/)179 2262 y
1943 (sigemptyset\(&sigs\);)179 2336 y(sigaddset\(&sigs,)d(SIGUSR1\);)179
1944 2411 y(sigprocmask\(SIG_BLOCK,)f(&sigs,)j(&osigs\);)179
1945 2561 y(/*)64 b Fj(Step)18 b(2:)45 b Fk(*/)179 2635 y(memset\(\()p
1946 Fi(void)e Fk(*\)&sa,)h(0,)493 2710 y Fi(sizeof)p Fk(\()p
1947 Fi(struct)f Fk(sigaction\)\);)179 2785 y(sa.sa_handler)g(=)i
1948 (mctx_create_trampoline;)179 2860 y(sa.sa_flags)e(=)i(SA_ONSTACK;)179
1949 2934 y(sigemptyset\(&sa.sa_mask\);)179 3009 y(sigaction\(SIGUSR1,)d
1950 (&sa,)i(&osa\);)179 3158 y(/*)64 b Fj(Step)18 b(3:)45
1951 b Fk(*/)179 3233 y(ss.ss_sp)178 b(=)45 b(sk_addr;)179
1952 3308 y(ss.ss_size)88 b(=)45 b(sk_size;)179 3383 y(ss.ss_flags)e(=)i(0;)
1953 179 3457 y(sigaltstack\(&ss,)d(&oss\);)179 3607 y(/*)64
1954 b Fj(Step)18 b(4:)45 b Fk(*/)179 3681 y(mctx_creat)268
1955 b(=)44 b(mctx;)179 3756 y(mctx_creat_func)f(=)h(sf_addr;)179
1956 3831 y(mctx_creat_arg)88 b(=)44 b(sf_arg;)179 3906 y(mctx_creat_sigs)f
1957 (=)h(osigs;)179 3980 y(mctx_called)223 b(=)44 b(FALSE;)179
1958 4055 y(kill\(getpid\(\),)f(SIGUSR1\);)179 4130 y(sigfillset\(&sigs\);)
1959 179 4204 y(sigdelset\(&sigs,)f(SIGUSR1\);)179 4279 y
1960 Fi(while)i Fk(\(!mctx_called\))359 4354 y(sigsuspend\(&sigs\);)179
1961 4503 y(/*)64 b Fj(Step)18 b(6:)45 b Fk(*/)179 4578 y
1962 (sigaltstack\(NULL,)d(&ss\);)179 4653 y(ss.ss_flags)h(=)i(SS_DISABLE;)
1963 179 4728 y(sigaltstack\(&ss,)d(NULL\);)179 4802 y(if)j
1964 (\(!\(oss.ss_flags)d(&)j(SS_DISABLE\)\))359 4877 y(sigaltstack\(&oss,)d
1965 (NULL\);)179 4952 y(sigaction\(SIGUSR1,)g(&osa,)i(NULL\);)179
1966 5026 y(sigprocmask\(SIG_SETMASK,)717 5101 y(&osigs,)g(NULL\);)179
1967 5251 y(/*)64 b Fj(Step)18 b(7)h(&)g(Step)f(8:)45 b Fk(*/)179
1968 5325 y(mctx_switch\(&mctx_caller,)c(mctx\);)2204 83 y(/*)64
1969 b Fj(Step)18 b(14:)45 b Fk(*/)2204 158 y Fi(return)p
1970 Fk(;)2025 232 y Fo(g)2025 382 y Fi(void)f Fk(mctx_create_trampoline\()p
1971 Fi(int)d Fk(sig\))2025 457 y Fo(f)2204 531 y Fk(/*)64
1972 b Fj(Step)18 b(5:)45 b Fk(*/)2204 606 y Fi(if)g Fk
1973 (\(mctx_save\(mctx_creat\))c(==)j(0\))h Fo(f)2384 681
1974 y Fk(mctx_called)e(=)h(TRUE;)2384 756 y Fi(return)p Fk(;)2204
1975 830 y Fo(g)2204 980 y Fk(/*)64 b Fj(Step)18 b(9:)45 b
1976 Fk(*/)2204 1054 y(mctx_create_boot\(\);)2025 1129 y Fo(g)2025
1977 1279 y Fi(void)f Fk(mctx_create_boot\()p Fi(void)p Fk(\))2025
1978 1353 y Fo(f)2204 1428 y Fi(void)g Fk(\(*mctx_start_func\)\()p
1979 Fi(void)d Fk(*\);)2204 1503 y Fi(void)j Fk(*mctx_start_arg;)2204
1980 1652 y(/*)64 b Fj(Step)18 b(10:)45 b Fk(*/)2204 1727
1981 y(sigprocmask\(SIG_SETMASK,)2742 1802 y(&mctx_creat_sigs,)d(NULL\);)
1982 2204 1951 y(/*)64 b Fj(Step)18 b(11:)45 b Fk(*/)2204
1983 2026 y(mctx_start_func)e(=)h(mctx_creat_func;)2204 2100
1984 y(mctx_start_arg)88 b(=)44 b(mctx_creat_arg;)2204 2250
1985 y(/*)64 b Fj(Step)18 b(12)h(&)g(Step)g(13:)45 b Fk(*/)2204
1986 2325 y(mctx_switch\(mctx_creat,)c(&mctx_caller\);)2204
1987 2474 y(/*)64 b Fj(The)18 b(thread)h(``magically'')g(starts...)62
1988 b Fk(*/)2204 2549 y(mctx_start_func\(mctx_start_arg\);)2204
1989 2698 y(/*)45 b(NOTREACHED)e(*/)2204 2773 y(abort\(\);)2025
1990 2848 y Fo(g)2025 3124 y FA(3.4)99 b(Run-time)26 b(P)n(enalty)2025
1991 3294 y Fx(After)31 b(this)h(discussion)f(of)g(the)g(implementation)e
1992 (details,)35 b(an)2025 3393 y(ob)o(viously)29 b(occuring)h(question)g
1993 (no)n(w)h(is)h(what)g(the)f(e)o(xpected)2025 3493 y(run-time)g(penalty)
1994 h(is.)63 b(That)32 b(is,)k(what)d(does)f(our)g(presented)2025
1995 3592 y(machine)43 b(conte)o(xt)f(implementation)g(cost)i(compared)e(to)
1996 i(a)2025 3692 y Fp(ucontext)p Fx(\(3\))33 b(based)j(solution.)70
1997 b(From)35 b(the)g(already)f(dis-)2025 3792 y(cussed)21
1998 b(details)h(we)g(can)f(easily)h(guess)f(that)h(our)e(comple)o(x)g(ma-)
1999 2025 3891 y(chine)27 b(conte)o(xt)f(creation)h(procedure)d(\()p
2000 Fp(mctx)p 3392 3891 V 29 w(create)p Fx(\))j(will)2025
2001 3991 y(be)20 b(certainly)f(noticeably)f(slo)n(wer)i(than)g(a)g
2002 (solution)f(based)h(on)f(a)2025 4091 y Fp(ucontext)p
2003 Fx(\(3\))f(f)o(acility)-5 b(.)2150 4197 y(But)48 b(a)g(wild)g(guess)f
2004 (is)i(not)e(suf)n(\002cing)g(for)g(a)h(reason-)2025 4297
2005 y(able)d(statement.)101 b(So)45 b(we)h(ha)n(v)o(e)f(written)g(a)h
2006 Fr(Simple)f(Ma-)2025 4397 y(c)o(hine)21 b(Conte)n(xt)g(Benc)o(hmark)g
2007 Fx(\(SMCB)i([32)n(]\))f(which)f(w)o(as)h(used)2025 4496
2008 y(to)36 b(compare)e(run-time)g(costs)j(of)e(the)h Fp(mctx)p
2009 3421 4496 V 29 w(create)f Fx(and)2025 4596 y Fp(mctx)p
2010 2230 4596 V 29 w(switch)27 b Fx(functions)f(if)h(once)f(implemented)g
2011 (through)2025 4696 y(the)17 b Fr(POSIX)i Fp(makecontext)p
2012 Fx(\(3\)/)p Fp(swapcontext)p Fx(\(3\))11 b(func-)2025
2013 4795 y(tions)55 b(\(as)h(sho)n(wn)f(in)g(section)h(2.3\),)63
2014 b(and)55 b(once)f(imple-)2025 4895 y(mented)44 b(with)g(our)g(based)g
2015 (f)o(allback)g(implementation)f(\(for)2025 4994 y(con)m(v)o(enience)c
2016 (reasons)j(we)h(directly)e(used)h Fp(sigjmp)p 3706 4994
2017 V 29 w(buf)p Fx(,)2025 5094 y Fp(sigsetjmp)p Fx(\(3\))g(and)h
2018 Fp(siglongjmp)p Fx(\(3\))f(in)i(the)g(bench-)2025 5194
2019 y(mark,)31 b(because)d(all)i(tested)g(platforms)e(pro)o(vided)e
2020 (this\).)53 b(The)2025 5293 y(results)21 b(are)f(sho)n(wn)f(T)-7
2021 b(able)20 b(3)h(belo)n(w)-5 b(.)2150 5400 y(As)32 b(one)e(can)h(deri)n
2022 (v)o(e)f(from)g(these)i(e)n(v)n(aluations,)g(our)e(sig-)p
2023 Black 1929 5700 a(7)p Black eop
2024 %%Page: 8 8
2025 8 7 bop Black Black 0 83 a Fx(nal)25 b(stack)f(trick)h(to)f(implement)f
2026 Fp(mctx)p 1174 83 25 4 v 30 w(create)h Fx(in)g(practice)0
2027 183 y(is)31 b(approximately)c(15)j(times)h(slo)n(wer)f(than)f(the)h
2028 Fp(makecon-)0 282 y(text)p Fx(\(3\))36 b(based)i(v)n(ariant.)77
2029 b(This)38 b(cost)g(should)f(not)g(be)h(ne-)0 382 y(glected.)f(On)25
2030 b(the)f(other)g(hand,)g(the)h Fp(sigsetjmp)p Fx(\(3\)/)d
2031 Fp(sig-)0 482 y(longjmp)p Fx(\(3\))29 b(based)i Fp(mctx)p
2032 903 482 V 29 w(switch)g Fx(performs)f(about)g(as)0 581
2033 y(good)17 b(as)h(the)g Fp(swapcontext)p Fx(\(3\))e(based)i(v)n(ariant)f
2034 (\(the)g(reason)0 681 y(why)29 b(on)g(most)g(of)h(the)f(tested)h
2035 (platforms)e(it)j(is)f(e)n(v)o(en)f(slightly)0 780 y(f)o(aster)37
2036 b(is)h(not)f(kno)n(wn)e(\226)i(b)n(ut)g(we)g(guess)g(it)h(is)g(related)
2037 e(to)h(a)0 880 y(greater)26 b(management)f(o)o(v)o(erhead)f(in)k(the)f
2038 Fp(ucontext)p Fx(\(3\))e(f)o(a-)0 980 y(cility)-5 b(,)16
2039 b(which)f(is)i(a)f(superset)f(of)g(the)h(functionality)e(we)h
2040 (require\).)0 1079 y(Or)h(in)g(short:)22 b(our)15 b(presented)g(f)o
2041 (allback)g(approach)e(costs)j(notice-)0 1179 y(able)24
2042 b(e)o(xtra)g(CPU)h(c)o(ycles)f(on)g(thread)f(creation)g(time,)i(b)n(ut)
2043 g(is)g(as)0 1279 y(f)o(ast)17 b(as)g(the)g(standardized)d(solution)i
2044 (under)f(thread)g(dispatching)0 1378 y(time.)p 0 1492
2045 1899 4 v 0 2931 4 1440 v 78 1562 a Fn(10000)j Ff(\002)e
2046 Fn(mctx)p 475 1562 20 4 v 25 w(cr)o(eate)j(\(in)e(seconds\):)78
2047 1710 y(Platf)n(orm)p 827 1734 4 79 v 561 w(mcsc)p 1080
2048 1734 V 165 w(sjlj)p 1332 1734 V 103 w(o)o(v)o(erhead)78
2049 1789 y Fm(Sun)g(Solaris)h(2.6)f(\(SP)-6 b(ARC\))p 827
2050 1813 V 133 w(0.076)p 1080 1813 V 104 w(1.268)p 1332 1813
2051 V 247 w(16.7)78 1868 y(DEC)16 b(T)n(ru64)h(5.0)g(\(Alpha\))p
2052 827 1892 V 171 w(0.019)p 1080 1892 V 104 w(0.235)p 1332
2053 1892 V 247 w(12.4)78 1947 y(SGI)g(IRIX)g(6.5)f(\(MIPS\))p
2054 827 1971 V 227 w(0.105)p 1080 1971 V 104 w(1.523)p 1332
2055 1971 V 247 w(14.5)78 2026 y(SCO)h(UnixW)-5 b(are)18 b(7.0)e(\(Intel\))p
2056 827 2050 V 105 w(0.204)p 1080 2050 V 104 w(3.827)p 1332
2057 2050 V 247 w(18.8)78 2105 y(HP)h(HP/UX)f(11.0)h(\(HPP)-6
2058 b(A\))p 827 2128 V 144 w(0.057)p 1080 2128 V 104 w(0.667)p
2059 1332 2128 V 247 w(11.8)1192 2184 y Fn(A)f(v)o(erage:)89
2060 b(14.8)78 2311 y(10000)18 b Ff(\002)e Fn(mctx)p 475 2311
2061 20 4 v 25 w(switch)i(\(in)f(seconds\):)78 2410 y(Platf)n(orm)p
2062 827 2433 4 79 v 561 w(mcsc)p 1080 2433 V 165 w(sjlj)p
2063 1332 2433 V 103 w(o)o(v)o(erhead)78 2488 y Fm(Sun)g(Solaris)h(2.6)f
2064 (\(SP)-6 b(ARC\))p 827 2512 V 133 w(0.137)p 1080 2512
2065 V 104 w(0.210)p 1332 2512 V 281 w(1.5)78 2567 y(DEC)16
2066 b(T)n(ru64)h(5.0)g(\(Alpha\))p 827 2591 V 171 w(0.034)p
2067 1080 2591 V 104 w(0.022)p 1332 2591 V 281 w(0.6)78 2646
2068 y(SGI)g(IRIX)g(6.5)f(\(MIPS\))p 827 2670 V 227 w(0.235)p
2069 1080 2670 V 104 w(0.190)p 1332 2670 V 281 w(0.8)78 2725
2070 y(SCO)h(UnixW)-5 b(are)18 b(7.0)e(\(Intel\))p 827 2749
2071 V 105 w(0.440)p 1080 2749 V 104 w(0.398)p 1332 2749 V
2072 281 w(0.9)78 2804 y(HP)h(HP/UX)f(11.0)h(\(HPP)-6 b(A\))p
2073 827 2828 V 144 w(0.106)p 1080 2828 V 104 w(0.065)p 1332
2074 2828 V 281 w(0.6)1225 2883 y Fn(A)f(v)o(erage:)90 b(0.9)p
2075 1896 2931 4 1440 v 0 2934 1899 4 v 0 3022 a(T)-6 b(able)18
2076 b(3:)67 b Fm(Summary)20 b(of)h Fl(Simple)i(Mac)o(hine)g(Conte)o(xt)g
2077 (Benc)o(hmark)g Fm(\(SMCB,)295 3090 y([32]\).)d(The)d(speed)g(of)g
2078 (machine)h(conte)o(xt)h(creation)g(and)e(switching)295
2079 3158 y(found)25 b(on)g(each)h(tested)g(operating)i(system.)44
2080 b Fn(mcsc)p Fm(:)38 b(functional)295 3226 y Fh(makecontext)p
2081 Fm(\(3\))11 b(/)i Fh(switchcontext)p Fm(\(3\),)f Fn(sjlj)p
2082 Fm(:)20 b(functional)295 3293 y Fh(sigsetjmp)p Fm(\(3\)/)p
2083 Fh(siglongjmp)p Fm(\(3\).)58 b Fn(o)o(v)o(erhead)p Fm(:)49
2084 b(the)31 b(o)o(v)o(er)o(-)295 3359 y(head)18 b(of)f(using)g
2085 Fn(sjlj)g Fm(instead)i(of)e Fn(mcsc)p Fm(.)0 3573 y FA(3.5)99
2086 b(Remaining)25 b(Issues)0 3730 y Fx(The)20 b(presented)e(algorithm)h
2087 (and)g(source)g(code)h(can)f(be)h(directly)0 3829 y(used)29
2088 b(in)h(practice)f(for)f(implementing)g(a)i(minimal)e(threading)0
2089 3929 y(system)e(or)g(the)g(concept)e(of)i(co-routines.)40
2090 b(Its)27 b(big)f(adv)n(antage)0 4029 y(is)20 b(that)f(if)g(the)g
2091 (operating)e(system)i(pro)o(vides)e(the)i(required)e(stan-)0
2092 4128 y(dardized)j(primiti)n(v)o(es,)g(we)h(do)g(not)g(need)f(to)i(kno)n
2093 (w)e(an)o(ything)f(at)0 4228 y(all)28 b(about)e(the)h(machine)g(we)g
2094 (are)g(running)f(on)g(\227)i(e)n(v)o(erything)0 4327
2095 y(just)d(w)o(orks.)38 b(Ne)n(v)o(ertheless,)25 b(there)f(remain)g(a)h
2096 (fe)n(w)f(special)h(is-)0 4427 y(sues)c(we)f(still)i(ha)n(v)o(e)d(to)i
2097 (discuss.)0 4577 y FA(The)26 b(W)-6 b(aggly)23 b(longjmp\(3\))i(after)h
2098 (Retur)o(n)0 4702 y Fx(On)e(some)f(platforms,)h Fp(longjmp)p
2099 Fx(\(3\))e(may)h(not)g(be)h(called)g(af-)0 4802 y(ter)30
2100 b(the)g(function)e(which)i(called)f(the)h Fp(setjmp)p
2101 Fx(\(3\))f(returned.)0 4902 y(When)22 b(this)i(is)f(done,)f(the)h
2102 (stack)g(frame)e(situation)i(is)g(not)f(guar)n(-)0 5001
2103 y(anteed)k(to)h(be)g(in)f(a)i(clean)e(and)g(consistent)h(state.)45
2104 b(But)27 b(this)h(is)0 5101 y(e)o(xactly)c(the)h(mechanism)f(we)h(use)g
2105 (in)g(order)f(to)h(get)g(rid)g(of)g(the)0 5200 y(signal)20
2106 b(handler)f(scope)h(in)g(step)g(5.)125 5300 y(The)c(only)g(alternati)n
2107 (v)o(e)g(w)o(ould)g(be)h(to)g(lea)n(v)o(e)g(the)g(signal)f(han-)0
2108 5400 y(dler)27 b(via)g Fp(longjmp)p Fx(\(3\),)g(b)n(ut)g(then)g(we)h(w)
2109 o(ould)e(ha)n(v)o(e)h(another)2025 83 y(problem,)f(as)h(e)o(xperience)d
2110 (sho)n(wed.)41 b(F)o(or)26 b(instance,)j(R)q Fm(O)t(B)t(E)t(RT)2027
2111 183 y Fx(S)t(.)k(T)t Fm(H)t(AU)r Fx(')-5 b(s)29 b Fr(Really)e(Simple)g
2112 (Thr)m(eads)h Fx(\()p Fr(r)o(sthr)m(eads)p Fx(\))f([27)o(])h(w)o(as)
2113 2025 282 y(ported)17 b(to)h(se)n(v)o(eral)f(platforms)g(and)g(w)o(as)i
2114 (used)f(to)g(run)f(an)h(e)o(xper)n(-)2025 382 y(imental)23
2115 b(multithreaded)d(v)o(ersion)i(of)h(the)g(Apache)f(webserv)o(er)-5
2116 b(.)2027 482 y(T)t Fm(H)t(AU)r Fx(')g(s)18 b(approach)d(w)o(as)i
2117 (similar)g(to)g(ours,)g(b)n(ut)f(dif)n(fered)f(signif-)2025
2118 581 y(icantly)k(in)h(the)f(w)o(ay)g(the)h(signal)f(handler)f(is)i
2119 (left.)25 b(In)19 b(particular)m(,)2025 681 y(in)27 b(an)f(attempt)g
2120 (to)h(a)n(v)n(oid)f(the)g(unsafe)g(stack)h(frame,)g(it)g(used)f(a)2025
2121 780 y Fp(longjmp)p Fx(\(3\))19 b(call)i(to)g(lea)n(v)o(e)f(the)h
2122 (signal)f(handler)m(,)f(rather)h(than)2025 880 y(returning)27
2123 b(from)h(it.)51 b(But)30 b(this)f(approach)e(does)h(not)h(w)o(ork)f(on)
2124 2025 980 y(some)20 b Fr(SysV)6 b Fx(-deri)n(v)o(ed)18
2125 b(k)o(ernels,)h(as)i(we)g(already)e(mentioned.)2150 1079
2126 y(The)31 b(problem)e(is)k(that)e(these)h(k)o(ernels)f(do)g(not)g
2127 (\223belie)n(v)o(e\224)2025 1179 y(that)e(the)g(code)g(is)h(out)e(of)h
2128 (the)g(signal-handling)e(conte)o(xt,)i(un-)2025 1279
2129 y(til)k(the)f(signal)f(handler)g(has)h(returned)e(\227)i(and)g
2130 (accordingly)-5 b(,)2025 1378 y(refuse)28 b(to)g(allo)n(w)g
2131 (readjustment)f(of)g(the)i(signal)f(stack)g(until)g(it)2025
2132 1478 y(has.)61 b(But)32 b(with)g(the)h Fr(r)o(sthr)m(eads)f
2133 Fx(approach,)g(the)h(signal)e(han-)2025 1577 y(dler)23
2134 b(that)f(created)h(the)f(\002rst)i(thread)e(ne)n(v)o(er)f(returns,)i
2135 (and)f(when)2025 1677 y Fr(r)o(sthr)m(eads)17 b Fx(w)o(ants)g(to)g
2136 (create)g(the)g(second)f(thread,)g(these)h(k)o(ernels)2025
2137 1777 y(refuse)23 b(to)g(readjust)g(the)h(signal)f(stack,)h(and)f(we)h
2138 (are)f(stuck.)34 b(So)2025 1876 y(with)17 b(portability)e(in)i(mind,)f
2139 (we)h(decided)e(that)i(it)g(is)h(better)e(to)h(get)2025
2140 1976 y(rid)23 b(of)f(the)h(signal)g(handler)f(scope)g(with)h(the)g
2141 (straight-forw)o(ard)2025 2076 y(\223)p Fp(return)p Fx(\224)38
2142 b(and)h(instead)g(\002ght)g(the)g(mentioned)f(\(simpler\))2025
2143 2175 y(problem)18 b(of)i(an)h(unsafe)e(stack)h(frame.)2150
2144 2275 y(F)o(ortunately)-5 b(,)24 b(in)i(practice)e(this)i(is)h(not)e(as)
2145 h(problematic)e(as)2025 2374 y(it)j(seems,)h(because)e(e)n(v)n
2146 (aluations)f(\(for)h Fr(GNU)h(Pth)p Fx(\))f(on)g(a)h(wide)2025
2147 2474 y(range)35 b(of)g(current)g(Unix)g(platforms)g(sho)n(wed)g(that)h
2148 (one)f(can)2025 2574 y(reach)21 b(a)g(safe)h(stack)f(frame)f(again)h
2149 (by)f(just)i(calling)f(a)h(function.)2025 2673 y(That)k(is)i(the)e
2150 (reason)g(why)f(our)h(algorithm)f(enters)h(the)g(second)2025
2151 2773 y(trampoline)18 b(function)h(in)h(step)h(9.)2025
2152 2918 y FA(The)26 b(Uncooperati)o(v)o(e)g(longjmp\(3\))2025
2153 3040 y Fx(Ev)o(en)e(on)i(operating)d(systems)j(which)f(ha)n(v)o(e)g(w)o
2154 (orking)f Fr(POSIX)2025 3140 y Fx(functions,)c(our)g(approach)f(may)h
2155 (theoretically)g(still)i(not)e(w)o(ork,)2025 3240 y(because)48
2156 b Fp(longjmp)p Fx(\(3\))f(does)i(not)f(cooperate.)109
2157 b(F)o(or)49 b(in-)2025 3339 y(stance,)17 b(on)e(some)h(platforms)f(the)
2158 h(standard)f Fr(libc)i Fp(longjmp)p Fx(\(3\))2025 3439
2159 y(branches)d(to)h(error)n(-handling)d(code)j(if)g(it)h(detects)g(that)f
2160 (the)h(caller)2025 3539 y(tries)j(to)h(jump)e Fr(up)g
2161 Fx(the)h(stack,)g Fr(i.e)o(.)p Fx(,)g(into)g(a)g(stack)g(frame)f(that)h
2162 (has)2025 3638 y(already)g(returned.)2150 3738 y(This)28
2163 b(is)h(usually)f(implemented)f(by)h(comparing)e(the)i(cur)n(-)2025
2164 3837 y(rent)f(stack)g(pointer)f(to)h(the)g(one)f(in)h(the)g
2165 Fp(jmp)p 3387 3837 25 4 v 30 w(buf)g Fx(structure.)2025
2166 3937 y(That)j(is)h(why)e(it)i(is)g(important)e(for)g(our)h(algorithm)e
2167 (to)j(return)2025 4037 y(from)19 b(the)g(signal)h(handler)e(and)h(this)
2168 h(w)o(ay)f(enter)g(the)h(\(dif)n(ferent\))2025 4136 y(stack)31
2169 b(of)g(the)h(parent)e(thread.)57 b(In)31 b(practice,)i(the)e(implemen-)
2170 2025 4236 y(tation)26 b(in)g Fr(GNU)h(Pth)f Fx(sho)n(wed)g(that)g(then)
2171 g(one)f(no)h(longer)f(suf-)2025 4336 y(fers)16 b(from)f(those)g
2172 (uncooperati)n(v)o(e)d Fp(longjmp)p Fx(\(3\))i(implementa-)2025
2173 4435 y(tions,)k(b)n(ut)f(one)f(should)h(k)o(eep)f(this)i(point)e(in)i
2174 (mind)e(when)h(reach-)2025 4535 y(ing)29 b(e)n(v)o(en)f(more)h
2175 (uncooperati)n(v)o(e)d(v)n(ariants)j(on)g(esoteric)g(Unix)2025
2176 4634 y(platforms.)22 b(If)16 b(it)h(still)g(occurs,)f(one)g(can)g(only)
2177 f(try)h(to)g(resume)g(the)2025 4734 y(operation)24 b(by)h(using)f(a)i
2178 (possibly)f(e)o(xisting)g(platform-speci\002c)2025 4834
2179 y(error)19 b(handling)f(hook.)2025 4979 y FA(Garbage)25
2180 b(at)g(Bottom)g(of)g(Stacks)2025 5101 y Fx(There)17 b(is)i(a)f(subtle)f
2181 (side-ef)n(fect)g(of)g(our)g(implementation:)22 b(there)2025
2182 5201 y(remains)16 b(some)h(garbage)e(at)j(the)f(bottom)e(of)i(each)g
2183 (thread)f(stack.)2025 5300 y(The)33 b(reason)g(is)i(that)e(if)h(a)g
2184 (signal)g(is)g(deli)n(v)o(ered,)h(the)f(operat-)2025
2185 5400 y(ing)d(system)g(pushes)f(some)h(state)h(onto)e(the)h(stack,)i
2186 (which)e(is)p Black 1929 5700 a(8)p Black eop
2187 %%Page: 9 9
2188 9 8 bop Black Black 0 83 a Fx(restored)27 b(later)m(,)j(when)e(the)h
2189 (signal)f(handler)f(returns.)48 b(But)29 b(al-)0 183
2190 y(though)h(we)h(return)f(from)h(the)g(signal)g(handler)m(,)h(we)g(jump)
2191 e(in)0 282 y(again,)c(and)g(this)h(time)f(we)g(enter)g(not)g(directly)f
2192 (at)i(the)f(bottom)0 382 y(of)17 b(the)g(stack,)g(because)f(of)h(the)g
2193 Fp(setjmp)p Fx(\(3\))e(in)i(the)g(trampoline)0 482 y(function.)125
2194 587 y(Since)31 b(the)h(operating)d(system)j(has)f(to)h(capture)e(all)j
2195 (CPU)0 687 y(re)o(gisters)22 b(\(including)d(those)j(that)g(are)g
2196 (ordinarily)e(scratch)i(re)o(g-)0 787 y(isters)f(or)f(caller)n(-sa)n(v)
2197 o(e)g(re)o(gisters\),)f(there)h(can)g(be)g(a)h(f)o(air)f(amount)0
2198 886 y(of)h(memory)e(at)i(the)h(bottom)d(of)i(the)g(established)g
2199 (thread)f(stack.)0 986 y(F)o(or)d(some)h(systems)g(this)g(can)g(be)g(e)
2200 n(v)o(en)e(up)i(to)g(1)g(KB)g(of)g(garbage)0 1085 y([27)o(].)25
2201 b(But)19 b(e)o(xcept)g(for)f(the)i(additional)d(memory)h(consumption)0
2202 1185 y(it)j(does)f(not)g(hurt.)125 1291 y(W)-7 b(e)32
2203 b(just)g(ha)n(v)o(e)f(to)h(k)o(eep)f(in)h(mind)f(this)h(additional)e
2204 (stack)0 1391 y(consumption)25 b(when)j(deciding)e(the)i(stack)g(size)h
2205 (\()p Fr(sk)p 1569 1391 25 4 v 29 w(size)p Fx(\).)49
2206 b(A)0 1490 y(reasonable)23 b(stack)i(size)g(usually)f(is)i(between)e
2207 (16)g(and)g(32)g(KB.)0 1590 y(Less)31 b(is)h(neither)e(reasonable)f
2208 (nor)h(al)o(w)o(ays)h(allo)n(wed)f(\(current)0 1689 y(Unix)c(platforms)
2209 f(usually)h(require)f(a)i(stack)g(to)f(be)h(at)g(least)g(16)0
2210 1789 y(KB)21 b(in)f(size\).)0 1957 y FA(Stack)26 b(Ov)o(er\003o)o(ws)0
2211 2094 y Fx(There)47 b(is)j(a)e(noticeable)f(dif)n(ference)g(between)g
2212 (the)h(initial)0 2193 y Fp(main)p Fx(\(\))29 b(thread)f(and)h(the)h(e)o
2213 (xplicitly)f(spa)o(wned)f(threads:)44 b(the)0 2293 y(initial)31
2214 b(thread)f(runs)g(on)h(the)f(standard)g(process)g(stack.)57
2215 b(This)0 2393 y(stack)43 b(automatically)e(can)h(gro)n(w)g(under)f
2216 (Unix,)47 b(while)c(the)0 2492 y(stacks)22 b(of)g(the)g(spa)o(wned)f
2217 (threads)g(are)h(\002x)o(ed)f(in)h(size.)31 b(So)22 b(stack)0
2218 2592 y(o)o(v)o(er\003o)n(ws)k(can)h(occur)f(for)h(the)g(spa)o(wned)f
2219 (threads.)45 b(This)28 b(im-)0 2692 y(plies)g(that)g(the)g(parent)f
2220 (has)h(to)h(mak)o(e)e(a)h(reasonable)f(guess)h(of)0 2791
2221 y(the)22 b(threads)f(stack)h(space)g(requirement)d(already)i(at)h(spa)o
2222 (wning)0 2891 y(time.)125 2997 y(And)g(there)g(is)i(no)e(really)h
2223 (portable)e(solution)h(to)h(this)g(prob-)0 3096 y(lem,)32
2224 b(because)d(e)n(v)o(en)f(if)i(the)g(thread)f(library')-5
2225 b(s)28 b(scheduler)h(can)0 3196 y(detect)16 b(the)g(stack)g(o)o(v)o
2226 (er\003o)n(w)-5 b(,)15 b(it)i(cannot)e(easily)h(resize)g(the)h(stack.)0
2227 3296 y(The)34 b(reason)g(is)h(simply)f(that)g(the)h(stack)f
2228 (initialization)g(goes)0 3395 y(hand)26 b(in)h(hand)f(with)i(the)f
2229 (initialization)f(of)h(the)g(start)h(routine,)0 3495
2230 y(as)d(we)g(discussed)f(before.)36 b(And)24 b(this)h(start)g(routine)e
2231 (has)i(to)g(be)0 3594 y(a)e(real)g(C)h(function)d(in)i(order)f(to)g
2232 Fr(call)p Fx(.)33 b(But)24 b(once)e(the)h(thread)f(is)0
2233 3694 y(running,)i(there)g(no)h(longer)f(e)o(xists)h(such)g(an)g(entry)f
2234 (point.)39 b(So,)0 3794 y(e)n(v)o(en)30 b(if)h(the)g(scheduler)f(w)o
2235 (ould)g(be)h(able)f(to)h(gi)n(v)o(e)g(the)g(thread)0
2236 3893 y(a)g(ne)n(w)g(enlar)o(ged)e(stack,)34 b(there)c(is)i(no)e(chance)
2237 g(to)i(restart)f(the)0 3993 y(thread)19 b(on)h(this)h(ne)n(w)f(stack.)
2238 125 4099 y(Or)i(more)f(correct,)g(there)g(is)i(no)f Fr(portable)f
2239 Fx(w)o(ay)h(to)g(achie)n(v)o(e)0 4198 y(it.)j(As)18 b(with)g(the)g(pre)
2240 n(vious)e(problems,)g(there)h(is)i(a)f(non-portable)0
2241 4298 y(solution.)49 b(That)28 b(is)i(why)d(our)h(implementation)e(did)j
2242 (not)f(deal)0 4398 y(with)g(this)h(issue.)48 b(Instead)28
2243 b(in)g(practice)f(one)g(usually)h(lets)h(the)0 4497 y(scheduler)16
2244 b(just)h(detect)g(the)g(stack)h(o)o(v)o(er\003o)n(w)d(and)h(terminate)h
2245 (the)0 4597 y(thread.)25 b(This)c(is)h(done)d(by)i(using)f(a)h(red)f
2246 (zone)g(at)h(the)g(top)f(of)h(the)0 4696 y(stack)i(which)g(is)h(mark)o
2247 (ed)e(with)h(a)h(magic)e(v)n(alue)h(the)g(scheduler)0
2248 4796 y(checks)d(between)f(thread)g(dispatching)g(operations.)125
2249 4902 y(Resizing)g(solutions)f(are)h(only)f(possible)h(in)g
2250 (semi-portable)0 5001 y(w)o(ays.)39 b(One)25 b(approach)e(is)j(to)f
2251 (place)f(the)h(thread)f(stacks)i(into)e(a)0 5101 y(memory)g(mapped)h
2252 (area)h(\(see)h Fp(mmap)p Fx(\(2\)\))d(of)i(the)g(process)g(ad-)0
2253 5201 y(dress)31 b(space)f(and)g(let)h(the)g(scheduler)e(catch)i
2254 Fp(SIGSEGV)e Fx(sig-)0 5300 y(nals.)70 b(When)34 b(such)h(a)g(signal)g
2255 (occurs,)j(because)c(of)h(a)g(stack)0 5400 y(o)o(v)o(er\003o)n(w)i(in)j
2256 (this)f(area,)44 b(the)39 b(scheduler)f(e)o(xplicitly)g(resizes)2025
2257 83 y(the)c(memory)e(mapped)h(area.)66 b(This)34 b(resizing)g(can)g(be)g
2258 (done)2025 183 y(either)e(by)f(cop)o(ying)f(the)i(stack)h(contents)e
2259 (into)h(a)g(ne)n(w)g(lar)o(ger)2025 282 y(area)c(which)g(is)h(then)f
2260 (re-mapped)e(to)i(the)h(old)f(address)g(or)g(via)2025
2261 382 y(an)k(e)n(v)o(en)f(more)g(ele)o(gant)f(w)o(ay)-5
2262 b(,)34 b(as)f(the)f(v)o(endor)d(threading)h(li-)2025
2263 482 y(braries)e(of)g Fr(Sun)f(Solaris)p Fx(,)j Fr(F)-5
2264 b(r)m(eeBSD)28 b Fx(and)g Fr(DEC)h(T)-5 b(ru64)28 b Fx(do)g(it:)2025
2265 581 y(the)j(thread)g(stacks)h(are)f(allocated)g(inside)g(memory)f
2266 (mapped)2025 681 y(areas)g(which)f(are)h(already)e(initially)i(a)g(fe)n
2267 (w)g(MB)g(in)g(\(virtual\))2025 780 y(size)25 b(and)f(then)g(one)h
2268 (just)g(relies)g(on)f(the)g(virtual)g(memory)f(sys-)2025
2269 880 y(tem')-5 b(s)31 b(feature)e(that)h(only)f(the)h(actually)g
2270 (consumed)e(memory)2025 980 y(space)20 b(is)h(mapped.)2025
2271 1149 y FA(Startup)26 b(Routine)g(T)-9 b(ermination)2025
2272 1287 y Fx(There)48 b(is)i(a)g(cruel)e Fp(abort)p Fx(\(3\))g(call)h(at)h
2273 (the)f(end)g(of)f(our)2025 1387 y Fp(mctx)p 2230 1387
2274 V 29 w(create)p 2559 1387 V 29 w(boot)d Fx(function.)97
2275 b(This)45 b(means,)50 b(if)c(the)2025 1486 y(startup)18
2276 b(routine)g(w)o(ould)g(return,)f(the)i(process)f(is)i(aborted.)j(That)
2277 2025 1586 y(is)29 b(ob)o(viously)e(not)h(reasonable,)h(so)f(why)g(ha)n
2278 (v)o(e)g(we)h(written)f(it)2025 1685 y(this)21 b(w)o(ay?)2150
2279 1792 y(If)15 b(the)g(thread)f(returns)h(from)f(the)h(startup)g
2280 (routine,)g(it)h(should)2025 1891 y(be)22 b(cleanly)f(terminated.)29
2281 b(But)23 b(it)g(cannot)e(terminate)g(itself)i(\(for)2025
2282 1991 y(instance,)g(because)f(it)h(cannot)f(free)g(its)i(o)n(wn)e(stack)
2283 h(while)g(run-)2025 2091 y(ning)31 b(on)g(it,)j Fr(etc.)p
2284 Fx(\).)59 b(So)31 b(the)h(termination)e(handling)f(actually)2025
2285 2190 y(is)g(the)f(task)g(of)g(the)f(thread)g(library)g(scheduler)-5
2286 b(.)47 b(As)29 b(a)f(conse-)2025 2290 y(quence,)21 b(the)h(thread)f
2287 (spa)o(wning)g(function)f(of)i(a)h(thread)e(library)2025
2288 2389 y(should)e(be)h(not)g(directly)g Fp(mctx)p 2973
2289 2389 V 29 w(create)p Fx(.)2150 2496 y(Instead)27 b(the)g(thread)g(spa)o
2290 (wning)f(function)g(should)h(use)h(an)2025 2595 y(additional)17
2291 b(trampoline)g(function)f(as)j(the)g(higher)n(-le)n(v)o(el)d(startup)
2292 2025 2695 y(routine.)23 b(And)18 b(this)h(trampoline)e(function)g
2293 (performs)g(a)i(conte)o(xt)2025 2795 y(switch)26 b(back)f(into)h(the)f
2294 (thread)g(library)g(scheduler)f(before)h(the)2025 2894
2295 y(lo)n(wer)n(-le)n(v)o(el)f(startup)h(routine)f(w)o(ould)g(return.)39
2296 b(The)25 b(scheduler)2025 2994 y(then)g(can)h(safely)f(remo)o(v)o(e)f
2297 (the)i(thread)e(and)h(its)i(machine)d(con-)2025 3094
2298 y(te)o(xt.)35 b(That)24 b(is)g(why)f(the)h Fp(abort)p
2299 Fx(\(3\))e(call)i(is)h(ne)n(v)o(er)d(reached)g(in)2025
2300 3193 y(practice)27 b(\(more)f(details)i(can)f(be)h(found)d(in)j(the)f
2301 (implementa-)2025 3293 y(tions)22 b(of)f Fp(pth)p 2455
2302 3293 V 29 w(spawn)h Fx(and)f Fp(pth)p 3048 3293 V 29
2303 w(exit)g Fx(in)h Fp(pth)p 3535 3293 V 30 w(lib.c)f Fx(of)2025
2304 3392 y Fr(GNU)g(Pth)f Fx([25)o(]\))2025 3562 y FA(The)26
2305 b(sigstack\(2\))f(F)n(allback)f(Situation)2025 3700 y
2306 Fx(Not)37 b(all)h(platforms)e(pro)o(vide)g(the)h(standardized)e
2307 Fp(sigalt-)2025 3799 y(stack)p Fx(\(2\).)d(Instead)22
2308 b(the)o(y)g(at)i(least)g(pro)o(vide)c(the)j Fr(4.2BSD)f
2309 Fx(an-)2025 3899 y(cestor)i(function)f Fp(sigstack)p
2310 Fx(\(2\).)35 b(But)24 b(one)g(cannot)f(tri)n(vially)2025
2311 3999 y(replace)c Fp(sigaltstack)p Fx(\(2\))e(by)i Fp(sigstack)p
2312 Fx(\(2\))f(in)i(this)g(sit-)2025 4098 y(uation,)c(because)f(in)i
2313 (contrast)e(to)i Fp(sigaltstack)p Fx(\(2\),)d(the)i(old)2025
2314 4198 y Fp(sigstack)p Fx(\(2\))34 b(does)h(not)g(automatically)g(handle)
2315 f(the)i(ma-)2025 4297 y(chine)20 b(dependent)e(direction)g(of)i(stack)h
2316 (gro)n(wth.)2150 4404 y(Instead,)44 b(the)c(caller)g(has)g(to)g(kno)n
2317 (w)f(the)h(direction)f(and)2025 4503 y(al)o(w)o(ays)52
2318 b(call)f Fp(sigstack)p Fx(\(2\))e(with)j(the)f(address)g(of)g(the)2025
2319 4603 y(bottom)h(of)g(the)h(stack.)123 b(So,)61 b(in)54
2320 b(a)f(real-w)o(orld)e(imple-)2025 4703 y(mentation)38
2321 b(one)h(\002rst)h(has)g(to)g(determine)e(the)i(direction)e(of)2025
2322 4802 y(stack)i(gro)n(wth)e(in)i(order)f(to)h(use)g Fp(sigstack)p
2323 Fx(\(2\))d(as)k(a)f(re-)2025 4902 y(placement)49 b(for)h
2324 Fp(sigaltstack)p Fx(\(2\).)113 b(F)o(ortunately)49 b(this)2025
2325 5001 y(is)55 b(easier)e(than)h(it)g(seems)g(on)f(the)h(\002rst)g(look)f
2326 (\(for)g(de-)2025 5101 y(tails)43 b(see)g(the)f(macros)f
2327 Fp(AC)p 2886 5101 V 30 w(CHECK)p 3166 5101 V 29 w(STACKGROWTH)f
2328 Fx(and)2025 5201 y Fp(AC)p 2130 5201 V 30 w(CHECK)p 2410
2329 5201 V 28 w(STACKSETUP)33 b Fx(in)h(\002le)h Fp(aclocal.m4)e
2330 Fx(from)2025 5300 y Fr(GNU)24 b(Pth)f Fx([25)o(]\).)33
2331 b(Alternati)n(v)o(ely)21 b(if)j(one)e(can)h(af)n(ford)f(to)h(w)o(aste)
2332 2025 5400 y(memory)-5 b(,)16 b(one)h(can)h(use)g(an)g(ele)o(gant)f
2333 (trick:)24 b(to)18 b(set)h(up)e(a)i(stack)f(of)p Black
2334 1929 5700 a(9)p Black eop
2335 %%Page: 10 10
2336 10 9 bop Black Black 0 83 a Fx(size)21 b Fe(N)9 b Fx(,)21
2337 b(one)f(allocates)g(a)h(chunk)e(of)h(memory)f(\(starting)h(at)h(ad-)0
2338 183 y(dress)c Fe(A)p Fx(\))h(of)f(size)h Fe(N)f Fd(\002)8
2339 b Fc(2)17 b Fx(and)f(then)h(calls)h Fp(sigstack)p Fx(\(2\))d(with)0
2340 282 y(the)20 b(parameters)f Fr(sk)p 581 282 25 4 v 30
2341 w(addr=)p Fe(A)d Fc(+)h Fe(N)30 b Fx(and)19 b Fr(sk)p
2342 1291 282 V 30 w(size=)p Fe(N)9 b Fx(,)21 b Fr(i.e)o(.)p
2343 Fx(,)e(one)0 382 y(speci\002es)29 b(the)g(middle)g(of)f(the)h(memory)e
2344 (chunk)h(as)h(the)g(stack)0 482 y(base.)0 651 y FA(The)d(Blind)g(Alley)
2345 e(of)h(Brain-Dead)h(Platf)n(orms)0 789 y Fx(The)31 b(w)o(orld)g(w)o
2346 (ould)f(not)i(be)f(as)h(funn)o(y)d(as)j(it)g(is,)j(if)d(really)f(all)0
2347 888 y(Unix)f(platforms)e(w)o(ould)i(be)g(f)o(air)g(to)g(us.)55
2348 b(Instead,)31 b(currently)0 988 y(at)24 b(least)g(one)e(platform)g(e)o
2349 (xists)i(which)f(plays)g(unf)o(air:)30 b(unfortu-)0 1088
2350 y(nately)-5 b(,)26 b(ancient)e(v)o(ersions)h(of)g(the)g(popular)f
2351 Fr(GNU/Linux)p Fx(.)40 b(Al-)0 1187 y(though)21 b(we)i(will)h(disco)o
2352 (v)o(er)d(that)i(it)h(both)e(pro)o(vides)f Fp(sigalt-)0
2353 1287 y(stack)p Fx(\(2\))c(and)i Fp(sigstack)p Fx(\(2\),)d(our)j
2354 (approach)d(w)o(on')o(t)i(w)o(ork)0 1387 y(on)27 b Fr(Linux)g
2355 Fx(k)o(ernels)g(prior)f(to)i(v)o(ersion)e(2.2)g(and)h
2356 Fr(glibc)g Fx(prior)f(to)0 1486 y(v)o(ersion)19 b(2.1.)125
2357 1592 y(Why?)42 b(Because)26 b(its)h Fr(libc)g Fx(pro)o(vides)d(only)h
2358 (stubs)i(of)e(these)0 1692 y(functions)h(which)i(al)o(w)o(ays)g(return)
2359 f(just)h Fp(-1)g Fx(with)g Fp(errno)g Fx(set)0 1792 y(to)g
2360 Fp(ENOSYS)p Fx(.)f(So,)j(this)e(de\002nitely)f(means)g(that)h(our)f
2361 (nifty)g(al-)0 1891 y(gorithm)40 b(is)i(useless)h(there,)j(because)40
2362 b(its)j(central)e(point)g Fr(is)0 1991 y Fp(sigaltstack)p
2363 Fx(\(2\)/)p Fp(sigstack)p Fx(\(2\).)31 b(Ne)n(v)o(ertheless)23
2364 b(we)h(do)0 2091 y(not)17 b(need)g(to)h(gi)n(v)o(e)f(up.)23
2365 b(At)18 b(least)h(not,)e(if)h(we,)g(for)f(a)h(single)g(brain-)0
2366 2190 y(dead)29 b(platform,)i(accept)f(to)g(break)f(our)g(general)g
2367 (goal)g(of)h(not)0 2290 y(using)20 b(an)o(y)f(platform)g(dependent)f
2368 (code.)125 2396 y(So,)g(what)h(can)g(we)g(actually)f(do)g(here?)24
2369 b(All)19 b(we)g(ha)n(v)o(e)f(to)h(do,)0 2496 y(is)f(to)f(\002ddle)g
2370 (around)e(a)j(little)g(bit)f(with)h(the)f(machine-dependent)0
2371 2595 y Fp(jmp)p 155 2595 V 29 w(buf)23 b Fx(ingredients)f(\(by)h
2372 (poking)e(around)g(in)i Fp(setjmp.h)0 2695 y Fx(or)16
2373 b(by)f(disassembling)g Fp(longjmp)p Fx(\(3\))f(in)j(the)f(deb)n
2374 (ugger\).)21 b(Usu-)0 2795 y(ally)e(one)f(just)h(has)g(to)f(do)g(a)h
2375 Fp(setjmp)p Fx(\(3\))e(to)i(get)f(an)h(initial)g(state)0
2376 2894 y(in)24 b(the)g Fp(jmp)p 370 2894 V 29 w(buf)g Fx(structure)f(and)
2377 h(then)f(manually)f(adjust)i(tw)o(o)0 2994 y(of)34 b(its)h(\002elds:)54
2378 b(the)35 b(program)d(counter)g(\(usually)i(a)h(structure)0
2379 3094 y(member)29 b(with)i(\223)p Fp(pc)p Fx(\224)g(in)g(the)f(name\))g
2380 (and)g(the)h(stack)g(pointer)0 3193 y(\(usually)19 b(a)i(structure)e
2381 (member)g(with)h(\223)p Fp(sp)p Fx(\224)g(in)h(the)f(name\).)125
2382 3299 y(That)f(is)i(all)f(and)f(can)g(be)h(acceptable)e(for)h(a)i
2383 (real-w)o(orld)d(im-)0 3399 y(plementation)e(which)g(really)i(w)o(ants)
2384 f(to)h(co)o(v)o(er)e(mostly)h Fr(all)h Fx(plat-)0 3499
2385 y(forms)f(\226)i(at)f(least)h(as)g(long)e(as)i(the)f(special)h
2386 (treatment)e(is)i(needed)0 3598 y(just)31 b(for)f(one)h(or)f(tw)o(o)h
2387 (platforms.)56 b(But)31 b(one)f(has)h(to)g(k)o(eep)f(in)0
2388 3698 y(mind)e(that)h(it)h(at)g(least)f(breaks)g(one)f(of)h(the)g
2389 (initial)g(goals)g(and)0 3798 y(has)20 b(to)h(be)f(treated)g(as)g(a)h
2390 (last)g(chance)e(solution.)0 3967 y FA(Functions)26 b(sigsetjmp\(3\))f
2391 (and)g(siglongjmp\(3\))125 4105 y Fx(One)42 b(certainly)f(w)o(ants)i
2392 (the)g Fr(POSIX)i Fx(thread)d(semantics)0 4204 y(where)50
2393 b(a)h(thread)e(has)i(its)g(o)n(wn)f(signal)g(mask.)115
2394 b(As)51 b(al-)0 4304 y(ready)36 b(mentioned,)i(on)e(some)h(platforms)e
2395 Fp(setjmp)p Fx(\(3\))g(and)0 4404 y Fp(longjmp)p Fx(\(3\))e(do)h(not)h
2396 (pro)o(vide)d(this)j(and)g(instead)f(one)g(has)0 4503
2397 y(to)23 b(e)o(xplicitly)f(call)i Fp(sigsetjmp)p Fx(\(3\))d(and)h
2398 Fp(siglongjmp)p Fx(\(3\))0 4603 y(instead.)111 b(There)49
2399 b(is)h(only)e(one)g(snare:)83 b(on)49 b(some)g(plat-)0
2400 4703 y(forms)36 b Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p
2401 Fx(\(3\))31 b(sa)n(v)o(e)36 b(also)h(in-)0 4802 y(formation)g(about)i
2402 (the)g(alternate)g(signals)h(stack.)82 b(So)40 b(here)0
2403 4902 y(one)45 b(has)h(to)f(mak)o(e)g(sure)g(that)h(although)e(the)h
2404 (thread)f(dis-)0 5001 y(patching)36 b(later)i(uses)g
2405 Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p Fx(\(3\),)0
2406 5101 y(the)43 b(thread)f(creation)g(step)h(in)g Fp(mctx)p
2407 1197 5101 V 29 w(create)g Fx(still)h(uses)0 5201 y(plain)h
2408 Fp(setjmp)p Fx(\(3\)/)p Fp(longjmp)p Fx(\(3\))d(calls)k(for)f(the)h
2409 (trampo-)0 5300 y(line)g(trick.)100 b(One)46 b(just)g(has)g(to)g(be)f
2410 (careful)g(because)g(the)0 5400 y Fp(jmp)p 155 5400 V
2411 29 w(buf)20 b Fx(and)e Fp(sigjmp)p 793 5400 V 29 w(buf)i
2412 Fx(structures)e(cannot)g(be)i(mix)o(ed)2025 83 y(between)28
2413 b(calls)h(to)g(the)g Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p
2414 Fx(\(3\))2025 183 y(and)20 b Fp(setjmp)p Fx(\(3\)/)p
2415 Fp(longjmp)p Fx(\(3\).)2025 340 y FA(Mor)n(e)25 b(Machine)h(Context)g
2416 (Ingr)n(edients)2025 470 y Fx(Finally)-5 b(,)33 b(for)d(a)h(real-w)o
2417 (orld)f(threading)f(implementation)f(one)2025 570 y(usually)j(w)o(ants)
2418 h(to)g(put)f(more)g(state)h(into)f(the)h(machine)e(con-)2025
2419 670 y(te)o(xt)43 b(structure)f Fp(mctx)p 2731 670 V 29
2420 w(t)p Fx(.)94 b(F)o(or)42 b(instance)h(to)g(ful\002ll)g(more)2025
2421 769 y Fr(POSIX)25 b Fx(threading)20 b(semantics,)i(it)g(is)h
2422 (reasonable)d(to)i(also)g(sa)n(v)o(e)2025 869 y(and)37
2423 b(restore)g(the)g(global)g Fp(errno)g Fx(v)n(ariable.)76
2424 b(All)38 b(this)g(can)2025 968 y(be)32 b(easily)h(achie)n(v)o(ed)e(by)h
2425 (e)o(xtending)e(the)j Fp(mctx)p 3503 968 V 29 w(t)g Fx(structure)2025
2426 1068 y(with)d(additional)f(\002elds)h(and)f(by)h(making)e(the)i
2427 Fp(mctx)p 3656 1068 V 29 w(save)p Fx(,)2025 1168 y Fp(mctx)p
2428 2230 1168 V 29 w(restore)38 b Fx(and)h Fp(mctx)p 3007
2429 1168 V 29 w(switch)f Fx(functions)g(to)h(be)2025 1267
2430 y(a)o(w)o(are)20 b(of)g(them.)2025 1520 y FA(3.6)99 b(Related)26
2431 b(W)-7 b(ork)2025 1681 y Fx(Beside)38 b Fr(GNU)h(Pth)e
2432 Fx([25)o(],)42 b(there)37 b(are)h(other)f(multithreading)2025
2433 1781 y(libraries)c(which)f(use)i(v)n(ariants)e(of)h(the)g(presented)f
2434 (approach)2025 1880 y(for)23 b(implementing)e(machine)h(conte)o(xts)h
2435 (in)g(user)n(-space.)34 b(Most)2025 1980 y(notably)40
2436 b(there)g(are)j(R)q Fm(O)t(B)t(E)t(RT)k Fx(S)t(.)f(T)t
2437 Fm(H)t(AU)r Fx(')-5 b(s)42 b Fr(Really)f(Simple)2025
2438 2079 y(Thr)m(eads)18 b Fx(\()p Fr(r)o(sthr)m(eads)p Fx(,)h([27)o(]\))f
2439 (package)f(which)h(uses)h Fp(sigalt-)2025 2179 y(stack)p
2440 Fx(\(2\))h(in)i(a)g(v)o(ery)f(similar)h(w)o(ay)f(for)h(thread)e
2441 (creation,)h(and)2027 2279 y(K)r Fm(O)q(T)n(A)h Fx(A)t
2442 Fm(B)t(E)r Fx(')-5 b(s)19 b Fr(P)-7 b(ortable)17 b(Thr)m(ead)g(Libr)o
2443 (ary)g Fx(\()p Fr(PTL)p Fx(,)h([24)o(]\))f(which)2025
2444 2378 y(uses)30 b(a)g Fp(sigstack)p Fx(\(2\))d(approach.)51
2445 b(But)30 b(because)f(their)g(ap-)2025 2478 y(proaches)14
2446 b(handle)h(the)h(signal)g(handler)e(scope)h(dif)n(ferently)-5
2447 b(,)14 b(the)o(y)2025 2578 y(are)30 b(not)g(able)h(to)f(achie)n(v)o(e)f
2448 (the)i(same)f(amount)f(of)h(portability)2025 2677 y(and)23
2449 b(this)h(w)o(ay)f(do)g(not)g(w)o(ork)g(for)g(instance)g(on)g(some)g
2450 (System-)2025 2777 y(V)-8 b(-deri)n(v)o(ed)18 b(platforms.)2025
2451 3030 y FA(3.7)99 b(Summary)26 b(&)f(A)-10 b(v)o(ailability)2025
2452 3190 y Fx(W)j(e)22 b(ha)n(v)o(e)e(presented)f(a)i(pragmatic)f(and)g
2453 (mostly)g(portable)g(f)o(all-)2025 3290 y(back)e(approach)e(for)i
2454 (implementing)e(the)j(machine)e(conte)o(xt)g(for)2025
2455 3390 y(user)n(-space)30 b(threads,)j(based)e(entirely)f(on)g(Unix)h
2456 (system)g(and)2025 3489 y(ANSI-C)24 b(language)d(f)o(acilities.)35
2457 b(The)23 b(approach)e(w)o(as)j(success-)2025 3589 y(fully)i(tested)h
2458 (in)g(practice)f(on)h(a)g(wide)g(range)e(of)i(Unix)f(\003a)n(v)n(ors)
2459 2025 3689 y(by)17 b Fr(GNU)h(Pth)f Fx(and)g(should)f(also)h(adapt)g(to)
2460 g(the)h(remaining)d(Unix)2025 3788 y(platforms)f(as)i(long)f(as)h(the)o
2461 (y)f(adhere)f(to)i(the)f(rele)n(v)n(ant)g(standards.)2150
2462 3891 y(The)50 b Fr(GNU)i(Pth)e Fx(package)g(is)h(distrib)n(uted)f
2463 (under)g(the)2025 3990 y(GNU)32 b(Library)f(General)g(Public)g(License)
2464 h(\(LGPL)f(2.1\))g(and)2025 4090 y(freely)40 b(a)n(v)n(ailable)h(from)e
2465 Fr(http://www)-6 b(.gnu.or)m(g/softwar)m(e/pth/)2025
2466 4189 y Fx(and)20 b Fr(ftp://ftp.gnu.or)m(g/gnu/pth/)p
2467 Fx(.)2025 4442 y FA(3.8)99 b(Ackno)o(wledgements)2025
2468 4603 y Fx(I)17 b(w)o(ould)f(lik)o(e)h(to)f(thank)i(R)q
2469 Fm(O)t(B)t(E)t(RT)k Fx(S)t(.)f(T)t Fm(H)t(AU)r Fx(,)f(D)q
2470 Fm(A)-5 b(V)t(I)t(D)22 b Fx(B)s Fm(U)t(T)t(E)t(N)t Fx(-)2027
2471 4703 y Fm(H)t(O)t(F)r Fx(,)k(M)t Fm(A)t(RT)t(I)t(N)i
2472 Fx(K)t Fm(R)t(A)t(E)t(M)t(E)t(R)r Fx(,)f(E)t Fm(R)t(I)t(C)h
2473 Fx(N)t Fm(E)t(W)t(T)s(O)t(N)d Fx(and)g(B)t Fm(R)q(U)t(N)t(O)2027
2474 4802 y Fx(H)t Fm(A)t(I)t(B)t(L)t(E)33 b Fx(for)c(their)g(comments)g
2475 (which)h(helped)e(to)i(write)h(the)2025 4902 y(initial)d(v)o(ersion)f
2476 (of)g(this)h(paper)-5 b(.)48 b(Additionally)-5 b(,)27
2477 b(credit)g(has)h(to)2025 5001 y(be)21 b(gi)n(v)o(en)e(to)k(C)t
2478 Fm(H)t(R)t(I)t(S)t(T)s(O)t(P)t(H)t(E)t(R)j Fx(S)t Fm(M)t(A)t(L)t(L)d
2479 Fx(and)d(the)g(USENIX)h(re-)2025 5101 y(vie)n(wers)f(for)g(their)g(in)m
2480 (v)n(aluable)e(feedback)h(which)g(allo)n(wed)h(this)2025
2481 5201 y(paper)28 b(to)h(be)f(e)o(xtended,)h(cleaned)f(up)g(and)h
2482 (\002nally)f(published)2025 5300 y(at)c(the)f(USENIX)g(Annual)f(T)-6
2483 b(echnical)22 b(Conference)g(2000.)32 b(Fi-)2025 5400
2484 y(nally)-5 b(,)27 b(thanks)e(go)h(to)h(all)f(users)h(of)f
2485 Fr(GNU)h(Pth)f Fx(for)f(their)h(feed-)p Black 1908 5700
2486 a(10)p Black eop
2487 %%Page: 11 11
2488 11 10 bop Black Black 0 83 a Fx(back)19 b(on)f(the)i(implementation,)c
2489 (which)j(helped)f(in)i(\002ne-tuning)0 183 y(the)g(presented)f
2490 (approach.)927 b([)p Fb(rse)p Fx(])0 446 y Fs(Refer)n(ences)p
2491 Black 71 615 a Fv([1])p Black 41 w Fu(POSIX)18 b(1003.1c)j(Thr)m
2492 (eading)p Fv(,)e(IEEE)f(POSIX)f(1003.1c-1995,)199 706
2493 y(ISO/IEC)g(9945-1:1996)p Black 71 821 a([2])p Black
2494 43 w(M)t(.)t(E)t(.)46 b(C)t Fa(O)t(N)t(W)m(A)n(Y)r Fv(:)70
2495 b Fu(Design)44 b(of)f(a)h(separ)o(able)h(tr)o(ansition-)199
2496 913 y(dia)o(gr)o(am)20 b(compiler)-8 b(.)p Fv(,)19 b(Comm.)f(A)m(CM)h
2497 (6:7,)g(1963,)h(p.396-408)p Black 71 1028 a([3])p Black
2498 43 w(E)t(.)t(W)m(.)h(D)t Fa(I)t(J)t(K)t(S)t(T)t(R)t(A)r
2499 Fv(:)f Fu(Co-oper)o(ating)g(sequential)g(pr)m(ocesses)p
2500 Fv(,)g(in)199 1119 y(F)-6 b(.)24 b(Genuys)j(\(Ed.\),)e
2501 Fu(Pr)m(o)o(gr)o(amming)h(Langua)o(g)o(es)p Fv(,)j(N)m(A)-8
2502 b(T)o(O)24 b(Ad-)199 1211 y(v)n(anced)f(Study)f(Institute,)f(Academic)i
2503 (Press,)e(London,)i(1965,)199 1302 y(p.42-112.)p Black
2504 71 1417 a([4])p Black 43 w(B)t(.)34 b(N)t Fa(I)t(C)t(H)t(O)t(L)t(S)t
2505 Fv(,)i(D)t(.)e(B)s Fa(U)t(T)t(T)t(L)t(A)t(R)t Fv(,)h(J)t(.)t(P)l(.)e(F)
2506 o Fa(A)t(R)t(R)t(E)t(L)r Fv(:)45 b Fu(Pthr)m(eads)199
2507 1509 y(Pr)m(o)o(gr)o(amming)23 b(-)g(A)e(POSIX)h(Standar)m(d)j(for)d
2508 (Better)g(Multipr)m(o-)199 1600 y(cessing)p Fv(,)e(O'Reilly)-5
2509 b(,)18 b(1996;)h(ISBN)f(1-56592-115-1)p Black 71 1715
2510 a([5])p Black 43 w(B)t(.)27 b(L)t Fa(E)t(W)t(I)t(S)t
2511 Fv(,)g(D)t(.)f(J)t(.)h(B)t Fa(E)t(R)t(G)r Fv(:)k Fu(Thr)m(eads)25
2512 b(Primer)f(-)f(A)h(Guide)g(T)-7 b(o)199 1807 y(Multithr)m(eaded)19
2513 b(Pr)m(o)o(gr)o(amming)p Fv(,)f(Prentice)f(Hall,)f(1996;)j(ISBN)199
2514 1898 y(0-13-443698-9)p Black 71 2013 a([6])p Black 43
2515 w(S)t(.)g(J)t(.)g(N)t Fa(O)t(RT)s(O)t(N)t Fv(,)f(M)t(.)i(D)t(.)f(D)t
2516 Fa(I)t(P)o(A)t(S)t(Q)s(U)r(A)t(L)t(E)r Fv(:)f Fu(Thr)m(ead)f(T)l(ime)e
2517 (-)h(The)199 2105 y(Multithr)m(eaded)g(Pr)m(o)o(gr)o(amming)g(Guide)p
2518 Fv(,)f(Prentice)f(Hall,)h(1997;)199 2196 y(ISBN)j(0-13-190067-6)p
2519 Black 71 2312 a([7])p Black 43 w(D)t(.)24 b(R)t(.)g(B)s
2520 Fa(U)t(T)t(E)t(N)t(H)t(O)t(F)r Fv(:)g Fu(Pr)m(o)o(gr)o(amming)e(with)e
2521 (POSIX)g(Thr)m(eads)p Fv(,)199 2403 y(Addison)g(W)-6
2522 b(esle)o(y)h(,)19 b(1997;)g(ISBN)f(0-201-63392-2)p Black
2523 71 2518 a([8])p Black 43 w(S)t(.)27 b(P)t Fa(R)t(A)t(S)t(A)t(D)r
2524 Fv(:)32 b Fu(Multithr)m(eading)26 b(Pr)m(o)o(gr)o(amming)f(T)-7
2525 b(ec)o(hniques)p Fv(,)199 2610 y(McGra)o(w-Hill,)18 b(1996;)i(ISBN)e
2526 (0-079-12250-7)p Black 71 2725 a([9])p Black 43 w(S)t(.)32
2527 b(K)t Fa(L)t(E)t(I)t(N)t(M)t(A)t(N)t Fv(,)g(B)t(.)h(S)t
2528 Fa(M)t(A)t(L)t(D)t(E)t(R)t(S)t Fv(,)e(D)t(.)i(S)t Fa(H)t(A)t(H)r
2529 Fv(:)43 b Fu(Pr)m(o)o(gr)o(am-)199 2816 y(ming)29 b(with)e(Thr)m(eads)p
2530 Fv(,)k(Prentice)d(Hall,)i(1995;)k(ISBN)27 b(0-131-)199
2531 2908 y(72389-8)p Black 33 3023 a([10])p Black 44 w(C)t(.)t(J)t(.)40
2532 b(N)t Fa(O)t(RT)t(H)t(R)r(U)t(P)r Fv(:)58 b Fu(Pr)m(o)o(gr)o(amming)38
2533 b(W)l(ith)g(Unix)f(Thr)m(eads)p Fv(,)199 3114 y(John)20
2534 b(W)m(ile)o(y)e(&)h(Sons,)g(1996;)h(ISBN)d(0-471-13751-0)p
2535 Black 33 3230 a([11])p Black 44 w(P)l(.)29 b(B)r Fa(A)t(RT)s(O)t(N)t
2536 Fv(-)t(D)q Fa(A)l(V)t(I)t(S)t Fv(,)g(D)t(.)g(M)t Fa(C)t
2537 Fv(N)r Fa(A)t(M)t(E)t(E)t Fv(,)g(R)t(.)h(V)-5 b Fa(A)t(S)t(W)m(A)t(N)t
2538 (I)t Fv(,)30 b(E)t(.)201 3321 y(L)t Fa(A)t(Z)t(O)r(W)t(S)t(K)t(A)r
2539 Fv(:)19 b Fu(Adding)d(Sc)o(heduler)g(Activations)f(to)f(Mac)o(h)i(3.0)p
2540 Fv(,)199 3412 y(Uni)n(v)o(ersity)27 b(of)g(W)-6 b(ashington,)29
2541 b(1992;)j(T)-5 b(echnical)27 b(Report)f(92-)199 3504
2542 y(08-03)p Black 33 3619 a([12])p Black 44 w(D)t(.)18
2543 b(S)t Fa(T)t(E)t(I)t(N)t Fv(,)e(D)t(.)h(S)t Fa(H)t(A)t(H)r
2544 Fv(:)j Fu(Implementing)c(Lightwight)e(Thr)m(eads)p Fv(,)199
2545 3710 y(SunSoft)19 b(Inc.,)f(1992)i(\(published)g(at)f(USENIX'92\).)p
2546 Black 33 3826 a([13])p Black 44 w(W)m(.)t(R)t(.)t(S)t
2547 Fa(T)t(E)t(V)t(E)t(N)t(S)r Fv(:)48 b Fu(Advanced)35 b(Pr)m(o)o(gr)o
2548 (amming)g(in)f(the)h(Unix)199 3917 y(En)m(vir)m(onment)p
2549 Fv(,)58 b(Addison-W)-6 b(esle)o(y)h(,)58 b(1992;)66 b(ISBN)49
2550 b(0-201-)199 4008 y(56317-7)p Black 33 4124 a([14])p
2551 Black 44 w(D)t(.)42 b(L)t Fa(E)t(W)t(I)t(N)t(E)r Fv(:)59
2552 b Fu(POSIX)38 b(Pr)m(o)o(gr)o(ammer')m(s)h(Guide:)63
2553 b(Writing)199 4215 y(P)-6 b(ortable)34 b(Unix)g(Pr)m(o)o(gr)o(ams)p
2554 Fv(,)k(O'Reilly)33 b(&)h(Associates,Inc.,)199 4306 y(1994;)20
2555 b(ISBN)e(0-937175-73-0)p Black 33 4422 a([15])p Black
2556 44 w(B)t Fa(RY)m(A)t(N)137 b Fv(O)t(')t(S)t Fa(U)t(L)t(L)t(I)t(V)l(A)t
2557 (N)r Fv(:)250 b Fu(F)l(r)m(equently)136 b(ask)o(ed)199
2558 4513 y(questions)187 b(for)e(comp.os.r)m(esear)m(c)o(h)p
2559 Fv(,)229 b(1995;)199 4604 y(http://www)-5 b(.serpentine.com/)p
2560 Fk(\230)p Fv(bos/os-f)o(aq/,)199 4696 y
2561 (ftp://rtfm.mit.edu/pub/usenet/comp.os.research/)p Black
2562 33 4811 a([16])p Black 44 w(S)t Fa(U)t(N)24 b Fv(M)t
2563 Fa(I)t(C)t(R)r(O)t(S)t(Y)t(S)t(T)t(E)t(M)t(S)t Fv(,)e(I)t
2564 Fa(N)t(C)r Fv(:)27 b Fu(Thr)m(eads)22 b(F)l(r)m(equently)g(Ask)o(ed)199
2565 4902 y(Questions)p Fv(,)111 b(1995,)f(http://www.sun.com/w)o(orkshop/-)
2566 199 4994 y(threads/f)o(aq.html)p Black 2058 83 a([17])p
2567 Black 44 w(B)t Fa(RY)m(A)t(N)78 b Fv(O)t(')t(S)t Fa(U)t(L)t(L)t(I)t(V)l
2568 (A)t(N)r Fv(:)132 b Fu(F)l(r)m(equently)76 b(ask)o(ed)g(ques-)2224
2569 174 y(tions)134 b(for)g(comp.pr)m(o)o(gr)o(amming)o(.thr)m(eads)p
2570 Fv(,)165 b(1997;)2224 266 y(http://www)-5 b(.serpentine.com/)p
2571 Fk(\230)p Fv(bos/threads-f)o(aq/.)p Black 2058 410 a([18])p
2572 Black 44 w(B)t Fa(I)t(L)83 b Fv(L)t Fa(E)t(W)t(I)t(S)r
2573 Fv(:)144 b Fu(F)l(r)m(equently)82 b(ask)o(ed)f(questions)h(for)2224
2574 502 y(comp.pr)m(o)o(gr)o(amming)o(.thr)m(eads)p Fv(,)213
2575 b(1999;)250 b(http://-)2224 593 y(www)-5 b(.lambdacs.com/ne)n
2576 (wsgroup/F)f(A)l(Q.html)p Black 2058 738 a([19])p Black
2577 44 w(N)t Fa(U)t(M)t(E)t(R)t(I)t(C)57 b Fv(Q)s Fa(U)t(E)t(S)t(T)h
2578 Fv(I)t Fa(N)t(C)r Fv(:)96 b Fu(Multithr)m(eading)58 b(-)e(De\002ni-)
2579 2224 829 y(tions)k(and)h(Guidelines)p Fv(;)81 b(1998;)g(http://www)-5
2580 b(.numeric-)2224 920 y(quest.com/lang/multi-frame.html)p
2581 Black 2058 1065 a([20])p Black 44 w(T)t Fa(H)t(E)42 b
2582 Fv(O)t Fa(P)t(E)t(N)f Fv(G)t Fa(R)r(O)t(U)t(P)r Fv(:)62
2583 b Fu(The)39 b(Single)h(Unix)f(Speci\002cation,)2224 1156
2584 y(V)-8 b(er)o(sion)46 b(2)g(-)f(Thr)m(eads)p Fv(;)60
2585 b(1997;)f(http://www.opengroup-)2224 1248 y(.or)o
2586 (g/onlinepubs/007908799/xsh/threads.html)p Black 2058
2587 1393 a([21])p Black 44 w(S)t Fa(U)t(N)41 b Fv(M)t Fa(I)t(C)t(R)r(O)t(S)
2588 t(Y)t(S)t(T)t(E)t(M)t(S)d Fv(I)t Fa(N)t(C)r Fv(:)61 b
2589 Fu(SMI)39 b(Thr)m(ead)g(Resour)m(ces)p Fv(;)2224 1484
2590 y(http://www)-5 b(.sun.com/w)o(orkshop/threads)p Black
2591 2058 1629 a([22])p Black 44 w(F)t Fa(R)t(A)t(N)t(K)29
2592 b Fv(M)t Fa(U)t(E)t(L)t(L)t(E)t(R)r Fv(:)35 b Fu(FSU)26
2593 b(pthr)m(eads)p Fv(;)32 b(1997;)g(http://www-)2224 1720
2594 y(.cs.fsu.edu/)p Fk(\230)p Fv(mueller/pthreads/)p Black
2595 2058 1865 a([23])p Black 44 w(C)t Fa(H)t(R)t(I)t(S)85
2596 b Fv(P)t Fa(R)r(O)q(V)t(E)t(N)t(Z)t(A)t(N)t(O)r Fv(:)145
2597 b Fu(MIT)82 b(pthr)m(eads)p Fv(;)115 b(1993;)2224 1956
2598 y(http://www)-5 b(.mit.edu/people/prov)o(en/pthreads.html)2224
2599 2047 y(\(old\),)209 b(http://www.humanf)o(actor.com/pthreads/mit-)2224
2600 2139 y(pthreads.html)20 b(\(updated\))p Black 2058 2283
2601 a([24])p Black 44 w(K)r Fa(O)r(T)n(A)29 b Fv(A)t Fa(B)t(E)r
2602 Fv(:)35 b Fu(P)-6 b(ortable)27 b(Thr)m(eading)g(Libr)o(ary)g
2603 Fv(\(PTL\);)d(1999;)2224 2375 y(http://www.media.osaka-cu.ac.jp/)p
2604 Fk(\230)p Fv(k-abe/PTL/)p Black 2058 2519 a([25])p Black
2605 44 w(R)t Fa(A)t(L)t(F)19 b Fv(S)t(.)h(E)t Fa(N)t(G)t(E)t(L)t(S)t(C)t(H)
2606 t(A)t(L)t(L)r Fv(:)d Fu(GNU)g(P)-6 b(ortable)17 b(Thr)m(eads)h
2607 Fv(\(Pth\);)2224 2611 y(1999;)55 b(http://www.gnu.or)o(g/softw)o
2608 (are/pth/,)47 b(ftp://ftp.gnu-)2224 2702 y(.or)o(g/gnu/pth/)p
2609 Black 2058 2847 a([26])p Black 44 w(M)t Fa(I)t(C)t(H)t(A)t(E)t(L)36
2610 b Fv(T)n(.)i(P)t Fa(E)t(T)t(E)t(R)t(S)t(O)t(N)r Fv(:)50
2611 b Fu(POSIX)34 b(and)h(DCE)f(Thr)m(eads)2224 2938 y(F)-8
2612 b(or)57 b(Linux)h Fv(\(PCThreads\);)75 b(1995;)j(http://members.aa-)
2613 2224 3029 y(.net/)p Fk(\230)p Fv(mtp/PCthreads.html)p
2614 Black 2058 3174 a([27])p Black 44 w(R)q Fa(O)t(B)t(E)t(RT)27
2615 b Fv(S)t(.)h(T)t Fa(H)t(A)q(U)r Fv(:)35 b Fu(Really)25
2616 b(Simple)g(Thr)m(eads)i Fv(\(rsthreads\);)2224 3265 y(1996;)20
2617 b(ftp://ftp.ai.mit.edu/pub/rst/)p Black 2058 3410 a([28])p
2618 Black 44 w(J)t Fa(O)t(H)t(N)94 b Fv(B)t Fa(I)t(R)t(R)t(E)t(L)t(L)r
2619 Fv(:)163 b Fu(F)l(r)m(eeBSD)91 b(uthr)m(eads)p Fv(;)129
2620 b(1998;)2224 3502 y(ftp://ftp.freebsd.or)o(g/pub/FreeBSD/FreeBSD-)2224
2621 3593 y(current/src/lib/libc)p 2780 3593 23 4 v 27 w(r/uthread/)p
2622 Black 2058 3738 a([29])p Black 44 w(X)t Fa(A)l(V)t(I)t(E)t(R)46
2623 b Fv(L)t Fa(E)t(R)r(O)q(Y)r Fv(:)70 b Fu(The)44 b(LinuxThr)m(eads)h
2624 (libr)o(ary)p Fv(;)57 b(1999;)2224 3829 y(http://pauillac.inria.fr/)p
2625 Fk(\230)p Fv(xlero)o(y/linuxthreads/)p Black 2058 3974
2626 a([30])p Black 44 w(I)t(B)t(M)r(:)17 b Fu(AIX)h(V)-8
2627 b(er)o(sion)18 b(4.3)h(Gener)o(al)g(Pr)m(o)o(gr)o(amming)g(Concepts:)
2628 2224 4065 y(Writing)56 b(and)g(Deb)o(ug)o(ging)h(Pr)m(o)o(gr)o(ams;)74
2629 b(Under)o(standing)2224 4156 y(Thr)m(eads)p Fv(;)41 b(1998;)h
2630 (http://www.rs6000.ibm.com/doc)p 3714 4156 V 28 w(link/-)2224
2631 4248 y(en)p 2298 4248 V 28 w(US/a)p 2476 4248 V 26 w(doc)p
2632 2609 4248 V 28 w(lib/aixpr)o(ggd/genprogc/understanding-)p
2633 2224 4339 V 2247 4339 a(threads.htm)p Black 2058 4484
2634 a([31])p Black 42 w Fu(Netscape)110 b(P)-6 b(ortable)110
2635 b(Runtime)f Fv(\(NSPR\);)f(http://-)2224 4575 y(www)-5
2636 b(.mozilla.or)o(g/docs/refList/refNSPR/,)246 b(http://-)2224
2637 4666 y(lxr)l(.mozilla.or)o(g/seamonk)o(e)o(y/source/nsprpub/)p
2638 Black 2058 4811 a([32])p Black 44 w(R)t Fa(A)t(L)t(F)45
2639 b Fv(S)t(.)f(E)t Fa(N)t(G)t(E)t(L)t(S)t(C)t(H)t(A)t(L)t(L)r
2640 Fv(:)65 b Fu(Simple)42 b(Mac)o(hine)h(Conte)o(xt)2224
2641 4902 y(Benc)o(hmark)q Fv(;)73 b(2000;)f(http://www)-5
2642 b(.gnu.or)o(g/softw)o(are/pth-)2224 4994 y(/smcb)m(.tar)l(.gz)p
2643 Black 1908 5700 a Fx(11)p Black eop
2644 %%Trailer
2645 end
2646 userdict /end-hook known{end-hook}if
2647 %%EOF