OSSP CVS Repository

ossp - Check-in [5428]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5428
Date: 2000-Jun-18 11:12:35 (local)
2000-Jun-18 09:12:35 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/pth/rse-pmt.ps      added-> 1.8

ossp-pkg/pth/rse-pmt.ps -> 1.8

*** /dev/null    Sun Apr 28 02:15:31 2024
--- -    Sun Apr 28 02:16:30 2024
***************
*** 0 ****
--- 1,2647 ----
+ %!PS-Adobe-2.0
+ %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software
+ %%Title: pmt.dvi
+ %%Pages: 11
+ %%PageOrder: Ascend
+ %%BoundingBox: 0 0 612 792
+ %%DocumentFonts: Times-Bold Times-Roman Times-Italic Helvetica-Bold
+ %%+ Courier Times-BoldItalic Courier-Bold Courier-BoldOblique Helvetica
+ %%EndComments
+ %DVIPSWebPage: (www.radicaleye.com)
+ %DVIPSCommandLine: dvips -t letter pmt.dvi
+ %DVIPSParameters: dpi=600, compressed
+ %DVIPSSource:  TeX output 2000.06.18:1110
+ %%BeginProcSet: texc.pro
+ %!
+ /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
+ N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
+ mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
+ 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
+ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
+ mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
+ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
+ exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
+ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
+ N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
+ /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
+ /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
+ array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
+ df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
+ definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
+ }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
+ B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
+ 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
+ 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx
+ 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx
+ sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{
+ rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp
+ gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B
+ /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{
+ /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{
+ A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy
+ get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse}
+ ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp
+ fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17
+ {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add
+ chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{
+ 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop}
+ forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
+ /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
+ }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
+ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
+ mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
+ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
+ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
+ 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
+ index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
+ /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{
+ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT)
+ (LaserWriter 16/600)]{A length product length le{A length product exch 0
+ exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse
+ end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask
+ grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot}
+ imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round
+ exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto
+ fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p
+ 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}
+ 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{
+ 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
+ rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
+ 
+ %%EndProcSet
+ %%BeginProcSet: 8r.enc
+ % @@psencodingfile@{
+ %   author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry",
+ %   version = "0.6",
+ %   date = "1 July 1998",
+ %   filename = "8r.enc",
+ %   email = "tex-fonts@@tug.org",
+ %   docstring = "Encoding for TrueType or Type 1 fonts
+ %                to be used with TeX."
+ % @}
+ % 
+ % Idea is to have all the characters normally included in Type 1 fonts
+ % available for typesetting. This is effectively the characters in Adobe
+ % Standard Encoding + ISO Latin 1 + extra characters from Lucida.
+ % 
+ % Character code assignments were made as follows:
+ % 
+ % (1) the Windows ANSI characters are almost all in their Windows ANSI
+ % positions, because some Windows users cannot easily reencode the
+ % fonts, and it makes no difference on other systems. The only Windows
+ % ANSI characters not available are those that make no sense for
+ % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen
+ % (173). quotesingle and grave are moved just because it's such an
+ % irritation not having them in TeX positions.
+ % 
+ % (2) Remaining characters are assigned arbitrarily to the lower part
+ % of the range, avoiding 0, 10 and 13 in case we meet dumb software.
+ % 
+ % (3) Y&Y Lucida Bright includes some extra text characters; in the
+ % hopes that other PostScript fonts, perhaps created for public
+ % consumption, will include them, they are included starting at 0x12.
+ % 
+ % (4) Remaining positions left undefined are for use in (hopefully)
+ % upward-compatible revisions, if someday more characters are generally
+ % available.
+ % 
+ % (5) hyphen appears twice for compatibility with both 
+ % ASCII and Windows.
+ % 
+ /TeXBase1Encoding [
+ % 0x00 (encoded characters from Adobe Standard not in Windows 3.1)
+   /.notdef /dotaccent /fi /fl
+   /fraction /hungarumlaut /Lslash /lslash
+   /ogonek /ring /.notdef
+   /breve /minus /.notdef 
+ % These are the only two remaining unencoded characters, so may as
+ % well include them.
+   /Zcaron /zcaron 
+ % 0x10
+  /caron /dotlessi 
+ % (unusual TeX characters available in, e.g., Lucida Bright)
+  /dotlessj /ff /ffi /ffl 
+  /.notdef /.notdef /.notdef /.notdef
+  /.notdef /.notdef /.notdef /.notdef
+  % very contentious; it's so painful not having quoteleft and quoteright
+  % at 96 and 145 that we move the things normally found there to here.
+  /grave /quotesingle 
+ % 0x20 (ASCII begins)
+  /space /exclam /quotedbl /numbersign
+  /dollar /percent /ampersand /quoteright
+  /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
+ % 0x30
+  /zero /one /two /three /four /five /six /seven
+  /eight /nine /colon /semicolon /less /equal /greater /question
+ % 0x40
+  /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O
+ % 0x50
+  /P /Q /R /S /T /U /V /W
+  /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
+ % 0x60
+  /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o
+ % 0x70
+  /p /q /r /s /t /u /v /w
+  /x /y /z /braceleft /bar /braceright /asciitilde
+  /.notdef % rubout; ASCII ends
+ % 0x80
+  /.notdef /.notdef /quotesinglbase /florin
+  /quotedblbase /ellipsis /dagger /daggerdbl
+  /circumflex /perthousand /Scaron /guilsinglleft
+  /OE /.notdef /.notdef /.notdef
+ % 0x90
+  /.notdef /.notdef /.notdef /quotedblleft
+  /quotedblright /bullet /endash /emdash
+  /tilde /trademark /scaron /guilsinglright
+  /oe /.notdef /.notdef /Ydieresis
+ % 0xA0
+  /.notdef % nobreakspace
+  /exclamdown /cent /sterling
+  /currency /yen /brokenbar /section
+  /dieresis /copyright /ordfeminine /guillemotleft
+  /logicalnot
+  /hyphen % Y&Y (also at 45); Windows' softhyphen
+  /registered
+  /macron
+ % 0xD0
+  /degree /plusminus /twosuperior /threesuperior
+  /acute /mu /paragraph /periodcentered
+  /cedilla /onesuperior /ordmasculine /guillemotright
+  /onequarter /onehalf /threequarters /questiondown
+ % 0xC0
+  /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
+  /Egrave /Eacute /Ecircumflex /Edieresis
+  /Igrave /Iacute /Icircumflex /Idieresis
+ % 0xD0
+  /Eth /Ntilde /Ograve /Oacute
+  /Ocircumflex /Otilde /Odieresis /multiply
+  /Oslash /Ugrave /Uacute /Ucircumflex
+  /Udieresis /Yacute /Thorn /germandbls
+ % 0xE0
+  /agrave /aacute /acircumflex /atilde
+  /adieresis /aring /ae /ccedilla
+  /egrave /eacute /ecircumflex /edieresis
+  /igrave /iacute /icircumflex /idieresis
+ % 0xF0
+  /eth /ntilde /ograve /oacute
+  /ocircumflex /otilde /odieresis /divide
+  /oslash /ugrave /uacute /ucircumflex
+  /udieresis /yacute /thorn /ydieresis
+ ] def
+ 
+ %%EndProcSet
+ %%BeginProcSet: texps.pro
+ %!
+ TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2
+ index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll
+ exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics
+ exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub
+ dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}
+ ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict
+ end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{
+ dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1
+ roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def
+ dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}
+ if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}
+ def end
+ 
+ %%EndProcSet
+ %%BeginProcSet: special.pro
+ %!
+ TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N
+ /vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N
+ /rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N
+ /@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{
+ /hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho
+ X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B
+ /@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{
+ /urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known
+ {userdict/md get type/dicttype eq{userdict begin md length 10 add md
+ maxlength ge{/md md dup length 20 add dict copy def}if end md begin
+ /letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S
+ atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{
+ itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll
+ transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll
+ curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf
+ pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}
+ if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1
+ -1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3
+ get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip
+ yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub
+ neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{
+ noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop
+ 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get
+ neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr
+ 1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr
+ 2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4
+ -1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S
+ TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{
+ Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale
+ }if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState
+ save N userdict maxlength dict begin/magscale true def normalscale
+ currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts
+ /psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x
+ psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx
+ psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub
+ TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{
+ psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2
+ roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath
+ moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict
+ begin/SpecialSave save N gsave normalscale currentpoint TR
+ @SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{
+ CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
+ closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx
+ sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR
+ }{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse
+ CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury
+ lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N
+ /@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end}
+ repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N
+ /@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX
+ currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY
+ moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X
+ /yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0
+ 1 startangle endangle arc savematrix setmatrix}N end
+ 
+ %%EndProcSet
+ %%BeginProcSet: color.pro
+ %!
+ TeXDict begin/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop
+ setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll
+ }repeat setrgbcolor pop}ifelse}B}ifelse/TeXcolorcmyk{setcmykcolor}def
+ /TeXcolorrgb{setrgbcolor}def/TeXcolorgrey{setgray}def/TeXcolorgray{
+ setgray}def/TeXcolorhsb{sethsbcolor}def/currentcmykcolor where{pop}{
+ /currentcmykcolor{currentrgbcolor 10}B}ifelse/DC{exch dup userdict exch
+ known{pop pop}{X}ifelse}B/GreenYellow{0.15 0 0.69 0 setcmykcolor}DC
+ /Yellow{0 0 1 0 setcmykcolor}DC/Goldenrod{0 0.10 0.84 0 setcmykcolor}DC
+ /Dandelion{0 0.29 0.84 0 setcmykcolor}DC/Apricot{0 0.32 0.52 0
+ setcmykcolor}DC/Peach{0 0.50 0.70 0 setcmykcolor}DC/Melon{0 0.46 0.50 0
+ setcmykcolor}DC/YellowOrange{0 0.42 1 0 setcmykcolor}DC/Orange{0 0.61
+ 0.87 0 setcmykcolor}DC/BurntOrange{0 0.51 1 0 setcmykcolor}DC
+ /Bittersweet{0 0.75 1 0.24 setcmykcolor}DC/RedOrange{0 0.77 0.87 0
+ setcmykcolor}DC/Mahogany{0 0.85 0.87 0.35 setcmykcolor}DC/Maroon{0 0.87
+ 0.68 0.32 setcmykcolor}DC/BrickRed{0 0.89 0.94 0.28 setcmykcolor}DC/Red{
+ 0 1 1 0 setcmykcolor}DC/OrangeRed{0 1 0.50 0 setcmykcolor}DC/RubineRed{
+ 0 1 0.13 0 setcmykcolor}DC/WildStrawberry{0 0.96 0.39 0 setcmykcolor}DC
+ /Salmon{0 0.53 0.38 0 setcmykcolor}DC/CarnationPink{0 0.63 0 0
+ setcmykcolor}DC/Magenta{0 1 0 0 setcmykcolor}DC/VioletRed{0 0.81 0 0
+ setcmykcolor}DC/Rhodamine{0 0.82 0 0 setcmykcolor}DC/Mulberry{0.34 0.90
+ 0 0.02 setcmykcolor}DC/RedViolet{0.07 0.90 0 0.34 setcmykcolor}DC
+ /Fuchsia{0.47 0.91 0 0.08 setcmykcolor}DC/Lavender{0 0.48 0 0
+ setcmykcolor}DC/Thistle{0.12 0.59 0 0 setcmykcolor}DC/Orchid{0.32 0.64 0
+ 0 setcmykcolor}DC/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}DC/Purple{
+ 0.45 0.86 0 0 setcmykcolor}DC/Plum{0.50 1 0 0 setcmykcolor}DC/Violet{
+ 0.79 0.88 0 0 setcmykcolor}DC/RoyalPurple{0.75 0.90 0 0 setcmykcolor}DC
+ /BlueViolet{0.86 0.91 0 0.04 setcmykcolor}DC/Periwinkle{0.57 0.55 0 0
+ setcmykcolor}DC/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}DC
+ /CornflowerBlue{0.65 0.13 0 0 setcmykcolor}DC/MidnightBlue{0.98 0.13 0
+ 0.43 setcmykcolor}DC/NavyBlue{0.94 0.54 0 0 setcmykcolor}DC/RoyalBlue{1
+ 0.50 0 0 setcmykcolor}DC/Blue{1 1 0 0 setcmykcolor}DC/Cerulean{0.94 0.11
+ 0 0 setcmykcolor}DC/Cyan{1 0 0 0 setcmykcolor}DC/ProcessBlue{0.96 0 0 0
+ setcmykcolor}DC/SkyBlue{0.62 0 0.12 0 setcmykcolor}DC/Turquoise{0.85 0
+ 0.20 0 setcmykcolor}DC/TealBlue{0.86 0 0.34 0.02 setcmykcolor}DC
+ /Aquamarine{0.82 0 0.30 0 setcmykcolor}DC/BlueGreen{0.85 0 0.33 0
+ setcmykcolor}DC/Emerald{1 0 0.50 0 setcmykcolor}DC/JungleGreen{0.99 0
+ 0.52 0 setcmykcolor}DC/SeaGreen{0.69 0 0.50 0 setcmykcolor}DC/Green{1 0
+ 1 0 setcmykcolor}DC/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}DC
+ /PineGreen{0.92 0 0.59 0.25 setcmykcolor}DC/LimeGreen{0.50 0 1 0
+ setcmykcolor}DC/YellowGreen{0.44 0 0.74 0 setcmykcolor}DC/SpringGreen{
+ 0.26 0 0.76 0 setcmykcolor}DC/OliveGreen{0.64 0 0.95 0.40 setcmykcolor}
+ DC/RawSienna{0 0.72 1 0.45 setcmykcolor}DC/Sepia{0 0.83 1 0.70
+ setcmykcolor}DC/Brown{0 0.81 1 0.60 setcmykcolor}DC/Tan{0.14 0.42 0.56 0
+ setcmykcolor}DC/Gray{0 0 0 0.50 setcmykcolor}DC/Black{0 0 0 1
+ setcmykcolor}DC/White{0 0 0 0 setcmykcolor}DC end
+ 
+ %%EndProcSet
+ TeXDict begin 40258431 52099146 1000 600 600 (pmt.dvi)
+ @start /Fa 165[37 43 1[56 43 43 37 33 40 43 33 43 43
+ 53 37 43 23 20 43 43 33 37 43 40 40 43 65[{
+ TeXBase1Encoding ReEncodeFont}25 59.7758 /Times-Roman
+ rf /Fb 140[37 25 12[42 101[{TeXBase1Encoding ReEncodeFont}3
+ 74.7198 /Helvetica rf
+ %DVIPSBitmapFont: Fc cmr10 10 2
+ /Fc 2 51 df<15301578B3A6007FB812F8B912FCA26C17F8C80078C8FCB3A6153036367B
+ AF41>43 D<EB0FF0EB7FFE48B57E3903E03FC03907000FE0000E6D7E00186D7E00386D7E
+ 00308048130081007C80B41580A27FA36CC7FCA2121CC81300A25D5DA24A5AA24A5A5D4A
+ 5A4A5A5D4AC7FC143E5C5C5C495A495A49C8FC130E49EB01805B5B491303491400485A48
+ C7FC00065C000FB6FC5A5A485CB6FCA321387CB72A>50 D E
+ %EndDVIPSBitmapFont
+ %DVIPSBitmapFont: Fd cmsy10 10 1
+ /Fd 1 3 df<0060150600F0150F6C151F007C153E6C157C6C15F86C6CEB01F06C6CEB03
+ E06C6CEB07C06C6CEB0F806C6CEB1F00017C133E6D5B6D5B90380F81F0903807C3E09038
+ 03E7C06DB45A6D90C7FC147EA214FF497F903803E7C0903807C3E090380F81F049C67E01
+ 3E137C497F497F4848EB0F804848EB07C04848EB03E04848EB01F048C812F8003E157C48
+ 153E48151F48150F00601506282874A841>2 D E
+ %EndDVIPSBitmapFont
+ %DVIPSBitmapFont: Fe cmmi10 10 2
+ /Fe 2 79 df<1760177017F01601A21603A21607160FA24C7EA216331673166316C3A2ED
+ 0183A2ED0303150683150C160115181530A21560A215C014011580DA03007FA202061300
+ 140E140C5C021FB5FC5CA20260C7FC5C83495A8349C8FC1306A25BA25B13381330017016
+ 80EA01F0D807F815FF267FFF80013F13FEB516FF18FE383C7DBB3E>65
+ D<902603FFF891381FFFF8495E6D6D80D90007030113006FEC007802061670814A6C1560
+ A26F7EA202186D5C151FA26F7E02304B5A6F7EA282DA60034AC7FCA26F7EA24A6C6C1306
+ A2828249485DEE3F80A217C049C7001F5B17E0160FA201066E6C5AA217F81603495EEE01
+ FCA2EE00FE495E17FF177FA2496F5AA2171F137095C8FC01F081EA07FC267FFFC080B56C
+ 14064A140245397DB843>78 D E
+ %EndDVIPSBitmapFont
+ %DVIPSBitmapFont: Ff cmsy8 8 1
+ /Ff 1 3 df<006015C000E01401007014030078EC07806CEC0F006C141E6C5C6C6C5B6C
+ 6C5B6C6C485A6C6C485A90387807806D48C7FCEB1E1E6D5AEB07F86D5A6D5A497E497EEB
+ 0F3CEB1E1E497E496C7E496C7E48486C7E48486C7E4848137848C77E001E80488048EC07
+ 800070EC03C048140100601400222376A137>2 D E
+ %EndDVIPSBitmapFont
+ /Fg 135[45 3[45 6[45 9[45 99[{TeXBase1Encoding ReEncodeFont}4
+ 74.7198 /Courier-BoldOblique rf /Fh 135[40 40 2[40 40
+ 2[40 40 40 40 40 40 40 40 40 40 1[40 1[40 1[40 12[40
+ 1[40 1[40 40 40 4[40 1[40 25[40 45[{TeXBase1Encoding ReEncodeFont}25
+ 66.4176 /Courier rf /Fi 133[45 45 1[45 45 45 45 45 45
+ 1[45 45 45 1[45 2[45 45 1[45 45 45 45 1[45 1[45 59[45
+ 35[{TeXBase1Encoding ReEncodeFont}21 74.7198 /Courier-Bold
+ rf /Fj 133[29 33 37 50 33 42 21 29 29 1[37 37 42 58 21
+ 37 21 21 42 37 25 33 37 33 37 37 25 11[46 42 24[25 37
+ 37 37 37 37 37 37 37 37 37 1[19 6[25 58 35[42 2[{
+ TeXBase1Encoding ReEncodeFont}43 74.7198 /Times-BoldItalic
+ rf /Fk 103[45 29[45 45 45 45 45 45 45 45 45 1[45 45 45
+ 45 45 45 45 45 45 45 45 45 45 45 45 45 1[45 9[45 45 45
+ 45 2[45 45 45 45 45 1[45 45 45 45 45 45 45 45 45 2[45
+ 45 1[45 9[45 45 45 45 45 45 1[45 45 45 1[45 4[45 33[{
+ TeXBase1Encoding ReEncodeFont}59 74.7198 /Courier rf
+ /Fl 135[29 3[18 1[26 1[33 33 33 48 18 29 1[18 33 2[29
+ 1[29 1[33 11[48 1[33 2[41 1[44 55 5[48 3[44 41 19[17
+ 46[{TeXBase1Encoding ReEncodeFont}23 66.4176 /Times-Italic
+ rf /Fm 134[33 33 48 33 33 18 26 22 1[33 33 33 52 18 33
+ 18 18 33 33 22 29 33 29 33 29 3[22 1[22 2[48 63 48 48
+ 41 37 44 1[37 48 48 59 41 48 1[22 48 48 37 41 48 44 44
+ 48 6[18 33 33 33 33 33 33 33 33 33 33 18 17 22 17 2[22
+ 22 37[37 2[{TeXBase1Encoding ReEncodeFont}66 66.4176
+ /Times-Roman rf /Fn 134[33 33 48 33 37 22 26 29 1[37
+ 33 37 55 18 1[22 18 37 33 22 29 37 29 37 33 12[44 37
+ 2[41 52 8[41 4[48 6[22 33 33 3[33 33 33 33 33 1[17 4[22
+ 22 40[{TeXBase1Encoding ReEncodeFont}40 66.4176 /Times-Bold
+ rf
+ %DVIPSBitmapFont: Fo cmsy9 9 4
+ /Fo 4 111 df<126012F812FEEA7F80EA1FE0EA07F8EA01FE38007F80EB1FE0EB07F8EB
+ 01FE9038007FC0EC1FF0EC07FCEC01FF9138003FC0ED0FF0ED03FCED00FFEE3FC0EE0FF0
+ EE03FCEE00FEA2EE03FCEE0FF0EE3FC0EEFF00ED03FCED0FF0ED3FC003FFC7FCEC07FCEC
+ 1FF0EC7FC04948C8FCEB07F8EB1FE0EB7F80D801FEC9FCEA07F8EA1FE0EA7F8000FECAFC
+ 12F81260CBFCAC007FB712FCB812FEA26C16FC2F3E7AB03C>21 D<EC07E0143FECFE00EB
+ 01F8EB03E0495A130F495AB3A649C7FCA2137E5BEA03F8EA7FE048C8FCEA7FE0EA03F8C6
+ 7E137E7FA26D7EB3A66D7E13076D7EEB01F8EB00FEEC3FE014071B4B7BB726>102
+ D<127CEAFFC0EA07F0EA01F8EA007C7F133F6D7EB3A66D7EA26D7E6D7E6D7E9038007FC0
+ EC1FE0EC7FC0903801F800495A495A495AA2495AB3A649C7FC133E5B485AEA07F0EAFFC0
+ 007CC8FC1B4B7BB726>I<126012F0A21278A37EA37EA37EA36C7EA36C7EA26C7EA36C7E
+ A31378A37FA37FA37FA36D7EA26D7EA36D7EA36D7EA31478A380A380A280A3EC0780A3EC
+ 03C0A3EC01E0A3EC00F0A31578A215301D4B7CB726>110 D E
+ %EndDVIPSBitmapFont
+ /Fp 135[50 50 50 50 50 50 50 1[50 50 50 50 50 50 50 50
+ 50 50 50 50 50 50 50 50 7[50 1[50 50 50 50 50 50 1[50
+ 50 50 2[50 1[50 50 50 1[50 1[50 1[50 12[50 2[50 2[50
+ 50 50 1[50 50 50 4[50 35[{TeXBase1Encoding ReEncodeFont}49
+ 83.022 /Courier rf /Fq 133[37 3[42 1[28 32 3[42 5[23
+ 3[37 46 21[60 78 18[28 8[42 5[47 42 28 28 40[{
+ TeXBase1Encoding ReEncodeFont}16 83.022 /Times-Bold rf
+ /Fr 133[32 37 37 55 37 42 23 32 32 1[42 42 42 60 23 37
+ 1[23 42 42 23 37 42 37 42 42 8[51 1[51 60 46 42 51 1[51
+ 60 55 69 46 2[28 1[60 51 51 60 55 51 51 3[56 2[28 42
+ 42 1[42 42 42 1[42 42 1[23 21 28 42[42 2[{TeXBase1Encoding ReEncodeFont}
+ 56 83.022 /Times-Italic rf /Fs 134[60 3[66 40 47 53 1[66
+ 60 66 100 33 2[33 2[40 53 66 53 66 60 14[86 1[73 6[47
+ 7[86 13[60 60 60 49[{TeXBase1Encoding ReEncodeFont}24
+ 119.552 /Times-Bold rf /Ft 134[42 1[58 1[46 1[42 29 2[46
+ 46 1[21 2[21 46 46 1[42 46 1[46 17[50 4[54 16[25 58[{
+ TeXBase1Encoding ReEncodeFont}17 74.7198 /Helvetica-Bold
+ rf /Fu 134[33 33 50 33 37 21 29 29 37 37 37 37 54 21
+ 33 1[21 37 37 21 33 37 33 37 37 8[46 62 46 54 42 37 46
+ 54 46 54 50 62 42 2[25 1[54 46 46 54 50 46 46 5[25 25
+ 5[37 37 37 37 37 1[19 25 19 4[25 36[37 2[{TeXBase1Encoding ReEncodeFont}
+ 57 74.7198 /Times-Italic rf /Fv 133[33 37 37 54 37 37
+ 21 29 25 37 37 37 37 58 21 37 21 21 37 37 25 33 37 33
+ 37 33 3[25 1[25 2[54 71 54 54 46 42 50 54 42 54 54 66
+ 46 54 29 25 54 54 42 46 54 50 50 54 5[21 21 37 37 37
+ 37 37 37 37 37 37 37 21 19 25 19 42 1[25 25 25 58 34[42
+ 42 2[{TeXBase1Encoding ReEncodeFont}75 74.7198 /Times-Roman
+ rf /Fw 134[37 37 1[37 42 25 29 33 1[42 37 42 62 21 42
+ 1[21 42 37 1[33 42 33 42 37 9[75 54 1[50 42 2[46 58 54
+ 71 50 2[29 1[58 1[50 54 54 1[54 18[19 46[{TeXBase1Encoding ReEncodeFont}
+ 37 74.7198 /Times-Bold rf /Fx 104[83 42 1[37 37 24[37
+ 42 42 60 42 42 23 32 28 42 42 42 42 65 23 42 23 23 42
+ 42 28 37 42 37 42 37 3[28 1[28 2[60 78 60 60 51 46 55
+ 1[46 60 60 74 51 60 1[28 60 60 46 51 60 55 55 60 76 37
+ 4[23 42 42 42 42 42 42 42 42 42 42 23 21 28 21 2[28 28
+ 28 5[28 29[46 46 2[{TeXBase1Encoding ReEncodeFont}77
+ 83.022 /Times-Roman rf /Fy 87[33 49[44 50 28 39 39 3[50
+ 4[28 50 2[44 1[44 1[50 11[72 55 6[83 35[33 33 40[{
+ TeXBase1Encoding ReEncodeFont}17 99.6264 /Times-Italic
+ rf /Fz 140[39 4[50 1[28 3[50 50 33 44 1[44 1[44 13[55
+ 66 12[61 22[25 46[{TeXBase1Encoding ReEncodeFont}13 99.6264
+ /Times-Roman rf /FA 134[50 50 72 50 55 33 39 44 1[55
+ 50 55 83 28 55 33 28 55 50 33 44 55 44 55 50 9[100 1[72
+ 66 55 72 1[61 78 1[94 1[78 1[39 78 78 61 66 72 72 66
+ 72 8[50 50 50 50 50 50 50 50 2[25 33 3[33 33 1[83 34[55
+ 55 2[{TeXBase1Encoding ReEncodeFont}57 99.6264 /Times-Bold
+ rf /FB 138[96 57 1[76 2[86 96 1[48 2[48 96 86 1[76 96
+ 1[96 86 16[105 2[163 77[{TeXBase1Encoding ReEncodeFont}15
+ 172.188 /Times-Bold rf end
+ %%EndProlog
+ %%BeginSetup
+ %%Feature: *Resolution 600dpi
+ TeXDict begin
+ %%BeginPaperSize: Letter
+ letter
+ %%EndPaperSize
+ 
+ %%EndSetup
+ %%Page: 1 1
+ 1 0 bop Black Black Black Black 1052 119 a FB(P)m(ortable)44
+ b(Multithr)m(eading)753 254 y FA(The)26 b(Signal)f(Stack)h(T)-7
+ b(rick)26 b(F)n(or)e(User)l(-Space)i(Thr)n(ead)h(Cr)n(eation)1567
+ 472 y Fz(Ralf)e(S.)g(Engelschall)1148 595 y Fy(T)-9 b(ec)o(hnisc)o(he)
+ 24 b(Univer)o(sit)1988 596 y(\250)1980 595 y(at)f(M)2172
+ 596 y(\250)2164 595 y(unc)o(hen)h(\(TUM\))1109 718 y
+ Fx(rse@engelschall.com,)18 b(http://www)-5 b(.engelschall.com)p
+ Black Black 1811 999 a Fw(Abstract)p Black Black 208
+ 1136 a Fv(This)23 b(paper)h(describes)g(a)g(pragmatic)g(b)o(ut)f
+ (portable)h(f)o(allback)h(approach)g(for)e(creating)h(and)h
+ (dispatching)f(between)h(the)e(machine)208 1227 y(conte)o(xts)c(of)g
+ (multiple)f(threads)h(of)g(e)o(x)o(ecution)h(on)f(Unix)g(systems)g
+ (that)f(lack)h(a)f(dedicated)i(user)o(-space)f(conte)o(xt)h(switching)f
+ (f)o(acility)-5 b(.)208 1318 y(Such)22 b(a)g(f)o(allback)h(approach)h
+ (for)f(implementing)g(machine)g(conte)o(xts)g(is)f(a)g(vital)g(part)h
+ (of)f(a)g(user)o(-space)h(multithreading)g(en)m(viron-)208
+ 1410 y(ment,)g(if)e(it)h(has)h(to)f(achie)n(v)o(e)h(maximum)g
+ (portability)g(across)g(a)f(wide)g(range)h(of)g(Unix)f(\003a)o(v)o
+ (ors.)33 b(The)22 b(approach)i(is)e(entirely)g(based)208
+ 1501 y(on)d(standard)h(Unix)g(system)f(f)o(acilities)g(and)h(ANSI-C)e
+ (language)i(features)g(and)g(especially)g(does)g(not)f(require)h(an)o
+ (y)f(assembly)h(code)208 1592 y(or)27 b(platform)h(speci\002c)f(tricks)
+ g(at)h(all.)48 b(The)27 b(most)h(interesting)g(issue)f(is)g(the)h
+ (technique)h(of)e(creating)h(the)g(machine)g(conte)o(xt)g(for)208
+ 1684 y(threads,)18 b(which)g(this)f(paper)h(e)o(xplains)h(in)e(detail.)
+ 23 b(The)17 b(described)i(approach)g(closely)f(follo)n(ws)g(the)g
+ (algorithm)g(as)f(implemented)i(by)208 1775 y(the)h(author)h(for)f(the)
+ g(popular)h(user)o(-space)g(multithreading)g(library)f
+ Fu(GNU)f(P)-6 b(ortable)21 b(Thr)m(eads)g Fv(\()p Fu(GNU)e(Pth)p
+ Fv(,)h([25)q(]\))f(which)i(this)f(w)o(ay)208 1866 y(quickly)f(gained)h
+ (the)f(status)g(of)g(one)g(of)g(the)g(most)g(portable)h(user)o(-space)f
+ (multithreading)h(libraries.)208 2007 y Ft(K)o(e)o(yw)o(or)o(ds:)e
+ Fv(portability)-5 b(,)15 b(multithreading,)i(Unix,)e(POSIX,)f(SUSv2,)h
+ (ANSI-C,)e(user)o(-space,)j(conte)o(xt)g(creation,)g(conte)o(xt)f
+ (switch-)208 2099 y(ing,)j(signal)i(handler)m(,)f(stack,)g(mak)o
+ (econte)o(xt,)h(switchconte)o(xt,)g(sigaltstack,)e(setjmp,)h(longjmp.)
+ 208 2240 y Ft(Pub)o(lishing:)g Fv(Early)f(drafts)f(of)h(this)g(paper)g
+ (were)g(distrib)o(uted)g(with)f(the)h(GNU)g(Pth)f(distrib)o(ution.)22
+ b(The)c(\002nal)g(release)g(v)o(ersion)g(w)o(as)208 2331
+ y(published)i(on)f(the)g(USENIX)f(Annual)h(T)-5 b(echnical)20
+ b(Conference,)f(June)h(18-23,)g(2000,)f(San)g(Die)o(go,)g(California,)f
+ (USA.)0 2711 y Fs(1)119 b(Intr)n(oduction)0 2895 y FA(1.1)99
+ b(Multithr)n(eading)0 3052 y Fx(The)25 b(paradigm)d(of)j(programming)c
+ (with)k(multiple)g(threads)f(of)0 3152 y(e)o(x)o(ecution)c(\(aka)i
+ Fr(multithr)m(eading)p Fx(\))f(is)i(already)f(a)h(v)o(ery)e(old)h(one)0
+ 3252 y(and)i(dates)g(back)g(to)g(the)h(decades)f(of)g(programming)c
+ (with)25 b Fr(co-)0 3351 y(r)l(outines)19 b Fx([2,)g(3].)25
+ b(P)o(aradoxically)-5 b(,)17 b(the)i(use)h(of)f(threads)g(on)g(Unix)0
+ 3451 y(platforms)g(did)h(not)g(become)f(popular)f(until)i(the)g(early)g
+ (1990s.)0 3602 y FA(Multithr)n(eading)26 b(Adv)o(antages)0
+ 3728 y Fx(Multithreading)31 b(can)i(pro)o(vide)f(man)o(y)g(bene\002ts)h
+ (for)g(applica-)0 3828 y(tions)26 b(\(good)f(runtime)g(concurrenc)o(y)
+ -5 b(,)24 b(parallel)i(programming)0 3927 y(techniques)j(can)h(be)g
+ (implemented)e(more)i(easily)-5 b(,)32 b(the)e(popu-)0
+ 4027 y(lar)22 b(procedural)d(programming)f(style)k(can)f(be)h(combined)
+ d(with)0 4127 y(multiple)g(threads)f(of)h(e)o(x)o(ecution,)e
+ Fr(etc.)p Fx(\))24 b(b)n(ut)c(the)f(most)g(interest-)0
+ 4226 y(ing)25 b(ones)g(are)g(usually)g(performance)d(gains)j(and)f
+ (reduced)g(re-)0 4326 y(source)17 b(consumption.)k(Because)d(in)g
+ (contrast)f(to)h(multiprocess)0 4425 y(applications,)e(multithreaded)f
+ (ones)i(usually)f(require)g(less)i(sys-)0 4525 y(tem)25
+ b(resources)f(\(mainly)g(memory\))e(and)j(their)f(internal)g(com-)0
+ 4625 y(munication)33 b(part)i(can)g(le)n(v)o(erage)f(from)g(the)i
+ (shared)e(address)0 4724 y(space.)0 4876 y FA(Multithr)n(eading)26
+ b(and)g(A)n(pplications)0 5001 y Fx(Ne)n(v)o(ertheless)d(there)h(still)
+ h(e)o(xist)g(just)g(a)f(fe)n(w)h(real)f(applications)0
+ 5101 y(in)35 b(the)f(free)g(softw)o(are)h(w)o(orld)f(that)g(use)h
+ (multithreading)d(for)0 5201 y(their)20 b(bene\002t,)g(although)f
+ (their)h(application)f(domains)h(are)g(pre-)0 5300 y(destined)32
+ b(for)f(multithreading.)59 b(F)o(or)32 b(instance,)j(the)d(popular)0
+ 5400 y(Apache)38 b(webserv)o(er)g(as)i(of)f(v)o(ersion)f(1.3)h(still)h
+ (uses)g(a)f(pre-)2025 2895 y(forking)32 b(process)h(model)g(for)h
+ (serving)f(HTTP)h(requests,)i(al-)2025 2995 y(though)14
+ b(tw)o(o)i(e)o(xperiments)e(with)j(multithreaded)c(Apache)i(v)n(ari-)
+ 2025 3095 y(ants)22 b(in)g(1996)e(\(with)i Fr(r)o(sthr)m(eads)g
+ Fx([27)n(]\))g(and)f(1998)f(\(with)i Fr(NSPR)2025 3194
+ y Fx([31)o(]\))37 b(already)f(sho)n(wed)g(great)h(performance)d
+ (boosts.)76 b(The)2025 3294 y(same)20 b(applies)g(to)h(man)o(y)e
+ (similar)h(applications.)2150 3401 y(The)h(reason)g(for)g(this)i
+ (restraint)e(mainly)g(is)i(that)f(for)f(a)h(long)2025
+ 3500 y(time,)c(multithreading)e(f)o(acilities)j(under)d(Unix)i(were)g
+ (rare.)24 b(The)2025 3600 y(situation)f(became)f(better)h(after)f(some)
+ h(v)o(endors)f(lik)o(e)h Fr(Sun)f Fx(and)2025 3699 y
+ Fr(DEC)f Fx(incorporated)15 b(threading)h(f)o(acilities)j(into)f(their)
+ g(Unix)f(\003a-)2025 3799 y(v)n(ors)36 b(and)g Fr(POSIX)j
+ Fx(standardized)c(a)i(threading)e Fr(Application)2025
+ 3899 y(Pr)l(o)o(gr)o(amming)18 b(Interface)g Fx(\(API\))h(\(aka)f
+ Fr(Pthr)m(eads)g Fx([1]\).)24 b(But)c(an)2025 3998 y(API)e(and)f(a)h
+ (fe)n(w)f(v)o(endor)f(implementations)f(are)j(not)f(enough)e(to)2025
+ 4098 y(ful\002ll)29 b(the)g(portability)e(requirements)g(of)h(modern)f
+ (free)i(soft-)2025 4198 y(w)o(are)37 b(packages.)74 b(Here)37
+ b(stand-alone)f(and)g(really)h(portable)2025 4297 y(multithreading)18
+ b(en)m(vironments)f(are)j(needed.)2150 4404 y(The)49
+ b(author)g(collected)h(and)f(e)n(v)n(aluated)g(o)o(v)o(er)g(twenty)2025
+ 4503 y(\(mostly)42 b(user)n(-space\))h(a)n(v)n(ailable)f
+ (multithreading)f(f)o(acilities)2025 4603 y(for)15 b(Unix)g(systems)h
+ (\(see)g(T)-7 b(able)16 b(1\),)g(b)n(ut)g(only)e(a)i(fe)n(w)g(of)f
+ (them)h(are)2025 4703 y(freely)27 b(a)n(v)n(ailable)g(and)g(sho)n(wed)g
+ (to)h(be)g(really)f(portable.)46 b(And)2025 4802 y(e)n(v)o(en)19
+ b(the)i(mostly)f(portable)f(ones)h(suf)n(fered)f(from)g(the)i(f)o(act)f
+ (that)2025 4902 y(the)o(y)31 b(partly)g(depend)f(on)h(assembly)g(code)g
+ (or)h(platform)e(spe-)2025 5001 y(ci\002c)e(tricks)f(usually)g(related)
+ g(to)h(the)f(creation)g(and)g(dispatch-)2025 5101 y(ing)d(of)h(the)g
+ (indi)n(vidual)e(threads.)38 b(This)25 b(means)f(that)h(the)g(num-)2025
+ 5201 y(ber)c(of)h(platforms)f(the)o(y)g(support)f(is)j(limited)e(and)h
+ (applications)2025 5300 y(which)27 b(are)h(based)g(on)g(these)g(f)o
+ (acilities)h(are)f(only)f(portable)f(to)2025 5400 y(those)c(platforms.)
+ 29 b(This)22 b(situation)f(is)i(not)f(satisf)o(actory)-5
+ b(,)21 b(so)h(ap-)p Black 1929 5700 a(1)p Black eop
+ %%Page: 2 2
+ 2 1 bop Black Black 0 83 a Fx(plication)25 b(authors)g(still)j(a)n(v)n
+ (oid)d(the)i(use)f(of)g(multithreading)d(if)0 183 y(the)o(y)28
+ 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
+ (portability)0 282 y(for)20 b(their)f(application.)125
+ 387 y(A)25 b(pragmatic)e(and)h(mostly)g(portable)f(f)o(allback)h
+ (technique)0 486 y(for)d(implementing)f(user)n(-space)h(threads)g(can)h
+ (f)o(acilitate)g(wider)0 586 y(use)e(of)g(multithreading)e(in)i(free)g
+ (softw)o(are)g(applications.)0 750 y FA(Ingr)n(edients)26
+ b(of)f(a)g(Thr)n(ead)0 884 y Fx(A)h(Unix)f(process)f(has)i(man)o(y)e
+ (ingredients,)h(b)n(ut)g(the)g(most)h(im-)0 983 y(portant)k(ones)h(are)
+ h(its)g(memory)e(mapping)f(table,)34 b(the)e(signal)0
+ 1083 y(dispatching)18 b(table,)h(the)g(signal)g(mask,)g(the)g(set)h(of)
+ f(\002le)h(descrip-)0 1183 y(tors)30 b(and)f(the)h(machine)e(conte)o
+ (xt.)52 b(The)29 b(machine)g(conte)o(xt)f(in)0 1282 y(turn)d(consists)i
+ (of)e(at)i(least)g(the)f(CPU)h(re)o(gisters)e(including)g(the)0
+ 1382 y(program)18 b(counter)h(and)h(the)h(stack)f(pointer)-5
+ b(.)25 b(In)20 b(addition,)f(there)0 1482 y(can)28 b(be)f(light-weight)
+ g(processes)g(\(L)-6 b(WP\))28 b(or)f(threads,)i(which)0
+ 1581 y(usually)g(share)g(all)h(attrib)n(utes)f(with)g(the)h(underlying)
+ c(\(hea)n(vy-)0 1681 y(weight\))19 b(process)h(e)o(xcept)f(for)h(the)g
+ (machine)f(conte)o(xt.)0 1845 y FA(K)n(er)o(nel-Space)25
+ b(vs.)31 b(User)l(-Space)0 1979 y Fx(Those)c(L)-6 b(WPs)28
+ b(or)f(threads,)h(on)e(a)i(Unix)f(platform)e(classically)0
+ 2078 y(can)34 b(be)g(implemented)e(either)i(in)g(k)o(ernel-space)f(or)g
+ (in)i(user)n(-)0 2178 y(space.)76 b(When)38 b(implemented)d(in)j(k)o
+ (ernel-space,)h(one)e(usu-)0 2278 y(ally)22 b(calls)h(them)e(L)-6
+ b(WPs)23 b(or)e(k)o(ernel)g(threads,)h(otherwise)f(\(user)n(-)0
+ 2377 y(space\))d(threads.)24 b(If)19 b(threads)f(are)h(implemented)d
+ (by)j(the)g(k)o(ernel,)0 2477 y(the)24 b(thread)g(conte)o(xt)f
+ (switches)h(are)h(performed)c(by)j(the)g(k)o(ernel)0
+ 2576 y(without)17 b(notice)f(by)h(the)g(application,)f(similar)i(to)f
+ (the)h(dispatch-)0 2676 y(ing)33 b(of)g(processes.)64
+ b(If)33 b(threads)g(are)g(implemented)e(in)j(user)n(-)0
+ 2776 y(space,)20 b(the)g(thread)f(conte)o(xt)g(switches)i(are)f
+ (performed)d(usually)0 2875 y(by)31 b(an)g(application)f(library)g
+ (without)h(notice)f(by)h(the)h(k)o(ernel.)0 2975 y(Additionally)-5
+ b(,)39 b(there)e(e)o(xist)h(hybrid)d(threading)h(approaches,)0
+ 3075 y(where)28 b(typically)g(a)h(user)n(-space)g(library)e(binds)i
+ (one)f(or)g(more)0 3174 y(user)n(-space)19 b(threads)h(to)g(one)g(or)g
+ (more)f(k)o(ernel-space)g(L)-6 b(WPs.)0 3338 y FA(Thr)n(ead)27
+ b(Models)0 3472 y Fx(The)h(v)o(endor)d(threading)h(f)o(acilities)j
+ (under)d Fr(Sun)h(Solaris)p Fx(,)i Fr(IBM)0 3572 y(AIX)p
+ Fx(,)h Fr(DEC)h(T)-5 b(ru64)31 b Fx(\(formerly)d Fr(DIGIT)l(AL)i(UNIX)k
+ Fx(or)d Fr(OSF/1)p Fx(\))0 3671 y(and)20 b Fr(SGI)h(IRIX)i
+ Fx(use)e(a)h Fq(M:N)f Fx(mapping)e([21)o(,)i(30)o(],)g
+ Fr(i.e)o(.)p Fx(,)f Fq(M)i Fx(user)n(-)0 3771 y(space)33
+ b(threads)g(are)h(mapped)e(onto)g Fq(N)i Fx(k)o(ernel-space)e(L)-6
+ b(WPs.)0 3871 y(On)20 b(the)h(other)e(hand,)g Fr(LinuxThr)m(eads)g
+ Fx([29)o(])i(under)e Fr(GNU/Linux)0 3970 y Fx(uses)f(a)f
+ Fq(1:1)g Fx(mapping)e(and)i(pure)f(user)n(-space)h(implementations)0
+ 4070 y(lik)o(e)k Fr(GNU)g(Pth)p Fx(,)f Fr(FSU)g(pthr)m(eads)f
+ Fx(or)i Fr(MIT)f(pthr)m(eads)p Fx(,)g Fr(etc.)26 b Fx(use)20
+ b(a)0 4170 y Fq(M:1)g Fx(mapping)f([25)n(,)i(22)o(,)f(23)o(].)125
+ 4274 y(From)39 b(no)n(w)g(on)h(we)g(focus)g(on)f(such)h
+ Fq(M:1)g Fx(user)g(space)0 4374 y(threading)d(approaches,)42
+ b(where)c(one)h(or)f(more)h(user)g(space)0 4473 y(threads)16
+ b(are)g(implemented)f(inside)i(a)g(single)f(k)o(ernel)g(space)h(pro-)0
+ 4573 y(cess.)24 b(The)15 b(e)o(x)o(ercise)f(is)i(to)g(implement)e(this)
+ i(by)e(using)h(standard-)0 4672 y(ized)20 b(Unix)g(system)g(and)g
+ (ANSI-C)g(language)f(f)o(acilities)i Fr(only)p Fx(.)0
+ 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
+ (e)f(mentioned,)e(a)j(thread)e(shares)i(its)g(state)g(with)g(the)0
+ 5201 y(underlying)i(process)j(e)o(xcept)f(for)g(the)h(machine)f(conte)o
+ (xt.)46 b(So)0 5300 y(the)17 b(major)e(task)i(for)f(a)h(user)n(-space)f
+ (threading)e(system)j(is)g(to)g(cre-)0 5400 y(ate)k(and)e(dispatch)h
+ (those)g(machine)f(conte)o(xts.)2150 83 y(In)d(practice,)g(the)h
+ (second)f(major)g(task)h(it)g(has)g(to)g(do)f(is)i(to)f(en-)2025
+ 183 y(sure)k(that)f(no)h(thread)f(by)g(accident)g(blocks)g(the)h(whole)
+ f(process)2025 282 y(\(and)25 b(thereby)f(all)i(other)f(threads\).)41
+ b(Instead)25 b(when)g(an)h(opera-)2025 382 y(tion)j(w)o(ould)f(block,)i
+ (the)f(threading)e(library)h(should)g(suspend)2025 482
+ y(only)19 b(the)g(e)o(x)o(ecution)e(of)i(the)g(current)g(thread)f(and)h
+ (in)g(the)h(mean-)2025 581 y(time)g(dispatch)f(the)h(remaining)e
+ (threads.)24 b(But)d(this)f(task)g(is)h(out-)2025 681
+ y(side)30 b(the)h(scope)e(of)h(this)h(paper)e(\(see)h([11)o(])h(for)e
+ (details)i(about)2025 780 y(this)24 b(task\).)33 b(W)-7
+ b(e)24 b(focus)f(only)f(on)h(the)g(aspect)g(of)g(machine)e(con-)2025
+ 880 y(te)o(xt)f(handling.)2025 1112 y FA(1.3)99 b(The)26
+ b(Curse)g(of)e(P)n(ortability)2025 1267 y Fx(Our)18 b(goal)g(of)f(real)
+ i(portability)d(for)i(a)h(threading)d(system)i(causes)2025
+ 1367 y(some)j(non-tri)n(vial)d(problems)i(which)g(ha)n(v)o(e)g(to)h(be)
+ g(solv)o(ed.)26 b(The)2025 1467 y(most)f(ob)o(vious)e(one)h(is)i(that)f
+ (dealing)f(with)h(machine)f(conte)o(xts)2025 1566 y(usually)33
+ b(suf)n(fers)g(from)f(portability)-5 b(,)35 b(because)d(it)j(is)f(a)g
+ (highly)2025 1666 y(CPU)18 b(dependent)d(task)i(for)f(which)g(not)h(e)n
+ (v)o(ery)e(Unix)i(\003a)n(v)n(or)g(pro-)2025 1766 y(vides)25
+ b(a)g(standardized)e(API.)i(Although)e(such)i(an)g(API)g(w)o(ould)2025
+ 1865 y(be)f(not)h(too)f(hard)f(for)h(v)o(endors)f(to)i(pro)o(vide,)e
+ (because)h(in)h(prin-)2025 1965 y(ciple)d(it)h(is)g(just)g(a)g(matter)e
+ (of)h(switching)g(a)h(fe)n(w)f(CPU)h(re)o(gisters)2025
+ 2064 y(\(mainly)c(the)h(program)e(counter)h(and)h(the)g(stack)g
+ (pointer\).)2025 2201 y FA(Assembly)k(Code)i(Consider)n(ed)g(Harmful)
+ 2025 2319 y Fx(Additionally)-5 b(,)21 b(we)j(disallo)n(w)e(the)h(use)h
+ (of)e(an)o(y)g(assembly)h(solu-)2025 2418 y(tions)c(or)g(platform)e
+ (speci\002c)j(tricks,)f(because)f(then)h(the)g(thread-)2025
+ 2518 y(ing)e(system)i(again)d(w)o(ould)h(be)h(only)f(semi-portable,)f
+ Fr(i.e)o(.)p Fx(,)i(it)h(can)2025 2617 y(be)e(ported)f(to)i
+ Fq(N)f Fx(platforms)f(b)n(ut)i(on)f(the)g Fq(\(N+1\))p
+ Fx(th)f(platform)g(one)2025 2717 y(has)28 b(to)g(manually)e(adjust)i
+ (or)f(e)n(v)o(en)g(e)o(xtend)f(it)i(to)g(w)o(ork)f(there,)2025
+ 2817 y(too.)2150 2916 y(This)e(is)h(usually)f(not)g(acceptable,)h(e)n
+ (v)o(en)e(if)i(it)g(also)g(mak)o(es)2025 3016 y(solving)20
+ b(the)h(problems)f(harder)-5 b(.)26 b(At)c(least)f(most)g(of)g(the)g
+ (kno)n(wn)2025 3116 y(free)26 b(softw)o(are)g(user)n(-space)g
+ (threading)f(systems)i([22)o(,)f(23)o(,)h(24)o(])2025
+ 3215 y(do)15 b(not)g(restrict)h(themself)e(to)i(this)g(and)f(therefore)
+ e(are)j(just)g(semi-)2025 3315 y(portable.)24 b(But)c(real)g
+ (portability)f(should)g(be)h(a)h(major)f(goal.)2025 3589
+ y Fs(2)119 b(Pr)n(oblem)30 b(Analysis)2025 3791 y FA(2.1)99
+ b(The)26 b(T)-9 b(ask)25 b(in)g(Detail)2025 3947 y Fx(Our)d(task)h(is)g
+ (simple)f(in)h(principle:)28 b(pro)o(vide)20 b(an)j(API)f(and)g(cor)n
+ (-)2025 4046 y(responding)f(implementation)f(for)j(creating)f(and)g
+ (dispatching)2025 4146 y(machine)15 b(conte)o(xts)g(on)h(which)g(user)n
+ (-space)g(threads)f(can)h(be)h(im-)2025 4246 y(plemented.)2025
+ 4382 y FA(The)26 b(Pr)n(oposed)g(API)2025 4500 y Fx(In)18
+ b(detail)g(we)g(propose)f(the)h(follo)n(wing)e Fr(Application)g(Pr)l(o)
+ o(gr)o(am-)2025 4599 y(mer)o(s)21 b(Interface)f Fx(\(API\))g(for)f(the)
+ h(machine)f(conte)o(xt)g(handling:)p Black 2120 4749
+ 50 50 v Black 2233 4749 a(A)25 b(data)g(structure)f(of)g(type)h
+ Fp(mctx)p 3266 4749 25 4 v 29 w(t)g Fx(which)f(holds)h(the)2233
+ 4849 y(machine)19 b(conte)o(xt.)p Black 2120 5001 50
+ 50 v Black 2233 5001 a(A)95 b(function)e(\223)p Fq(v)o(oid)h
+ Fp(mctx)p 3248 5001 25 4 v 29 w(create\(mctx)p 3827 5001
+ V 28 w(t)2233 5101 y(*)p Fr(mctx)p Fx(,)26 b Fq(v)o(oid)g
+ Fp(\(*)p Fr(sf)p 2825 5101 V 30 w(addr)r Fp(\)\()p Fq(v)o(oid)e(*)p
+ Fp(\),)i Fq(v)o(oid)g Fp(*)p Fr(sf)p 3742 5101 V 30 w(ar)m(g)p
+ Fx(,)2233 5201 y Fq(v)o(oid)c Fp(*)p Fr(sk)p 2531 5201
+ V 30 w(addr)p Fx(,)g Fq(size)p 2891 5201 V 30 w(t)h Fr(sk)p
+ 3041 5201 V 30 w(size)p Fp(\))p Fx(\224)g(which)g(creates)f(and)2233
+ 5300 y(initializes)17 b(a)h(machine)e(conte)o(xt)f(structure)h(in)i
+ Fr(mctx)f Fx(with)2233 5400 y(a)25 b(start)g(function)e
+ Fr(sf)p 2825 5400 V 31 w(addr)p Fx(,)i(a)g(start)h(function)d(ar)o
+ (gument)p Black 1929 5700 a(2)p Black eop
+ %%Page: 3 3
+ 3 2 bop Black Black Black 0 3 3864 4 v 0 2441 4 2439
+ v 68 642 a Fw(P)o(ackage)553 642 y
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  553 642 a Fw(Genesis)553
+ 642 y
+  currentpoint grestore moveto
+  553 642 a 744 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  744 642 a Fw(Latest)19 b(V)-7
+ b(ersion)744 642 y
+  currentpoint grestore moveto
+  744 642 a 1010 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1010 642 a Fw(Implementation)18
+ b(Space)1010 642 y
+  currentpoint grestore moveto
+  1010 642 a 1404 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1404 642 a Fw(Thr)o(ead)g
+ (Mapping)1404 642 y
+  currentpoint grestore moveto
+  1404 642 a 1562 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1562 642 a
+ Fw(Acti)o(v)o(e)h(De)o(v)o(elopment)1562 642 y
+  currentpoint grestore moveto
+  1562 642
+ a 1703 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1703 642 a Fw(Experimental)f(State)1703
+ 642 y
+  currentpoint grestore moveto
+  1703 642 a 1844 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1844 642 a Fw(Open)g(Sour)o(ce)1844
+ 642 y
+  currentpoint grestore moveto
+  1844 642 a 1985 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  1985 642 a Fw(Pthr)o(ead)g(API)1985
+ 642 y
+  currentpoint grestore moveto
+  1985 642 a 2126 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2126 642 a Fw(Pthr)o(ead)g(Shar)o(ed)g
+ (Memory)2126 642 y
+  currentpoint grestore moveto
+  2126 642 a 2267 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2267 642 a Fw(Nati)o(v)o(e)i
+ (API)2267 642 y
+  currentpoint grestore moveto
+  2267 642 a 2408 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2408 642 a Fw(Nati)o(v)o(e)g(API)
+ e Fo(\025)h Fw(Pthr)o(ead)f(API)2408 642 y
+  currentpoint grestore moveto
+  2408 642 a
+ 2550 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2550 642 a Fw(Nati)o(v)o(e)h(API)g(is)f(Pthr)o(ead)g(API)
+ 2550 642 y
+  currentpoint grestore moveto
+  2550 642 a 2765 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2765 642 a Fw(Pr)o(eempti)o(v)o(e)h
+ (Scheduling)2765 642 y
+  currentpoint grestore moveto
+  2765 642 a 2906 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  2906 642
+ a Fw(P)o(ortability)2906 642 y
+  currentpoint grestore moveto
+  2906 642 a 3360 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+ 
+ 3360 642 a Fw(Assembly)f(Code)3360 642 y
+  currentpoint grestore moveto
+  3360 642 a 3509
+ 642 a
+  gsave currentpoint currentpoint translate 45 neg rotate neg exch neg
+ exch translate
+  3509 642 a Fw(SysCall)g(Wrap.)3509 642 y
+  currentpoint grestore moveto
+  3509 642
+ a 47 673 3658 4 v 68 737 a Fv(gnu-pth)254 b(1999)43 b(1.3.5)117
+ b(user)270 b(n:1)63 b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67
+ b(yes)42 b(yes)h(no)141 b(no)67 b(full/mcsc+sjlj)42 b(no)75
+ b(partly)68 820 y(cmu-l)o(wp)221 b(1984)43 b(1.4)173
+ b(user)270 b(n:1)63 b(yes)42 b(no)67 b(yes)42 b(no)67
+ b(-)116 b(yes)42 b(yes)h(partly)e(no)67 b(semi/\002x)o(ed:8)86
+ b(yes)50 b(no)68 903 y(fsu-pthread)146 b(1992)43 b(3.13)136
+ b(user)270 b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67
+ b(no)g(-)117 b(-)190 b(yes)42 b(semi/\002x)o(ed:6)86
+ b(yes)50 b(yes)68 986 y(mit-pthread)137 b(1993)43 b(1.8.9)117
+ b(user)270 b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67
+ b(no)g(-)117 b(-)190 b(yes)42 b(semi/\002x)o(ed:17)49
+ b(yes)h(yes)68 1069 y(ptl)406 b(1997)43 b(990622)h(user)270
+ b(n:1)63 b(no)k(no)g(yes)42 b(yes)g(no)67 b(no)g(-)117
+ b(-)190 b(yes)42 b(semi/\002x)o(ed:10)49 b(yes)h(yes)68
+ 1152 y(linuxthreads)117 b(1997)43 b(2.1.2)117 b(user+k)o(ernel)43
+ b(1:1)63 b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67 b(no)g(-)117
+ b(-)190 b(yes)42 b(semi/\002x)o(ed:5)86 b(yes)50 b(yes)68
+ 1235 y(uthread)262 b(1998)43 b(3.4)173 b(user)270 b(n:1)63
+ b(yes)42 b(no)67 b(yes)42 b(yes)g(no)67 b(no)g(-)117
+ b(-)190 b(yes)42 b(semi/\002x)o(ed:2)86 b(yes)50 b(yes)68
+ 1318 y(cthread)266 b(1991)43 b(991115)h(user)270 b(n:1)63
+ b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(yes)h(no)141
+ b(no)67 b(semi/\002x)o(ed:8)86 b(yes)50 b(yes)68 1401
+ y(openthreads/qt)d(1996)c(2.0)173 b(user)270 b(n:1)63
+ b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(no)68 b(no)141
+ b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68 1484
+ y(rt++/qt)276 b(1996)43 b(1.0)173 b(user)270 b(n:1)63
+ b(no)k(no)g(yes)42 b(no)67 b(-)116 b(yes)42 b(yes)h(no)141
+ b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68 1567
+ y(rsthreads)216 b(1996)43 b(980331)h(user)270 b(n:1)63
+ b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42 b(no)68
+ b(no)141 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50 b(no)68
+ 1650 y(pcthread)229 b(1996)43 b(1.0)173 b(user)270 b(n:1)63
+ b(no)k(yes)42 b(yes)g(yes)g(no)67 b(no)g(-)117 b(-)190
+ b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50 b(no)68 1733
+ y(bbthreads)196 b(1996)43 b(0.3)173 b(k)o(ernel)209 b(1:1)63
+ b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42 b(no)68
+ b(-)190 b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50 b(no)68
+ 1816 y(jkthreads)212 b(1998)43 b(1.2)173 b(k)o(ernel)209
+ b(1:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
+ b(no)68 b(-)190 b(yes)42 b(semi/\002x)o(ed:1)86 b(yes)50
+ b(no)68 1899 y(nthreads)233 b(1997)43 b(970604)h(user)270
+ b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
+ b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:9)86 b(yes)50
+ b(partly)68 1982 y(re)o(xthreads)176 b(1993)43 b(930614)h(user)270
+ b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
+ b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:4)86 b(yes)50
+ b(no)68 2065 y(coro)353 b(1999)43 b(1.0.3)117 b(user)270
+ b(n:1)63 b(no)k(yes)42 b(yes)g(no)67 b(-)116 b(yes)42
+ b(no)68 b(-)190 b(no)67 b(semi/\002x)o(ed:1)86 b(yes)50
+ b(no)68 2148 y(greenthreads)105 b(1995)43 b(1.2)173 b(user)270
+ b(n:1)63 b(no)k(no)g(no)g(no)g(-)116 b(yes)42 b(yes)h(-)190
+ b(yes)42 b(full/mcsc)176 b(no)75 b(no)68 2231 y(solaris-pthread)42
+ b(NN)83 b(2.7)173 b(user+k)o(ernel)43 b(n:m)f(yes)g(no)67
+ b(no)g(yes)42 b(yes)g(yes)g(yes)h(no)141 b(yes)42 b(NN)346
+ b(NN)41 b(yes)68 2314 y(tru64-pthread)80 b(NN)j(5.0)173
+ b(user+k)o(ernel)43 b(n:m)f(yes)g(no)67 b(no)g(yes)42
+ b(yes)g(no)67 b(no)h(no)141 b(yes)42 b(NN)346 b(NN)41
+ b(yes)68 2397 y(aix-pthread)146 b(NN)83 b(4.3)173 b(user+k)o(ernel)43
+ b(1:1)63 b(yes)42 b(no)67 b(no)g(yes)42 b(yes)g(no)67
+ b(no)h(no)141 b(yes)42 b(NN)346 b(NN)41 b(yes)p 3860
+ 2441 4 2439 v 0 2444 3864 4 v 0 2532 a Fn(T)-6 b(able)18
+ b(1:)67 b Fm(Summary)20 b(of)h(e)n(v)n(aluated)j(multithreading)g
+ (packages)f(and)e(some)g(of)f(their)i(determined)h(characteristics.)36
+ b(Notice)22 b(that)g(mostly)f(all)h(packages)g(contain)295
+ 2600 y(assembly)17 b(code)h(and)g(are)g(just)f(semi-portable,)j
+ Fl(i.e)o(.)p Fm(,)c(the)o(y)i(support)g(only)g(a)f(\002x)o(ed)g(set)g
+ (of)g(platforms)i(and)e(do)g(not)h(automatically)j(adjust)d(for)f(ne)n
+ (w)h(ones.)p Black 208 2864 a Fr(sf)p 268 2864 25 4 v
+ 30 w(ar)m(g)p Fx(,)36 b(and)d(a)h(stack)f(starting)g(at)h
+ Fr(sk)p 1343 2864 V 30 w(addr)p Fx(,)i(which)d(is)208
+ 2963 y Fr(sk)p 282 2963 V 30 w(size)21 b Fx(bytes)f(in)g(size.)p
+ Black 95 3115 50 50 v Black 208 3115 a(A)i(function)f(\223)p
+ Fq(v)o(oid)h Fp(mctx)p 1006 3115 25 4 v 30 w(save\(mctx)p
+ 1486 3115 V 28 w(t)h(*)p Fr(mctx)p Fp(\))p Fx(\224)208
+ 3215 y(which)j(sa)n(v)o(es)i(the)g(current)e(machine)g(conte)o(xt)g
+ (into)i(the)208 3314 y(machine)19 b(conte)o(xt)g(structure)g
+ Fr(mctx)p Fx(.)p Black 95 3466 50 50 v Black 208 3466
+ a(A)78 b(function)e(\223)p Fq(v)o(oid)i Fp(mctx)p 1173
+ 3466 25 4 v 30 w(restore\(mctx)p 1803 3466 V 27 w(t)208
+ 3566 y(*)p Fr(mctx)p Fp(\))p Fx(\224)40 b(which)g(restores)g(the)h(ne)n
+ (w)f(machine)f(con-)208 3666 y(te)o(xt)18 b(from)g(the)h(machine)e
+ (conte)o(xt)h(structure)g Fr(mctx)p Fx(.)24 b(This)208
+ 3765 y(function)29 b(does)i(not)g(return)f(to)h(the)h(caller)-5
+ b(.)58 b(Instead)31 b(it)208 3865 y(does)18 b(return)g(at)i(the)f
+ (location)g(stored)f(in)i Fr(mctx)f Fx(\(which)g(is)208
+ 3964 y(either)d Fr(sf)p 474 3964 V 30 w(addr)i Fx(from)e(a)h(pre)n
+ (vious)f Fp(mctx)p 1415 3964 V 29 w(create)g Fx(call)208
+ 4064 y(or)j(the)i(location)e(of)h(a)g(pre)n(vious)f Fp(mctx)p
+ 1365 4064 V 29 w(save)h Fx(call\).)p Black 95 4216 50
+ 50 v Black 208 4216 a(A)95 b(function)e(\223)p Fq(v)o(oid)h
+ Fp(mctx)p 1223 4216 25 4 v 29 w(switch\(mctx)p 1802 4216
+ V 28 w(t)208 4316 y(*)p Fr(mctx)p 420 4316 V 29 w(old)p
+ Fx(,)19 b Fp(mctx)p 796 4316 V 29 w(t)h(*)p Fr(mctx)p
+ 1102 4316 V 30 w(ne)o(w)p Fp(\))p Fx(\224)f(which)g(switches)208
+ 4415 y(from)59 b(the)i(current)e(machine)g(conte)o(xt)h(\(sa)n(v)o(ed)f
+ (to)208 4515 y Fr(mctx)p 370 4515 V 29 w(old)28 b Fx(for)e(later)g
+ (use\))g(to)g(a)h(ne)n(w)f(conte)o(xt)f(\(restored)208
+ 4615 y(from)c Fr(mctx)p 554 4615 V 30 w(ne)o(w)p Fx(\).)31
+ b(This)22 b(function)f(returns)g(only)h(to)h(the)208
+ 4714 y(caller)39 b(if)h Fp(mctx)p 728 4714 V 30 w(restore)f
+ Fx(or)g Fp(mctx)p 1456 4714 V 29 w(switch)h Fx(is)208
+ 4814 y(again)19 b(used)h(on)f Fr(mctx)p 846 4814 V 30
+ w(old)p Fx(.)0 5045 y FA(2.2)99 b(T)-9 b(echnical)26
+ b(P)n(ossibilities)0 5201 y Fx(Poking)18 b(around)f(in)i(the)f
+ (references)g(of)g(the)h(ANSI-C)g(language)0 5300 y(reference)36
+ b(and)i(the)g(Unix)f(standards)g(sho)n(w)h(the)g(follo)n(wing)0
+ 5400 y(functions)19 b(on)h(which)f(an)h(implementation)e(can)i(be)g
+ (based:)p Black 2120 2864 50 50 v Black 2233 2864 a(There)55
+ b(is)h(the)g Fp(ucontext)p Fx(\(3\))e(f)o(acility)i(with)g(the)2233
+ 2963 y(functions)34 b Fp(getcontext)p Fx(\(3\),)j Fp(makecontext)p
+ Fx(\(3\),)2233 3063 y Fp(swapcontext)p Fx(\(3\))31 b(and)j
+ Fp(setcontext)p Fx(\(3\))e(which)2233 3162 y(conform)21
+ b(to)j(the)g Fr(Single)f(Unix)h(Speci\002cation)p Fx(,)e(V)-9
+ b(ersion)2233 3262 y(2)38 b(\()p Fr(SUSv2)e Fx([20)o(],)42
+ b(aka)c Fr(Unix95/98)p Fx(\).)76 b(Unfortunately)2233
+ 3362 y(these)16 b(are)g(a)n(v)n(ailable)f(on)h(modern)e(Unix)h
+ (platforms)g(only)-5 b(.)p Black 2120 3625 V Black 2233
+ 3625 a(There)87 b(are)h(the)h Fp(jmp)p 3051 3625 25 4
+ v 29 w(buf)f Fx(based)g(functions)2233 3724 y Fp(setjmp)p
+ Fx(\(3\))29 b(and)h Fp(longjmp)p Fx(\(3\))f(which)i(conform)d(to)2233
+ 3824 y(ISO)41 b(9899:1990)c(\(ISO-C\))k(and)f(the)h Fp(sigjmp)p
+ 3727 3824 V 29 w(buf)2233 3924 y Fx(based)71 b Fp(sigsetjmp)p
+ Fx(\(3\))f(and)i Fp(siglongjmp)p Fx(\(3\))2233 4023 y(functions)17
+ b(which)h(conform)f(to)i(IEEE)f(Std1003.1-1988)2233 4123
+ y(\()p Fr(POSIX)t Fx(\),)f(and)j Fr(Single)f(Unix)h(Speci\002cation)p
+ Fx(,)d(V)-9 b(ersion)19 b(2)2233 4222 y(\()p Fr(SUSv2)j
+ Fx([20)o(],)j(aka)f Fr(Unix95/98)p Fx(\).)35 b(The)24
+ b(\002rst)h(tw)o(o)g(func-)2233 4322 y(tions)17 b(are)h(a)n(v)n
+ (ailable)f(really)h(on)f(all)h(Unix)g(platforms,)f(the)2233
+ 4422 y(last)k(tw)o(o)f(are)g(a)n(v)n(ailable)g(only)f(on)h(some)g(of)g
+ (them.)2233 4603 y(On)h(some)h(platforms)e Fp(setjmp)p
+ Fx(\(3\))g(and)i Fp(longjmp)p Fx(\(3\))2233 4703 y(sa)n(v)o(e)45
+ b(and)h(restore)f(also)h(the)f(signal)h(mask)f(\(if)h(one)2233
+ 4802 y(does)e(not)g(w)o(ant)g(this)h(semantics,)50 b(one)44
+ b(has)h(to)f(call)p 2233 4902 V 2257 4902 a Fp(setjmp)p
+ Fx(\(3\))36 b(and)p 2854 4902 V 67 w Fp(longjmp)p Fx(\(3\))g(there\))g
+ (while)i(on)2233 5001 y(others)23 b(one)h(has)g(to)g(e)o(xplicitly)g
+ (use)g(the)g(superset)g(func-)2233 5101 y(tions)36 b
+ Fp(sigsetjmp)p Fx(\(3\))f(and)h Fp(siglongjmp)p Fx(\(3\))e(for)2233
+ 5201 y(this.)115 b(In)50 b(our)f(discussion)h(we)g(can)g(assume)g(that)
+ 2233 5300 y Fp(setjmp)p Fx(\(3\))40 b(and)j Fp(longjmp)p
+ Fx(\(3\))d(sa)n(v)o(e)j(and)f(restore)2233 5400 y(the)36
+ b(signal)f(mask,)40 b(because)35 b(if)h(this)h(is)g(not)e(the)h(case)p
+ Black 1929 5700 a(3)p Black eop
+ %%Page: 4 4
+ 4 3 bop Black Black 208 83 a Fx(in)46 b(practice,)53
+ b(one)46 b(easily)h(can)f(replace)g(them)g(with)208 183
+ y Fp(sigsetjmp)p Fx(\(3\))41 b(and)i Fp(siglongjmp)p
+ Fx(\(3\))e(calls)k(\(if)208 282 y(a)n(v)n(ailable\))30
+ b(or)h(\(if)g(not)g(a)n(v)n(ailable\))f(emulate)h(the)g(miss-)208
+ 382 y(ing)d(functionality)g(manually)f(with)j(additional)e
+ Fp(sig-)208 482 y(procmask)p Fx(\(2\))j(calls)i(\(see)h
+ Fp(pth)p 1245 482 25 4 v 29 w(mctx.c)f Fx(in)g Fr(GNU)208
+ 581 y(Pth)20 b Fx([25)n(]\).)p Black 95 739 50 50 v Black
+ 208 739 a(There)37 b(is)i(the)f(function)e Fp(sigaltstack)p
+ Fx(\(2\))f(which)208 839 y(conforms)f(to)j(the)g Fr(Single)f(Unix)h
+ (Speci\002cation)p Fx(,)h(V)-9 b(er)n(-)208 938 y(sion)34
+ b(2)g(\()p Fr(SUSv2)f Fx([20)n(],)38 b(aka)c Fr(Unix95/98)p
+ Fx(\))e(and)i(its)h(an-)208 1038 y(cestor)25 b(function)f
+ Fp(sigstack)p Fx(\(2\))f(from)h Fr(4.2BSD)p Fx(.)g(The)208
+ 1137 y(last)d(one)e(e)o(xists)i(only)e(on)h Fr(BSD)p
+ Fx(-deri)n(v)o(ed)d(platforms,)i(b)n(ut)208 1237 y(the)g(\002rst)h
+ (function)e(already)h(e)o(xists)h(on)f(all)h(current)e(Unix)208
+ 1337 y(platforms.)0 1571 y FA(2.3)99 b(Maximum)25 b(P)n(ortability)f
+ (Solution)0 1726 y Fx(The)44 b(maximum)e(portable)h(solution)g(ob)o
+ (viously)f(is)j(to)f(use)0 1826 y(the)j(standardized)f
+ Fp(makecontext)p Fx(\(3\))e(function)i(to)h(cre-)0 1926
+ y(ate)k(threads)f(and)g Fp(switchcontext)p Fx(\(3\))e(or)i
+ Fp(getcon-)0 2025 y(text)p Fx(\(3\)/)p Fp(setcontext)p
+ Fx(\(3\))18 b(to)23 b(dispatch)e(them.)31 b(And)22 b(actu-)0
+ 2125 y(ally)h(these)f(are)h(the)f(preferred)f(functions)g(modern)f
+ (user)n(-space)0 2224 y(multithreading)25 b(systems)k(are)e(using.)48
+ b(W)-7 b(e)29 b(could)e(easily)h(im-)0 2324 y(plement)20
+ b(our)g(proposed)f(API)i(as)g(follo)n(wing)e(\(all)i(error)f(checks)0
+ 2424 y(omitted)f(for)h(better)g(readability\):)p Black
+ Black 0 2561 a Fk(/*)63 b Fj(mac)o(hine)19 b(context)g(data)g
+ (structure)44 b Fk(*/)0 2635 y Fi(typedef)g(struct)f
+ Fk(mctx_st)h Fo(f)179 2710 y Fk(ucontext_t)f(uc;)0 2785
+ y Fo(g)i Fk(mctx_t;)0 2934 y(/*)63 b Fj(sav)o(e)20 b(mac)o(hine)e
+ (context)45 b Fk(*/)0 3009 y Fi(#define)f Fk(mctx_save\(mctx\))e
+ Fo(n)179 3084 y Fk(\()p Fi(void)p Fk(\)getcontext\(&\(mctx\)->uc\))0
+ 3233 y(/*)63 b Fj(restore)20 b(mac)o(hine)e(context)45
+ b Fk(*/)0 3308 y Fi(#define)f Fk(mctx_restore\(mctx\))d
+ Fo(n)179 3383 y Fk(\()p Fi(void)p Fk(\)setcontext\(&\(mctx\)->uc\))0
+ 3532 y(/*)63 b Fj(switc)o(h)18 b(mac)o(hine)h(context)45
+ b Fk(*/)0 3607 y Fi(#define)f Fk(mctx_switch\(mctx_old,mctx_new\))39
+ b Fo(n)179 3681 y Fk(\()p Fi(void)p Fk
+ (\)swapcontext\(&\(\(mctx_old\)->uc\),)g Fo(n)986 3756
+ y Fk(&\(\(mctx_new\)->uc\)\))0 3906 y(/*)63 b Fj(create)20
+ b(mac)o(hine)e(context)45 b Fk(*/)0 3980 y Fi(void)f
+ Fk(mctx_create\()179 4055 y(mctx_t)g(*mctx,)179 4130
+ y Fi(void)g Fk(\(*sf_addr\)\()p Fi(void)f Fk(*\),)h Fi(void)g
+ Fk(*sf_arg,)179 4204 y Fi(void)g Fk(*sk_addr,)g(size_t)g(sk_size\))0
+ 4279 y Fo(f)179 4429 y Fk(/*)64 b Fj(f)o(etc)o(h)18 b(current)g
+ (context)45 b Fk(*/)179 4503 y(getcontext\(&\(mctx->uc\)\);)179
+ 4653 y(/*)64 b Fj(adjust)18 b(to)h(new)f(context)45 b
+ Fk(*/)179 4728 y(mctx->uc.uc_link)491 b(=)44 b(NULL;)179
+ 4802 y(mctx->uc.uc_stack.ss_sp)176 b(=)44 b(sk_addr;)179
+ 4877 y(mctx->uc.uc_stack.ss_size)86 b(=)44 b(sk_size;)179
+ 4952 y(mctx->uc.uc_stack.ss_flags)d(=)j(0;)179 5101 y(/*)64
+ b Fj(mak)n(e)19 b(new)f(context)45 b Fk(*/)179 5176 y
+ (makecontext\(&\(mctx->uc\),)717 5251 y(sf_addr,)f(1,)g(sf_arg\);)179
+ 5325 y Fi(return)p Fk(;)0 5400 y Fo(g)2025 83 y Fx(Unfortunately)14
+ b(there)j(are)g(still)h(lots)g(of)f(Unix)f(platforms)g(where)2025
+ 183 y(this)43 b(approach)d(cannot)h(be)h(used,)47 b(because)42
+ b(the)g(standard-)2025 282 y(ized)e Fp(ucontext)p Fx(\(3\))d(API)j(is)g
+ (not)g(pro)o(vided)d(by)i(the)h(v)o(en-)2025 382 y(dor)-5
+ b(.)80 b(Actually)38 b(the)h(platform)e(test)i(results)g(for)f
+ Fr(GNU)i(Pth)2025 482 y Fx(\(see)29 b(T)-7 b(able)29
+ b(2)g(belo)n(w\))f(sho)n(wed)g(that)h(only)f(7)h(of)g(21)f(success-)
+ 2025 581 y(fully)e(tested)g(Unix)g(\003a)n(v)n(ors)g(pro)o(vided)e(the)
+ i(standardized)e(API)2025 681 y(\()p Fp(makecontext)p
+ Fx(\(3\),)19 b Fr(etc.)p Fx(\).)31 b(On)22 b(all)h(other)f(platforms,)f
+ Fr(GNU)2025 780 y(Pth)31 b Fx(w)o(as)h(forced)e(to)h(use)h(the)f(f)o
+ (allback)f(approach)f(of)i(imple-)2025 880 y(menting)25
+ b(the)h(machine)f(conte)o(xt)f(as)j(we)f(will)h(describe)e(in)i(the)
+ 2025 980 y(follo)n(wing.)44 b(Ob)o(viously)25 b(this)j(f)o(allback)e
+ (approach)f(has)i(to)g(use)2025 1079 y(the)36 b(remaining)f(technical)g
+ (possibilities)h(\()p Fp(sigsetjmp)p Fx(\(3\),)2025 1179
+ y Fr(etc.)p Fx(\).)p 2025 1271 1899 4 v 2025 3174 4 1904
+ v 2103 1351 a Fn(Operating)18 b(System)p 2837 1374 4
+ 79 v 277 w(Ar)o(chitectur)o(e\(s\))p 3450 1374 V 188
+ w(mcsc)p 3694 1374 V 104 w(sjlj)2103 1430 y Fm(FreeBSD)g(2.x/3.x)p
+ 2837 1453 V 339 w(Intel)p 3450 1453 V 494 w(no)p 3694
+ 1453 V 177 w(yes)2103 1508 y(FreeBSD)g(3.x)p 2837 1532
+ V 440 w(Intel,)g(Alpha)p 3450 1532 V 298 w(no)p 3694
+ 1532 V 177 w(yes)2103 1587 y(NetBSD)g(1.3/1.4)p 2837
+ 1611 V 361 w(Intel,)g(PPC,)e(M68K)p 3450 1611 V 135 w(no)p
+ 3694 1611 V 177 w(yes)2103 1666 y(OpenBSD)i(2.5/2.6)p
+ 2837 1690 V 313 w(Intel,)g(SP)-6 b(ARC)p 3450 1690 V
+ 255 w(no)p 3694 1690 V 177 w(yes)2103 1745 y(BSDI)17
+ b(4.0)p 2837 1769 V 536 w(Intel)p 3450 1769 V 494 w(no)p
+ 3694 1769 V 177 w(yes)2103 1824 y(Linux)g(2.0.x)g(glibc)h(1.x/2.0)p
+ 2837 1848 V 129 w(Intel,)g(SP)-6 b(ARC,)16 b(PPC)p 3450
+ 1848 V 104 w(no)p 3694 1848 V 177 w(yes)2103 1903 y(Linux)h(2.2.x)g
+ (glibc)h(2.0/2.1)p 2837 1926 V 129 w(Intel,)g(Alpha,)g(ARM)p
+ 3450 1926 V 112 w(no)p 3694 1926 V 177 w(yes)2103 1982
+ y(Sun)f(SunOS)g(4.1.x)p 2837 2005 V 329 w(SP)-6 b(ARC)p
+ 3450 2005 V 410 w(no)p 3694 2005 V 177 w(yes)2103 2060
+ y(Sun)17 b(Solaris)h(2.5/2.6/2.7)p 2837 2084 V 181 w(SP)-6
+ b(ARC)p 3450 2084 V 410 w(yes)p 3694 2084 V 155 w(yes)2103
+ 2139 y(SCO)17 b(UnixW)-5 b(are)18 b(2.x/7.x)p 2837 2163
+ V 169 w(Intel)p 3450 2163 V 494 w(yes)p 3694 2163 V 155
+ w(yes)2103 2218 y(SCO)f(OpenServ)o(er)i(5.0.x)p 2837
+ 2242 V 175 w(Intel)p 3450 2242 V 494 w(no)p 3694 2242
+ V 177 w(yes)2103 2297 y(IBM)e(AIX)g(4.1/4.2/4.3)p 2837
+ 2321 V 225 w(RS6000,)g(PPC)p 3450 2321 V 249 w(yes)p
+ 3694 2321 V 155 w(yes)2103 2376 y(HP)g(HPUX)f(9.10/10.20)p
+ 2837 2400 V 205 w(HPP)-6 b(A)p 3450 2400 V 450 w(no)p
+ 3694 2400 V 177 w(yes)2103 2455 y(HP)17 b(HPUX)f(11.0)p
+ 2837 2479 V 372 w(HPP)-6 b(A)p 3450 2479 V 450 w(yes)p
+ 3694 2479 V 155 w(yes)2103 2534 y(SGI)17 b(IRIX)g(5.3)p
+ 2837 2557 V 427 w(MIPS)g(32/64)p 3450 2557 V 292 w(no)p
+ 3694 2557 V 177 w(yes)2103 2613 y(SGI)g(IRIX)g(6.2/6.5)p
+ 2837 2636 V 326 w(MIPS)g(32/64)p 3450 2636 V 292 w(yes)p
+ 3694 2636 V 155 w(yes)2103 2691 y(ISC)g(4.0)p 2837 2715
+ V 584 w(Intel)p 3450 2715 V 494 w(no)p 3694 2715 V 177
+ w(yes)2103 2770 y(Apple)h(MacOS)f(X)p 2837 2794 V 341
+ w(PPC)p 3450 2794 V 496 w(no)p 3694 2794 V 177 w(yes)2103
+ 2849 y(DEC)f(OSF1/T)n(ru64)i(4.0/5.0)p 2837 2873 V 103
+ w(Alpha)p 3450 2873 V 453 w(yes)p 3694 2873 V 155 w(yes)2103
+ 2928 y(SNI)f(ReliantUNIX)p 2837 2952 V 308 w(MIPS)p 3450
+ 2952 V 459 w(yes)p 3694 2952 V 155 w(yes)2103 3007 y(AmigaOS)p
+ 2837 3031 V 522 w(M68K)p 3450 3031 V 441 w(no)p 3694
+ 3031 V 177 w(yes)p 3921 3174 4 1904 v 2025 3177 1899
+ 4 v 2025 3264 a Fn(T)-6 b(able)18 b(2:)67 b Fm(Summary)20
+ b(of)h(operating)j(system)d(support.)33 b(The)20 b(le)n(v)o(el)j(and)f
+ (type)2320 3332 y(of)h(support)h(found)f(on)g(each)i(tested)g
+ (operating)g(system.)39 b Fh(mcsc)p Fm(:)2320 3400 y(functional)168
+ b Fh(makecontext)p Fm(\(3\)/)p Fh(switchcontext)p Fm(\(3\),)2320
+ 3466 y Fh(sjlj)p Fm(:)83 b(functional)51 b Fh(setjmp)p
+ Fm(\(3\)/)p Fh(longjmp)p Fm(\(3\))c(or)i Fh(sig-)2320
+ 3531 y(setjmp)p Fm(\(3\)/)p Fh(siglongjmp)p Fm(\(3\).)25
+ b(See)19 b(\002le)h Fh(PORTING)d Fm(in)j Fl(GNU)2320
+ 3597 y(Pth)c Fm([25)q(])h(for)g(more)g(details.)2025
+ 3834 y FA(2.4)99 b(Remaining)25 b(P)n(ossibilities)2025
+ 3999 y Fx(Our)f(problem)e(can)i(be)g(di)n(vided)f(into)h(tw)o(o)g
+ (parts,)h(an)f(easy)g(one)2025 4099 y(and)c(a)g(dif)n(\002cult)g(one.)
+ 2025 4264 y FA(The)26 b(Easy)f(P)o(art)2025 4399 y Fx(That)k
+ Fp(setjmp)p Fx(\(3\))e(and)h Fp(longjmp)p Fx(\(3\))f(can)i(be)g(used)g
+ (to)g(im-)2025 4498 y(plement)20 b(user)n(-space)g(threads)g(is)i
+ (commonly)c(kno)n(wn)h([24)o(,)i(27)o(,)2025 4598 y(28)o(].)57
+ b(Mostly)31 b(all)g(older)g(portable)e(user)n(-space)h(threading)f(li-)
+ 2025 4697 y(braries)c(are)h(based)g(on)f(them,)i(although)d(some)h
+ (problems)g(are)2025 4797 y(kno)n(wn)h(with)h(these)g(f)o(acilities)h
+ (\(see)f(belo)n(w\).)45 b(So)28 b(it)g(becomes)2025 4897
+ y(clear)g(that)f(we)h(also)g(ha)n(v)o(e)f(to)h(use)g(these)g(functions)
+ e(and)h(base)2025 4996 y(our)h(machine)f(conte)o(xt)g(\()p
+ Fp(mctx)p 2980 4996 25 4 v 29 w(t)p Fx(\))i(on)f(their)g
+ Fp(jmp)p 3559 4996 V 29 w(buf)h Fx(data)2025 5096 y(structure.)2150
+ 5201 y(W)-7 b(e)39 b(immediately)e(recognize)f(that)j(this)f(w)o(ay)h
+ (we)f(ha)n(v)o(e)2025 5300 y(at)j(least)g(solv)o(ed)f(the)g
+ (dispatching)f(problem,)44 b(because)39 b(our)2025 5400
+ y Fp(mctx)p 2230 5400 V 29 w(save)p Fx(,)73 b Fp(mctx)p
+ 2753 5400 V 29 w(restore)62 b Fx(and)g Fp(mctx)p 3577
+ 5400 V 29 w(switch)p Black 1929 5700 a Fx(4)p Black eop
+ %%Page: 5 5
+ 5 4 bop Black Black 0 83 a Fx(functions)32 b(can)h(be)g(easily)g
+ (implemented)e(with)i Fp(setjmp)p Fx(\(3\))0 183 y(and)20
+ b Fp(longjmp)p Fx(\(3\).)0 358 y FA(The)26 b(Dif\002cult)g(P)o(art)0
+ 500 y Fx(Ne)n(v)o(ertheless,)g(the)h(dif)n(\002cult)e(problem)g(of)h
+ (ho)n(w)f(to)i(create)f(the)0 600 y(machine)k(conte)o(xt)f(remains.)56
+ b(Ev)o(en)29 b(kno)n(wing)g(that)i(our)f(ma-)0 699 y(chine)17
+ b(conte)o(xt)f(is)i Fp(jmp)p 687 699 25 4 v 30 w(buf)f
+ Fx(based)g(is)i(no)e(adv)n(antage)e(to)j(us.)24 b(A)0
+ 799 y Fp(jmp)p 155 799 V 29 w(buf)18 b Fx(has)f(to)g(be)g(treated)g(by)
+ g(us)g(as)h(an)f(opaque)f(data)h(struc-)0 899 y(ture)26
+ b(\227)h(for)e(portability)g(reasons.)42 b(The)26 b(only)g(operations)e
+ (we)0 998 y(can)15 b(perform)f(on)h(it)h(are)f Fp(setjmp)p
+ Fx(\(3\))f(and)h Fp(longjmp)p Fx(\(3\))e(calls,)0 1098
+ y(of)23 b(course.)32 b(Additionally)-5 b(,)21 b(we)j(are)f(forced)e(to)
+ i(use)g Fp(sigalt-)0 1198 y(stack)p Fx(\(3\))f(for)h(our)g(stack)h
+ (manipulations,)e(because)h(it)h(is)h(the)0 1297 y(only)19
+ b(portable)g(function)g(which)g(actually)h(deals)g(with)h(stacks.)125
+ 1406 y(So)33 b(it)g(is)h(clear)f(that)g(our)f(implementation)f(for)h
+ Fp(mctx)p 1801 1406 V 29 w(-)0 1505 y(create)k Fx(has)h(to)g(play)f(a)i
+ (fe)n(w)e(tricks)h(to)g(use)g(a)g Fp(jmp)p 1701 1505
+ V 30 w(buf)0 1605 y Fx(for)44 b(passing)h(e)o(x)o(ecution)e(control)h
+ (to)h(an)g(arbitrary)e(startup)0 1704 y(routine.)82 b(And)39
+ b(our)g(approach)f(has)i(to)g(be)f(careful)g(to)h(en-)0
+ 1804 y(sure)51 b(that)h(it)g(does)f(not)h(suf)n(fer)e(from)h(une)o
+ (xpected)e(side-)0 1904 y(ef)n(fects.)131 b(It)56 b(should)e(be)i(also)
+ g(ob)o(vious)d(that)j(we)g(can-)0 2003 y(not)e(again)f(e)o(xpect)g(to)i
+ (\002nd)f(an)g(easy)g(solution)g(\(as)g(for)0 2103 y
+ Fp(mctx)p 205 2103 V 29 w(save)p Fx(,)g Fp(mctx)p 709
+ 2103 V 29 w(restore)47 b Fx(and)h Fp(mctx)p 1504 2103
+ V 29 w(switch)p Fx(\),)0 2203 y(because)29 b Fp(setjmp)p
+ Fx(\(3\))f(and)i Fp(sigaltstack)p Fx(\(3\))d(cannot)i(be)0
+ 2302 y(tri)n(vially)20 b(combined)e(to)i(form)f Fp(mctx)p
+ 1102 2302 V 29 w(create)p Fx(.)0 2630 y Fs(3)119 b(Implementation)0
+ 2833 y Fx(As)24 b(we)g(ha)n(v)o(e)f(already)g(discussed,)g(our)g
+ (implementation)e(con-)0 2932 y(tains)31 b(an)f(easy)h(part)f(\()p
+ Fp(mctx)p 869 2932 V 29 w(save)p Fx(,)i Fp(mctx)p 1351
+ 2932 V 29 w(restore)e Fx(and)0 3032 y Fp(mctx)p 205 3032
+ V 29 w(switch)p Fx(\))i(and)h(a)h(dif)n(\002cult)e(part)h(\()p
+ Fp(mctx)p 1504 3032 V 29 w(create)p Fx(\).)0 3131 y(Let)23
+ b(us)h(start)f(with)g(the)g(easy)g(part,)g(whose)g(implementation)e(is)
+ 0 3231 y(ob)o(vious)26 b(\(all)i(error)e(checks)i(again)e(omitted)h
+ (for)g(better)g(read-)0 3331 y(ability\):)p Black Black
+ 0 3532 a Fk(/*)63 b Fj(mac)o(hine)19 b(context)g(data)g(structure)44
+ b Fk(*/)0 3607 y Fi(typedef)g(struct)f Fk(mctx_st)h Fo(f)179
+ 3681 y Fk(jmp_buf)g(jb;)0 3756 y Fo(g)h Fk(mctx_t;)0
+ 3906 y(/*)63 b Fj(sav)o(e)20 b(mac)o(hine)e(context)45
+ b Fk(*/)0 3980 y Fi(#define)f Fk(mctx_save\(mctx\))e
+ Fo(n)179 4055 y Fk(\()p Fi(void)p Fk(\)setjmp\(\(mctx\)->jb\))0
+ 4204 y(/*)63 b Fj(restore)20 b(mac)o(hine)e(context)45
+ b Fk(*/)0 4279 y Fi(#define)f Fk(mctx_restore\(mctx\))d
+ Fo(n)179 4354 y Fk(longjmp\(\(mctx\)->jb,)h(1\))0 4503
+ y(/*)63 b Fj(switc)o(h)18 b(mac)o(hine)h(context)45 b
+ Fk(*/)0 4578 y Fi(#define)f Fk(mctx_switch\(mctx_old,mctx_new\))39
+ b Fo(n)179 4653 y Fi(if)45 b Fk(\(setjmp\(\(mctx_old\)->jb\))c(==)j
+ (0\))h Fo(n)359 4728 y Fk(longjmp\(\(mctx_new\)->jb,)c(1\))0
+ 4877 y(/*)63 b Fj(create)20 b(mac)o(hine)e(context)45
+ b Fk(*/)0 4952 y Fi(void)f Fk(mctx_create\()179 5026
+ y(mctx_t)g(*mctx,)179 5101 y Fi(void)g Fk(\(*sf_addr\)\()p
+ Fi(void)f Fk(*\),)h Fi(void)g Fk(*sf_arg,)179 5176 y
+ Fi(void)g Fk(*sk_addr,)g(size_t)g(sk_size\))0 5251 y
+ Fo(f)198 5325 y Fj(...initialization)16 b(of)j Fg(mctx)f
+ Fj(to)h(be)g(\002lled)f(in...)0 5400 y Fo(g)2025 83 y
+ Fx(There)23 b(is)i(one)f(subtle)f(b)n(ut)h(important)f(point)g(we)h
+ (should)f(men-)2025 183 y(tion:)45 b(The)30 b(use)h(of)f(the)h(C)g
+ (pre-processor)d Fp(#define)h Fx(direc-)2025 282 y(ti)n(v)o(e)36
+ b(to)g(implement)f Fp(mctx)p 2881 282 V 29 w(save)p Fx(,)40
+ b Fp(mctx)p 3371 282 V 29 w(restore)35 b Fx(and)2025
+ 382 y Fp(mctx)p 2230 382 V 29 w(switch)40 b Fx(is)i(intentional.)86
+ b(F)o(or)40 b(technical)g(reasons)2025 482 y(related)35
+ b(to)h Fp(setjmp)p Fx(\(3\))e(semantics)h(and)g Fp(return)g
+ Fx(related)2025 581 y(stack)h(beha)n(vior)e(\(which)h(we)i(will)f(e)o
+ (xplain)f(later)h(in)g(detail\))2025 681 y(we)25 b Fr(cannot)g
+ Fx(implement)f(these)h(three)g(functions)e(\(at)i(least)h(not)2025
+ 780 y Fp(mctx)p 2230 780 V 29 w(switch)p Fx(\))32 b(as)h(C)g(functions)
+ e(if)h(we)h(w)o(ant)f(to)h(achie)n(v)o(e)2025 880 y(maximum)25
+ b(portability)g(across)i(all)g(platforms.)43 b(Instead)26
+ b(the)o(y)2025 980 y(ha)n(v)o(e)20 b(to)g(be)g(implemented)e(as)j
+ (pre-processor)d(macros.)2025 1217 y FA(3.1)99 b(Algorithm)25
+ b(Ov)o(er)o(view)2025 1373 y Fx(The)g(general)e(idea)i(for)f
+ Fp(mctx)p 2940 1373 V 29 w(create)h Fx(is)h(to)f(con\002gure)e(the)2025
+ 1472 y(gi)n(v)o(en)14 b(stack)i(as)g(a)g(signal)f(stack)h(via)f
+ Fp(sigaltstack)p Fx(\(2\),)f(send)2025 1572 y(the)33
+ b(current)f(process)g(a)i(signal)e(to)i(transfer)e(e)o(x)o(ecution)e
+ (con-)2025 1672 y(trol)e(onto)g(this)h(stack,)h(sa)n(v)o(e)f(the)f
+ (machine)f(conte)o(xt)h(there)g(via)2025 1771 y Fp(setjmp)p
+ Fx(\(3\),)16 b(get)h(rid)h(of)f(the)g(signal)h(handler)e(scope)h(and)g
+ (boot-)2025 1871 y(strap)j(into)g(the)g(startup)g(routine.)2150
+ 1970 y(The)31 b(real)g(problem)f(in)i(this)g(approach)d(comes)i(from)g
+ (the)2025 2070 y(signal)e(handler)f(scope)h(which)g(implies)h(v)n
+ (arious)e(restrictions)2025 2170 y(on)21 b(Unix)g(platforms)f(\(the)h
+ (signal)g(handler)f(scope)g(often)h(is)h(just)2025 2269
+ y(a)i(\003ag)h(in)f(the)g(process)f(control)g(block)g(\(PCB\))i(which)f
+ (v)n(arious)2025 2369 y(system)30 b(calls,)j(lik)o(e)e
+ Fp(sigaltstack)p Fx(\(2\),)e(check)h(before)e(al-)2025
+ 2469 y(lo)n(wing)c(the)h(operation)f(\226)h(b)n(ut)g(because)g(it)h(is)
+ g(part)f(of)f(the)i(pro-)2025 2568 y(cess)20 b(state)g(the)f(k)o(ernel)
+ g(manages,)f(the)h(process)g(cannot)f(change)2025 2668
+ 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
+ (perform)d(a)i(fe)n(w)h(tricks)2025 2767 y(to)i(get)f(rid)h(of)f(it.)29
+ b(The)22 b(second)e(main)h(problem)f(is:)29 b(ho)n(w)21
+ b(do)g(we)2025 2867 y(prepare)k(the)h(calling)g(of)g(the)g(start)h
+ (routine)e(without)h(immedi-)2025 2967 y(ately)20 b(entering)f(it?)2025
+ 3204 y FA(3.2)99 b(Algorithm)2025 3360 y Fx(The)20 b(input)f(to)i(the)f
+ Fp(mctx)p 2779 3360 V 29 w(create)g Fx(function)e(is)j(the)g(machine)
+ 2025 3459 y(conte)o(xt)30 b(structure)h Fr(mctx)h Fx(which)f(should)f
+ (be)i(initialized,)i(the)2025 3559 y(thread)15 b(startup)h(function)e
+ (address)i Fr(sf)p 3111 3559 V 30 w(addr)p Fx(,)h(the)f(thread)f
+ (startup)2025 3659 y(function)24 b(ar)o(gument)g Fr(sf)p
+ 2727 3659 V 30 w(ar)m(g)i Fx(and)f(a)i(chunk)d(of)i(memory)e(start-)
+ 2025 3758 y(ing)31 b(at)i Fr(sk)p 2330 3758 V 30 w(addr)g
+ Fx(and)e Fr(sk)p 2772 3758 V 30 w(size)i Fx(bytes)e(in)h(size,)j(which)
+ d(should)2025 3858 y(become)19 b(the)h(threads)g(stack.)2150
+ 3958 y(The)33 b(follo)n(wing)f(algorithm)g(for)h Fp(mctx)p
+ 3361 3958 V 29 w(create)g Fx(is)i(di-)2025 4057 y(rectly)21
+ b(modeled)f(after)h(the)h(implemented)e(algorithm)g(one)h(can)2025
+ 4157 y(\002nd)28 b(in)h Fr(GNU)h(Pth)e Fx([25)o(],)j(which)d(in)h(turn)
+ f(w)o(as)i(deri)n(v)o(ed)d(from)2025 4256 y(techniques)19
+ b(originally)f(found)h(in)h Fr(r)o(sthr)m(eads)h Fx([27)n(]:)p
+ Black 2129 4438 a(1.)p Black 41 w(Preserv)o(e)i(the)h(current)g(signal)
+ g(mask)g(and)g(block)f(an)i(ar)n(-)2233 4537 y(bitrary)f(w)o(ork)o(er)h
+ (signal)h(\(we)g(use)g Fp(SIGUSR1)p Fx(,)g(b)n(ut)g(an)o(y)2233
+ 4637 y(signal)d(can)f(be)i(used)e(for)h(this)g(\226)h(e)n(v)o(en)e(an)h
+ (already)f(used)2233 4736 y(one\).)53 b(This)30 b(w)o(ork)o(er)f
+ (signal)g(is)i(later)f(temporarily)e(re-)2233 4836 y(quired)18
+ b(for)i(the)g(trampoline)f(step.)p Black 2129 5001 a(2.)p
+ Black 41 w(Preserv)o(e)28 b(a)h(possibly)g(e)o(xisting)f(signal)h
+ (action)g(for)g(the)2233 5101 y(w)o(ork)o(er)19 b(signal)i(and)g
+ (con\002gure)e(a)i(trampoline)e(function)2233 5201 y(as)g(the)h(ne)n(w)
+ f(temporary)e(signal)i(action.)24 b(The)19 b(signal)g(de-)2233
+ 5300 y(li)n(v)o(ery)g(is)j(con\002gured)d(to)i(occur)f(on)g(an)h
+ (alternate)g(signal)2233 5400 y(stack)f(\(see)g(ne)o(xt)g(step\).)p
+ Black 1929 5700 a(5)p Black eop
+ %%Page: 6 6
+ 6 5 bop Black Black Black 104 83 a Fx(3.)p Black 41 w(Preserv)o(e)35
+ b(a)h(possibly)g(acti)n(v)o(e)f(alternate)g(signal)h(stack)208
+ 183 y(and)56 b(con\002gure)f(the)h(memory)f(chunk)h(starting)g(at)208
+ 282 y Fr(sk)p 282 282 25 4 v 30 w(addr)47 b Fx(as)f(the)g(ne)n(w)f
+ (temporary)f(alternate)h(signal)208 382 y(stack)20 b(of)g(length)f
+ Fr(sk)p 791 382 V 30 w(size)p Fx(.)p Black 104 566 a(4.)p
+ Black 41 w(Sa)n(v)o(e)40 b(parameters)g(for)g(the)h(trampoline)e(step)i
+ (\()p Fr(mctx)p Fx(,)208 666 y Fr(sf)p 268 666 V 30 w(addr)p
+ Fx(,)25 b Fr(sf)p 557 666 V 30 w(ar)m(g)p Fx(,)h Fr(etc.)p
+ Fx(\))39 b(in)26 b(global)e(v)n(ariables,)h(send)g(the)208
+ 766 y(current)20 b(process)g(the)i(w)o(ork)o(er)e(signal,)h
+ (temporarily)e(un-)208 865 y(block)d(it)i(and)f(this)h(w)o(ay)f(allo)n
+ (w)h(it)g(to)g(be)f(deli)n(v)o(ered)f(on)h(the)208 965
+ y(signal)25 b(stack)h(in)g(order)f(to)h(transfer)f(e)o(x)o(ecution)f
+ (control)208 1065 y(to)c(the)g(trampoline)f(function.)p
+ Black 104 1249 a(5.)p Black 41 w(After)24 b(the)h(trampoline)e
+ (function)g(asynchronously)f(en-)208 1349 y(tered,)27
+ b(sa)n(v)o(e)g(its)h(machine)e(conte)o(xt)g(in)h(the)g
+ Fr(mctx)g Fx(struc-)208 1448 y(ture)j(and)g(immediately)g(return)f
+ (from)h(it)h(to)g(terminate)208 1548 y(the)20 b(signal)g(handler)f
+ (scope.)p Black 104 1732 a(6.)p Black 41 w(Restore)29
+ b(the)g(preserv)o(ed)f(alternate)h(signal)g(stack,)i(pre-)208
+ 1832 y(serv)o(ed)18 b(signal)h(action)g(and)g(preserv)o(ed)e(signal)i
+ (mask)g(for)208 1932 y(w)o(ork)o(er)30 b(signal.)59 b(This)32
+ b(w)o(ay)g(an)f(e)o(xisting)g(application)208 2031 y(con\002guration)17
+ b(for)j(the)g(w)o(ork)o(er)f(signal)h(is)h(restored.)p
+ Black 104 2216 a(7.)p Black 41 w(Sa)n(v)o(e)115 b(the)g(current)f
+ (machine)g(conte)o(xt)g(of)208 2315 y Fp(mctx)p 413 2315
+ V 29 w(create)p Fx(.)52 b(This)30 b(allo)n(ws)g(us)g(to)g(return)e(to)i
+ (this)208 2415 y(point)19 b(after)h(the)g(ne)o(xt)g(trampoline)e(step.)
+ p Black 104 2599 a(8.)p Black 41 w(Restore)30 b(the)g(pre)n(viously)e
+ (sa)n(v)o(ed)i(machine)f(conte)o(xt)g(of)208 2699 y(the)15
+ b(trampoline)g(function)f(\()p Fr(mctx)p Fx(\))h(to)h(again)f(transfer)
+ g(e)o(x-)208 2799 y(ecution)31 b(control)h(onto)g(the)h(alternate)f
+ (stack,)k(b)n(ut)d(this)208 2898 y(time)20 b(without\(!\))j(signal)d
+ (handler)f(scope.)p Black 104 3083 a(9.)p Black 41 w(After)50
+ b(reaching)f(the)i(trampoline)e(function)g(\()p Fr(mctx)p
+ Fx(\))208 3182 y(again,)40 b(immediately)c(bootstrap)g(into)h(a)g
+ (clean)g(stack)208 3282 y(frame)19 b(by)h(just)g(calling)g(a)h(second)e
+ (function.)p Black 62 3467 a(10.)p Black 41 w(Set)51
+ b(the)h(ne)n(w)f(signal)g(mask)g(to)g(be)g(the)g(same)h(as)208
+ 3566 y(the)32 b(original)e(signal)i(mask)g(which)g(w)o(as)h(acti)n(v)o
+ (e)e(when)208 3666 y Fp(mctx)p 413 3666 V 29 w(create)e
+ Fx(w)o(as)i(called.)53 b(This)30 b(is)h(required)d(be-)208
+ 3765 y(cause)19 b(in)g(the)g(\002rst)h(trampoline)e(step)h(we)h
+ (usually)e(had)h(at)208 3865 y(least)h(the)h(w)o(ork)o(er)e(signal)h
+ (block)o(ed.)p Black 62 4050 a(11.)p Black 41 w(Load)51
+ b(the)i(passed)f(startup)g(information)f(\()p Fr(sf)p
+ 1673 4050 V 29 w(addr)p Fx(,)208 4149 y Fr(sf)p 268 4149
+ V 30 w(ar)m(g)p Fx(\))46 b(from)g Fp(mctx)p 894 4149
+ V 29 w(create)g Fx(into)g(local)h(\(stack-)208 4249 y(based\))27
+ b(v)n(ariables.)47 b(This)28 b(is)h(important)e(because)g(their)208
+ 4348 y(v)n(alues)17 b(ha)n(v)o(e)f(to)i(be)f(preserv)o(ed)f(in)i
+ (machine)e(conte)o(xt)g(de-)208 4448 y(pendent)g(memory)g(until)h(the)h
+ (created)f(machine)g(conte)o(xt)208 4548 y(is)k(the)f(\002rst)h(time)f
+ (restored)f(by)h(the)g(application.)p Black 62 4732 a(12.)p
+ Black 41 w(Sa)n(v)o(e)26 b(the)g(current)f(machine)h(conte)o(xt)f(for)h
+ (later)g(restor)n(-)208 4832 y(ing)19 b(by)h(the)g(calling)g
+ (application.)p Black 62 5016 a(13.)p Black 41 w(Restore)30
+ b(the)g(pre)n(viously)e(sa)n(v)o(ed)i(machine)f(conte)o(xt)g(of)208
+ 5116 y Fp(mctx)p 413 5116 V 29 w(create)20 b Fx(to)i(transfer)e(e)o(x)o
+ (ecution)f(control)h(back)208 5216 y(to)g(it.)p Black
+ 62 5400 a(14.)p Black 41 w(Return)f(to)i(the)f(calling)g(application.)
+ 2025 83 y(When)d(the)h(calling)f(application)e(no)n(w)i(again)g
+ (switches)g(into)h(the)2025 183 y(established)25 b(machine)f(conte)o
+ (xt)g Fr(mctx)p Fx(,)i(the)f(thread)g(starts)h(run-)2025
+ 282 y(ning)h(at)i(routine)e Fr(sf)p 2614 282 V 31 w(addr)i
+ Fx(with)g(ar)o(gument)d Fr(sf)p 3405 282 V 30 w(ar)m(g)p
+ Fx(.)49 b(Figure)27 b(1)2025 382 y(illustrates)g(the)g(algorithm)e
+ (\(the)i(numbers)e(refer)h(to)i(the)e(algo-)2025 482
+ y(rithm)20 b(steps)g(listed)h(abo)o(v)o(e\).)2025 1015
+ y
+  14669332 30325391 0 0 14669332 30325391 startTexFig
+  2025 1015 a
+ %%BeginDocument: pmt-fig.eps
+ %!PS-Adobe-2.0 EPSF-2.0
+ %%Title: pmt-fig.eps
+ %%Creator: fig2dev Version 3.2.3 Patchlevel 
+ %%CreationDate: Sat Apr 22 23:14:14 2000
+ %%For: rse@en1.engelschall.com (Ralf S. Engelschall)
+ %%BoundingBox: 0 0 223 461
+ %%Magnification: 1.0000
+ %%EndComments
+ /$F2psDict 200 dict def
+ $F2psDict begin
+ $F2psDict /mtrx matrix put
+ /col-1 {0 setgray} bind def
+ /col0 {0.000 0.000 0.000 srgb} bind def
+ /col1 {0.000 0.000 1.000 srgb} bind def
+ /col2 {0.000 1.000 0.000 srgb} bind def
+ /col3 {0.000 1.000 1.000 srgb} bind def
+ /col4 {1.000 0.000 0.000 srgb} bind def
+ /col5 {1.000 0.000 1.000 srgb} bind def
+ /col6 {1.000 1.000 0.000 srgb} bind def
+ /col7 {1.000 1.000 1.000 srgb} bind def
+ /col8 {0.000 0.000 0.560 srgb} bind def
+ /col9 {0.000 0.000 0.690 srgb} bind def
+ /col10 {0.000 0.000 0.820 srgb} bind def
+ /col11 {0.530 0.810 1.000 srgb} bind def
+ /col12 {0.000 0.560 0.000 srgb} bind def
+ /col13 {0.000 0.690 0.000 srgb} bind def
+ /col14 {0.000 0.820 0.000 srgb} bind def
+ /col15 {0.000 0.560 0.560 srgb} bind def
+ /col16 {0.000 0.690 0.690 srgb} bind def
+ /col17 {0.000 0.820 0.820 srgb} bind def
+ /col18 {0.560 0.000 0.000 srgb} bind def
+ /col19 {0.690 0.000 0.000 srgb} bind def
+ /col20 {0.820 0.000 0.000 srgb} bind def
+ /col21 {0.560 0.000 0.560 srgb} bind def
+ /col22 {0.690 0.000 0.690 srgb} bind def
+ /col23 {0.820 0.000 0.820 srgb} bind def
+ /col24 {0.500 0.190 0.000 srgb} bind def
+ /col25 {0.630 0.250 0.000 srgb} bind def
+ /col26 {0.750 0.380 0.000 srgb} bind def
+ /col27 {1.000 0.500 0.500 srgb} bind def
+ /col28 {1.000 0.630 0.630 srgb} bind def
+ /col29 {1.000 0.750 0.750 srgb} bind def
+ /col30 {1.000 0.880 0.880 srgb} bind def
+ /col31 {1.000 0.840 0.000 srgb} bind def
+ 
+ end
+ save
+ newpath 0 461 moveto 0 0 lineto 223 0 lineto 223 461 lineto closepath clip newpath
+ -21.0 477.0 translate
+ 1 -1 scale
+ 
+ /cp {closepath} bind def
+ /ef {eofill} bind def
+ /gr {grestore} bind def
+ /gs {gsave} bind def
+ /sa {save} bind def
+ /rs {restore} bind def
+ /l {lineto} bind def
+ /m {moveto} bind def
+ /rm {rmoveto} bind def
+ /n {newpath} bind def
+ /s {stroke} bind def
+ /sh {show} bind def
+ /slc {setlinecap} bind def
+ /slj {setlinejoin} bind def
+ /slw {setlinewidth} bind def
+ /srgb {setrgbcolor} bind def
+ /rot {rotate} bind def
+ /sc {scale} bind def
+ /sd {setdash} bind def
+ /ff {findfont} bind def
+ /sf {setfont} bind def
+ /scf {scalefont} bind def
+ /sw {stringwidth} bind def
+ /tr {translate} bind def
+ /tnt {dup dup currentrgbcolor
+   4 -2 roll dup 1 exch sub 3 -1 roll mul add
+   4 -2 roll dup 1 exch sub 3 -1 roll mul add
+   4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
+   bind def
+ /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
+   4 -2 roll mul srgb} bind def
+ /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
+ /$F2psEnd {$F2psEnteredState restore end} def
+ 
+ $F2psBegin
+ %%Page: 1 1
+ 10 setmiterlimit
+  0.06299 0.06299 sc
+ % Polyline
+ 15.000 slw
+ n 780 705 m 750 705 750 855 30 arcto 4 {pop} repeat
+   750 885 900 885 30 arcto 4 {pop} repeat
+   930 885 930 735 30 arcto 4 {pop} repeat
+   930 705 780 705 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 1035 1185 m 1005 1185 1005 1335 30 arcto 4 {pop} repeat
+   1005 1365 1155 1365 30 arcto 4 {pop} repeat
+   1185 1365 1185 1215 30 arcto 4 {pop} repeat
+   1185 1185 1035 1185 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 3075 2760 m 3045 2760 3045 2910 30 arcto 4 {pop} repeat
+   3045 2940 3195 2940 30 arcto 4 {pop} repeat
+   3225 2940 3225 2790 30 arcto 4 {pop} repeat
+   3225 2760 3075 2760 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 3105 885 m 3075 885 3075 1035 30 arcto 4 {pop} repeat
+   3075 1065 3225 1065 30 arcto 4 {pop} repeat
+   3255 1065 3255 915 30 arcto 4 {pop} repeat
+   3255 885 3105 885 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 2040 1500 m 2010 1500 2010 1650 30 arcto 4 {pop} repeat
+   2010 1680 2160 1680 30 arcto 4 {pop} repeat
+   2190 1680 2190 1530 30 arcto 4 {pop} repeat
+   2190 1500 2040 1500 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 2040 2100 m 2010 2100 2010 2250 30 arcto 4 {pop} repeat
+   2010 2280 2160 2280 30 arcto 4 {pop} repeat
+   2190 2280 2190 2130 30 arcto 4 {pop} repeat
+   2190 2100 2040 2100 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 1035 705 m 1005 705 1005 855 30 arcto 4 {pop} repeat
+   1005 885 1155 885 30 arcto 4 {pop} repeat
+   1185 885 1185 735 30 arcto 4 {pop} repeat
+   1185 705 1035 705 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 2040 2640 m 2010 2640 2010 2790 30 arcto 4 {pop} repeat
+   2010 2820 2160 2820 30 arcto 4 {pop} repeat
+   2190 2820 2190 2670 30 arcto 4 {pop} repeat
+   2190 2640 2040 2640 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 2040 525 m 2010 525 2010 675 30 arcto 4 {pop} repeat
+   2010 705 2160 705 30 arcto 4 {pop} repeat
+   2190 705 2190 555 30 arcto 4 {pop} repeat
+   2190 525 2040 525 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 3075 2505 m 3045 2505 3045 2655 30 arcto 4 {pop} repeat
+   3045 2685 3195 2685 30 arcto 4 {pop} repeat
+   3225 2685 3225 2535 30 arcto 4 {pop} repeat
+   3225 2505 3075 2505 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 1305 1500 m 1275 1500 1275 1650 30 arcto 4 {pop} repeat
+   1275 1680 1425 1680 30 arcto 4 {pop} repeat
+   1455 1680 1455 1530 30 arcto 4 {pop} repeat
+   1455 1500 1305 1500 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 1545 3225 m 1515 3225 1515 3375 30 arcto 4 {pop} repeat
+   1515 3405 1665 3405 30 arcto 4 {pop} repeat
+   1695 3405 1695 3255 30 arcto 4 {pop} repeat
+   1695 3225 1545 3225 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 1350 570 m 1320 570 1320 720 30 arcto 4 {pop} repeat
+   1320 750 1470 750 30 arcto 4 {pop} repeat
+   1500 750 1500 600 30 arcto 4 {pop} repeat
+   1500 570 1350 570 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ % Polyline
+ n 3345 2505 m 3315 2505 3315 2655 30 arcto 4 {pop} repeat
+   3315 2685 3465 2685 30 arcto 4 {pop} repeat
+   3495 2685 3495 2535 30 arcto 4 {pop} repeat
+   3495 2505 3345 2505 30 arcto 4 {pop} repeat
+  cp gs 0.00 setgray ef gr gs col0 s gr 
+ /Times-Bold ff 150.00 scf sf
+ 3068 2895 m
+ gs 1 -1 sc (12) col7 sh gr
+ % Polyline
+ 7.500 slw
+ n 630 270 m 1890 270 l 1890 3600 l 630 3600 l
+  cp gs col0 s gr 
+ % Polyline
+ n 2340 270 m 3600 270 l 3600 1800 l 2340 1800 l
+  cp gs col0 s gr 
+ % Polyline
+ n 2340 2070 m 3600 2070 l 3600 3600 l 2340 3600 l
+  cp gs col0 s gr 
+ % Polyline
+  [15 15] 15 sd
+ n 1980 810 m 2025 720 l 2070 900 l 2115 720 l 2160 900 l
+  2205 810 l gs col0 s gr  [] 0 sd
+ % Polyline
+  [15 15] 15 sd
+ n 1980 1170 m 2014 1081 l 2059 1261 l 2104 1081 l 2149 1261 l
+  2205 1170 l gs col0 s gr  [] 0 sd
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1275 660 m 1275 600 l 1124 600 l 1244 630 l 1124 660 l cp
+ eoclip
+ n 1260 4586 m 1980 4593 l 1980 3690 l 450 3690 l 450 630 l 990 630 l
+ 
+  1260 630 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1124 660 m 1244 630 l 1124 600 l 1124 660 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1995 840 m 1995 780 l 1844 780 l 1964 810 l 1844 840 l cp
+ eoclip
+ n 1260 630 m 1260 810 l
+  1980 810 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1844 840 m 1964 810 l 1844 780 l 1844 840 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 2985 840 m 2985 780 l 2834 780 l 2954 810 l 2834 840 l cp
+ eoclip
+ n 2205 810 m
+  2970 810 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 2834 840 m 2954 810 l 2834 780 l 2834 840 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 2940 1185 m 3000 1185 l 3000 1034 l 2970 1154 l 2940 1034 l cp
+ eoclip
+ n 2970 810 m
+  2970 1170 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 2940 1034 m 2970 1154 l 3000 1034 l 2940 1034 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 2190 1140 m 2190 1200 l 2341 1200 l 2221 1170 l 2341 1140 l cp
+ eoclip
+ n 2205 1170 m
+  2970 1170 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 2341 1140 m 2221 1170 l 2341 1200 l 2341 1140 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1245 1140 m 1245 1200 l 1396 1200 l 1276 1170 l 1396 1140 l cp
+ eoclip
+ n 1260 1170 m
+  1980 1170 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1396 1140 m 1276 1170 l 1396 1200 l 1396 1140 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 2985 1470 m 2985 1410 l 2834 1410 l 2954 1440 l 2834 1470 l cp
+ eoclip
+ n 1260 1440 m
+  2970 1440 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 2834 1470 m 2954 1440 l 2834 1410 l 2834 1470 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ n 1260 1170 m
+  1260 1440 l gs col0 s gr 
+ % Polyline
+ gs  clippath
+ 2985 2550 m 2985 2490 l 2834 2490 l 2954 2520 l 2834 2550 l cp
+ eoclip
+ n 2970 1440 m 2970 1890 l 2250 1890 l 2250 2520 l
+  2970 2520 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 2834 2550 m 2954 2520 l 2834 2490 l 2834 2550 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ n 2970 2520 m
+  2970 2883 l gs col0 s gr 
+ % Polyline
+ gs  clippath
+ 1230 2852 m 1229 2912 l 1380 2913 l 1261 2883 l 1381 2853 l cp
+ eoclip
+ n 2970 2891 m
+  1245 2883 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1381 2853 m 1261 2883 l 1380 2913 l 1381 2853 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1229 4751 m 1230 4811 l 1381 4809 l 1261 4781 l 1380 4749 l cp
+ eoclip
+ n 1260 2880 m 1260 3150 l 2070 3150 l 2062 4773 l
+  1245 4781 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1380 4749 m 1261 4781 l 1381 4809 l 1380 4749 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1230 4601 m 1290 4601 l 1290 4450 l 1260 4570 l 1230 4450 l cp
+ eoclip
+ n 450 4050 m 1260 4050 l
+  1260 4586 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1230 4450 m 1260 4570 l 1290 4450 l 1230 4450 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 15.000 slw
+ gs  clippath
+ 1230 5235 m 1290 5234 l 1287 5083 l 1260 5204 l 1227 5084 l cp
+ eoclip
+ n 1252 4773 m
+  1260 5220 l gs col0 s gr gr
+ 
+ % arrowhead
+ 7.500 slw
+ n 1227 5084 m 1260 5204 l 1287 5083 l 1227 5084 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 2985 4260 m 2985 4200 l 2834 4200 l 2954 4230 l 2834 4260 l cp
+ eoclip
+ n 2970 3150 m 2970 3690 l 2250 3690 l 2250 4230 l
+  2970 4230 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 2834 4260 m 2954 4230 l 2834 4200 l 2834 4260 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ n 630 6300 m 1890 6300 l
+  1890 7290 l gs col0 s gr 
+ % Polyline
+ gs  clippath
+ 3660 7575 m 3720 7575 l 3720 7424 l 3690 7544 l 3660 7424 l cp
+ 3720 6285 m 3660 6285 l 3660 6436 l 3690 6316 l 3720 6436 l cp
+ eoclip
+ n 3690 6300 m
+  3690 7560 l gs col0 s gr gr
+ 
+ % arrowhead
+ n 3720 6436 m 3690 6316 l 3660 6436 l 3720 6436 l  cp gs 0.00 setgray ef gr  col0 s
+ % arrowhead
+ n 3660 7424 m 3690 7544 l 3720 7424 l 3660 7424 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ n 2340 6300 m 3600 6300 l 3600 7560 l 2340 7560 l
+  cp gs col0 s gr 
+ % Polyline
+ n 630 3780 m 1890 3780 l 1890 6120 l 630 6120 l
+  cp gs col0 s gr 
+ % Polyline
+ n 2340 3780 m 3600 3780 l 3600 6120 l 2340 6120 l
+  cp gs col0 s gr 
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 2985 3180 m 2985 3120 l 2834 3120 l 2954 3150 l 2834 3180 l cp
+ eoclip
+ n 1260 5220 m 2160 5220 l 2160 3150 l
+  2970 3150 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 2834 3180 m 2954 3150 l 2834 3120 l 2834 3180 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ n 630 6300 m
+  630 7380 l gs col0 s gr 
+ % Polyline
+ 1 slc
+ n 630 6570 m
+  900 6300 l gs col0 s gr 
+ % Polyline
+ n 630 6840 m
+  1170 6300 l gs col0 s gr 
+ % Polyline
+ n 630 7110 m
+  1440 6300 l gs col0 s gr 
+ % Polyline
+ n 630 7380 m
+  1710 6300 l gs col0 s gr 
+ % Polyline
+ n 810 7470 m
+  1890 6435 l gs col0 s gr 
+ % Polyline
+ n 1080 7515 m
+  1890 6750 l gs col0 s gr 
+ % Polyline
+ n 1665 7245 m
+  1890 7020 l gs col0 s gr 
+ % Polyline
+ n 2340 6570 m
+  2610 6300 l gs col0 s gr 
+ % Polyline
+ n 2340 6840 m
+  2925 6300 l gs col0 s gr 
+ % Polyline
+ n 2340 7110 m
+  3240 6300 l gs col0 s gr 
+ % Polyline
+ n 2340 7380 m
+  3510 6300 l gs col0 s gr 
+ % Polyline
+ n 2520 7560 m
+  3600 6570 l gs col0 s gr 
+ % Polyline
+ n 2880 7560 m
+  3600 6930 l gs col0 s gr 
+ % Polyline
+ n 3240 7560 m
+  3600 7245 l gs col0 s gr 
+ % Polyline
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 2940 5325 m 3000 5325 l 3000 5174 l 2970 5294 l 2940 5174 l cp
+ eoclip
+ n 2970 4230 m
+  2970 5310 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 2940 5174 m 2970 5294 l 3000 5174 l 2940 5174 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 1245 5280 m 1245 5340 l 1396 5340 l 1276 5310 l 1396 5280 l cp
+ eoclip
+ n 2970 5310 m
+  1260 5310 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 1396 5280 m 1276 5310 l 1396 5340 l 1396 5280 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 1245 5640 m 1245 5700 l 1396 5700 l 1276 5670 l 1396 5640 l cp
+ eoclip
+ n 2970 5580 m 2970 5670 l
+  1260 5670 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 1396 5640 m 1276 5670 l 1396 5700 l 1396 5640 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 345 5910 m 345 5970 l 496 5970 l 376 5940 l 496 5910 l cp
+ eoclip
+ n 1260 5670 m 1260 5940 l
+  360 5940 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 496 5910 m 376 5940 l 496 5970 l 496 5910 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ 1 slc
+ 15.000 slw
+  [15 45] 45 sd
+ gs  clippath
+ 2985 5610 m 2985 5550 l 2834 5550 l 2954 5580 l 2834 5610 l cp
+ eoclip
+ n 1260 5355 m 1260 5580 l
+  2970 5580 l gs col0 s gr gr
+  [] 0 sd
+ % arrowhead
+ 0 slc
+ 7.500 slw
+ n 2834 5610 m 2954 5580 l 2834 5550 l 2834 5610 l  cp gs 0.00 setgray ef gr  col0 s
+ % Polyline
+ n 630 7380 m 631 7381 l 634 7383 l 639 7388 l 647 7394 l 657 7402 l
+  670 7412 l 686 7423 l 703 7435 l 723 7448 l 744 7460 l
+  766 7472 l 791 7483 l 817 7493 l 845 7502 l 877 7509 l
+  911 7514 l 949 7517 l 991 7518 l 1035 7515 l 1076 7510 l
+  1115 7502 l 1150 7493 l 1181 7483 l 1207 7473 l 1228 7463 l
+  1245 7453 l 1259 7443 l 1269 7433 l 1278 7423 l 1286 7414 l
+  1294 7404 l 1303 7394 l 1314 7384 l 1327 7373 l 1344 7362 l
+  1364 7350 l 1390 7338 l 1419 7326 l 1454 7313 l 1491 7301 l
+  1530 7290 l 1576 7279 l 1619 7271 l 1657 7265 l 1690 7262 l
+  1720 7261 l 1747 7261 l 1771 7263 l 1793 7266 l 1813 7269 l
+  1831 7273 l 1847 7277 l 1861 7280 l 1872 7284 l 1880 7286 l
+  1885 7288 l 1889 7289 l
+  1890 7290 l gs col0 s gr 
+ /Times-Bold ff 150.00 scf sf
+ 2430 6480 m
+ gs 1 -1 sc (sk_addr) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 720 6480 m
+ gs 1 -1 sc (main stack) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 720 3960 m
+ gs 1 -1 sc (main) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2430 3960 m
+ gs 1 -1 sc (sf_addr\(sf_arg\)) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2430 2250 m
+ gs 1 -1 sc (mctx_create) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2430 450 m
+ gs 1 -1 sc (mctx_create) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 720 450 m
+ gs 1 -1 sc (mctx_create) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 3150 2250 m
+ gs 1 -1 sc (_boot) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2790 585 m
+ gs 1 -1 sc (_trampoline) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 3870 7110 m
+ gs 1 -1 sc  90.0 rot (sk_size) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1350 5175 m
+ gs 1 -1 sc (mctx_switch) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2385 5445 m
+ gs 1 -1 sc (mctx_switch) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1350 5535 m
+ gs 1 -1 sc (mctx_switch) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2385 5805 m
+ gs 1 -1 sc (mctx_switch) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1305 4725 m
+ gs 1 -1 sc (mctx_create) col0 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 810 840 m
+ gs 1 -1 sc (1) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1065 840 m
+ gs 1 -1 sc (2) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1065 1320 m
+ gs 1 -1 sc (6) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1335 1635 m
+ gs 1 -1 sc (7) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2070 1635 m
+ gs 1 -1 sc (8) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2070 660 m
+ gs 1 -1 sc (4) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1380 705 m
+ gs 1 -1 sc (3) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 3135 1020 m
+ gs 1 -1 sc (5) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2070 2235 m
+ gs 1 -1 sc (9) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 2040 2775 m
+ gs 1 -1 sc (13) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 3068 2640 m
+ gs 1 -1 sc (10) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 1545 3360 m
+ gs 1 -1 sc (14) col7 sh gr
+ /Times-Bold ff 150.00 scf sf
+ 3337 2640 m
+ gs 1 -1 sc (11) col7 sh gr
+ $F2psEnd
+ rs
+ 
+ %%EndDocument
+ 
+  endTexFig
+  2025 4944 a Fn(Figur)o(e)d(1:)66 b Fm(Illustration)18
+ b(of)c(the)h(machine)h(conte)o(xt)g(creation)h(procedure.)22
+ b(The)2350 5012 y(thick)h(solid)f(lines)h(and)e(numeric)i(marks)e
+ (correspond)i(to)f(the)g(al-)2350 5080 y(gorithm)c(steps)g(as)f
+ (described)i(in)f(section)h(3.2.)h(The)d(thick)i(dotted)2350
+ 5148 y(lines)h(sho)n(w)f(a)g(possible)h(further)g(processing)h(where)f
+ (a)f(fe)n(w)g(con-)2350 5216 y(te)o(xt)i(switches)h(are)e(performed)i
+ (to)e(dispatch)i(between)f(the)g(main)2350 5284 y(thread)e(and)e(the)h
+ (ne)n(w)g(created)h(thread.)p Black 1929 5700 a Fx(6)p
+ Black eop
+ %%Page: 7 7
+ 7 6 bop Black Black 0 83 a FA(3.3)99 b(Sour)n(ce)27 b(Code)0
+ 239 y Fx(The)43 b(corresponding)d(ANSI-C)k(code,)49 b(which)43
+ b(implements)0 338 y Fp(mctx)p 205 338 25 4 v 29 w(create)p
+ Fx(,)37 b(is)d(a)h(little)f(bit)h(more)e(complicated.)64
+ b(But)0 438 y(with)23 b(the)g(presented)e(algorithm)g(in)i(mind,)f(it)i
+ (is)f(no)n(w)f(straight-)0 538 y(forw)o(ard.)p Black
+ Black 0 693 a Fi(static)44 b Fk(mctx_t)313 b(mctx_caller;)0
+ 767 y Fi(static)44 b Fk(sig_atomic_t)f(mctx_called;)0
+ 917 y Fi(static)h Fk(mctx_t)268 b(*mctx_creat;)0 992
+ y Fi(static)44 b(void)313 b Fk(\(*mctx_creat_func\)\()p
+ Fi(void)41 b Fk(*\);)0 1066 y Fi(static)j(void)358 b
+ Fk(*mctx_creat_arg;)0 1141 y Fi(static)44 b Fk(sigset_t)223
+ b(mctx_creat_sigs;)0 1290 y Fi(void)44 b Fk(mctx_create\()179
+ 1365 y(mctx_t)g(*mctx,)179 1440 y Fi(void)g Fk(\(*sf_addr\)\()p
+ Fi(void)f Fk(*\),)h Fi(void)g Fk(*sf_arg,)179 1515 y
+ Fi(void)g Fk(*sk_addr,)g Fi(size_t)g Fk(sk_size\))0 1589
+ y Fo(f)179 1664 y Fi(struct)g Fk(sigaction)f(sa;)179
+ 1739 y Fi(struct)h Fk(sigaction)f(osa;)179 1813 y Fi(struct)h
+ Fk(sigaltstack)f(ss;)179 1888 y Fi(struct)h Fk(sigaltstack)f(oss;)179
+ 1963 y(sigset_t)h(osigs;)179 2038 y(sigset_t)g(sigs;)179
+ 2187 y(/*)64 b Fj(Step)18 b(1:)45 b Fk(*/)179 2262 y
+ (sigemptyset\(&sigs\);)179 2336 y(sigaddset\(&sigs,)d(SIGUSR1\);)179
+ 2411 y(sigprocmask\(SIG_BLOCK,)f(&sigs,)j(&osigs\);)179
+ 2561 y(/*)64 b Fj(Step)18 b(2:)45 b Fk(*/)179 2635 y(memset\(\()p
+ Fi(void)e Fk(*\)&sa,)h(0,)493 2710 y Fi(sizeof)p Fk(\()p
+ Fi(struct)f Fk(sigaction\)\);)179 2785 y(sa.sa_handler)g(=)i
+ (mctx_create_trampoline;)179 2860 y(sa.sa_flags)e(=)i(SA_ONSTACK;)179
+ 2934 y(sigemptyset\(&sa.sa_mask\);)179 3009 y(sigaction\(SIGUSR1,)d
+ (&sa,)i(&osa\);)179 3158 y(/*)64 b Fj(Step)18 b(3:)45
+ b Fk(*/)179 3233 y(ss.ss_sp)178 b(=)45 b(sk_addr;)179
+ 3308 y(ss.ss_size)88 b(=)45 b(sk_size;)179 3383 y(ss.ss_flags)e(=)i(0;)
+ 179 3457 y(sigaltstack\(&ss,)d(&oss\);)179 3607 y(/*)64
+ b Fj(Step)18 b(4:)45 b Fk(*/)179 3681 y(mctx_creat)268
+ b(=)44 b(mctx;)179 3756 y(mctx_creat_func)f(=)h(sf_addr;)179
+ 3831 y(mctx_creat_arg)88 b(=)44 b(sf_arg;)179 3906 y(mctx_creat_sigs)f
+ (=)h(osigs;)179 3980 y(mctx_called)223 b(=)44 b(FALSE;)179
+ 4055 y(kill\(getpid\(\),)f(SIGUSR1\);)179 4130 y(sigfillset\(&sigs\);)
+ 179 4204 y(sigdelset\(&sigs,)f(SIGUSR1\);)179 4279 y
+ Fi(while)i Fk(\(!mctx_called\))359 4354 y(sigsuspend\(&sigs\);)179
+ 4503 y(/*)64 b Fj(Step)18 b(6:)45 b Fk(*/)179 4578 y
+ (sigaltstack\(NULL,)d(&ss\);)179 4653 y(ss.ss_flags)h(=)i(SS_DISABLE;)
+ 179 4728 y(sigaltstack\(&ss,)d(NULL\);)179 4802 y(if)j
+ (\(!\(oss.ss_flags)d(&)j(SS_DISABLE\)\))359 4877 y(sigaltstack\(&oss,)d
+ (NULL\);)179 4952 y(sigaction\(SIGUSR1,)g(&osa,)i(NULL\);)179
+ 5026 y(sigprocmask\(SIG_SETMASK,)717 5101 y(&osigs,)g(NULL\);)179
+ 5251 y(/*)64 b Fj(Step)18 b(7)h(&)g(Step)f(8:)45 b Fk(*/)179
+ 5325 y(mctx_switch\(&mctx_caller,)c(mctx\);)2204 83 y(/*)64
+ b Fj(Step)18 b(14:)45 b Fk(*/)2204 158 y Fi(return)p
+ Fk(;)2025 232 y Fo(g)2025 382 y Fi(void)f Fk(mctx_create_trampoline\()p
+ Fi(int)d Fk(sig\))2025 457 y Fo(f)2204 531 y Fk(/*)64
+ b Fj(Step)18 b(5:)45 b Fk(*/)2204 606 y Fi(if)g Fk
+ (\(mctx_save\(mctx_creat\))c(==)j(0\))h Fo(f)2384 681
+ y Fk(mctx_called)e(=)h(TRUE;)2384 756 y Fi(return)p Fk(;)2204
+ 830 y Fo(g)2204 980 y Fk(/*)64 b Fj(Step)18 b(9:)45 b
+ Fk(*/)2204 1054 y(mctx_create_boot\(\);)2025 1129 y Fo(g)2025
+ 1279 y Fi(void)f Fk(mctx_create_boot\()p Fi(void)p Fk(\))2025
+ 1353 y Fo(f)2204 1428 y Fi(void)g Fk(\(*mctx_start_func\)\()p
+ Fi(void)d Fk(*\);)2204 1503 y Fi(void)j Fk(*mctx_start_arg;)2204
+ 1652 y(/*)64 b Fj(Step)18 b(10:)45 b Fk(*/)2204 1727
+ y(sigprocmask\(SIG_SETMASK,)2742 1802 y(&mctx_creat_sigs,)d(NULL\);)
+ 2204 1951 y(/*)64 b Fj(Step)18 b(11:)45 b Fk(*/)2204
+ 2026 y(mctx_start_func)e(=)h(mctx_creat_func;)2204 2100
+ y(mctx_start_arg)88 b(=)44 b(mctx_creat_arg;)2204 2250
+ y(/*)64 b Fj(Step)18 b(12)h(&)g(Step)g(13:)45 b Fk(*/)2204
+ 2325 y(mctx_switch\(mctx_creat,)c(&mctx_caller\);)2204
+ 2474 y(/*)64 b Fj(The)18 b(thread)h(``magically'')g(starts...)62
+ b Fk(*/)2204 2549 y(mctx_start_func\(mctx_start_arg\);)2204
+ 2698 y(/*)45 b(NOTREACHED)e(*/)2204 2773 y(abort\(\);)2025
+ 2848 y Fo(g)2025 3124 y FA(3.4)99 b(Run-time)26 b(P)n(enalty)2025
+ 3294 y Fx(After)31 b(this)h(discussion)f(of)g(the)g(implementation)e
+ (details,)35 b(an)2025 3393 y(ob)o(viously)29 b(occuring)h(question)g
+ (no)n(w)h(is)h(what)g(the)f(e)o(xpected)2025 3493 y(run-time)g(penalty)
+ h(is.)63 b(That)32 b(is,)k(what)d(does)f(our)g(presented)2025
+ 3592 y(machine)43 b(conte)o(xt)f(implementation)g(cost)i(compared)e(to)
+ i(a)2025 3692 y Fp(ucontext)p Fx(\(3\))33 b(based)j(solution.)70
+ b(From)35 b(the)g(already)f(dis-)2025 3792 y(cussed)21
+ b(details)h(we)g(can)f(easily)h(guess)f(that)h(our)e(comple)o(x)g(ma-)
+ 2025 3891 y(chine)27 b(conte)o(xt)f(creation)h(procedure)d(\()p
+ Fp(mctx)p 3392 3891 V 29 w(create)p Fx(\))j(will)2025
+ 3991 y(be)20 b(certainly)f(noticeably)f(slo)n(wer)i(than)g(a)g
+ (solution)f(based)h(on)f(a)2025 4091 y Fp(ucontext)p
+ Fx(\(3\))f(f)o(acility)-5 b(.)2150 4197 y(But)48 b(a)g(wild)g(guess)f
+ (is)i(not)e(suf)n(\002cing)g(for)g(a)h(reason-)2025 4297
+ y(able)d(statement.)101 b(So)45 b(we)h(ha)n(v)o(e)f(written)g(a)h
+ Fr(Simple)f(Ma-)2025 4397 y(c)o(hine)21 b(Conte)n(xt)g(Benc)o(hmark)g
+ Fx(\(SMCB)i([32)n(]\))f(which)f(w)o(as)h(used)2025 4496
+ y(to)36 b(compare)e(run-time)g(costs)j(of)e(the)h Fp(mctx)p
+ 3421 4496 V 29 w(create)f Fx(and)2025 4596 y Fp(mctx)p
+ 2230 4596 V 29 w(switch)27 b Fx(functions)f(if)h(once)f(implemented)g
+ (through)2025 4696 y(the)17 b Fr(POSIX)i Fp(makecontext)p
+ Fx(\(3\)/)p Fp(swapcontext)p Fx(\(3\))11 b(func-)2025
+ 4795 y(tions)55 b(\(as)h(sho)n(wn)f(in)g(section)h(2.3\),)63
+ b(and)55 b(once)f(imple-)2025 4895 y(mented)44 b(with)g(our)g(based)g
+ (f)o(allback)g(implementation)f(\(for)2025 4994 y(con)m(v)o(enience)c
+ (reasons)j(we)h(directly)e(used)h Fp(sigjmp)p 3706 4994
+ V 29 w(buf)p Fx(,)2025 5094 y Fp(sigsetjmp)p Fx(\(3\))g(and)h
+ Fp(siglongjmp)p Fx(\(3\))f(in)i(the)g(bench-)2025 5194
+ y(mark,)31 b(because)d(all)i(tested)g(platforms)e(pro)o(vided)e
+ (this\).)53 b(The)2025 5293 y(results)21 b(are)f(sho)n(wn)f(T)-7
+ b(able)20 b(3)h(belo)n(w)-5 b(.)2150 5400 y(As)32 b(one)e(can)h(deri)n
+ (v)o(e)f(from)g(these)i(e)n(v)n(aluations,)g(our)e(sig-)p
+ Black 1929 5700 a(7)p Black eop
+ %%Page: 8 8
+ 8 7 bop Black Black 0 83 a Fx(nal)25 b(stack)f(trick)h(to)f(implement)f
+ Fp(mctx)p 1174 83 25 4 v 30 w(create)h Fx(in)g(practice)0
+ 183 y(is)31 b(approximately)c(15)j(times)h(slo)n(wer)f(than)f(the)h
+ Fp(makecon-)0 282 y(text)p Fx(\(3\))36 b(based)i(v)n(ariant.)77
+ b(This)38 b(cost)g(should)f(not)g(be)h(ne-)0 382 y(glected.)f(On)25
+ b(the)f(other)g(hand,)g(the)h Fp(sigsetjmp)p Fx(\(3\)/)d
+ Fp(sig-)0 482 y(longjmp)p Fx(\(3\))29 b(based)i Fp(mctx)p
+ 903 482 V 29 w(switch)g Fx(performs)f(about)g(as)0 581
+ y(good)17 b(as)h(the)g Fp(swapcontext)p Fx(\(3\))e(based)i(v)n(ariant)f
+ (\(the)g(reason)0 681 y(why)29 b(on)g(most)g(of)h(the)f(tested)h
+ (platforms)e(it)j(is)f(e)n(v)o(en)f(slightly)0 780 y(f)o(aster)37
+ b(is)h(not)f(kno)n(wn)e(\226)i(b)n(ut)g(we)g(guess)g(it)h(is)g(related)
+ e(to)h(a)0 880 y(greater)26 b(management)f(o)o(v)o(erhead)f(in)k(the)f
+ Fp(ucontext)p Fx(\(3\))e(f)o(a-)0 980 y(cility)-5 b(,)16
+ b(which)f(is)i(a)f(superset)f(of)g(the)h(functionality)e(we)h
+ (require\).)0 1079 y(Or)h(in)g(short:)22 b(our)15 b(presented)g(f)o
+ (allback)g(approach)e(costs)j(notice-)0 1179 y(able)24
+ b(e)o(xtra)g(CPU)h(c)o(ycles)f(on)g(thread)f(creation)g(time,)i(b)n(ut)
+ g(is)g(as)0 1279 y(f)o(ast)17 b(as)g(the)g(standardized)d(solution)i
+ (under)f(thread)g(dispatching)0 1378 y(time.)p 0 1492
+ 1899 4 v 0 2931 4 1440 v 78 1562 a Fn(10000)j Ff(\002)e
+ Fn(mctx)p 475 1562 20 4 v 25 w(cr)o(eate)j(\(in)e(seconds\):)78
+ 1710 y(Platf)n(orm)p 827 1734 4 79 v 561 w(mcsc)p 1080
+ 1734 V 165 w(sjlj)p 1332 1734 V 103 w(o)o(v)o(erhead)78
+ 1789 y Fm(Sun)g(Solaris)h(2.6)f(\(SP)-6 b(ARC\))p 827
+ 1813 V 133 w(0.076)p 1080 1813 V 104 w(1.268)p 1332 1813
+ V 247 w(16.7)78 1868 y(DEC)16 b(T)n(ru64)h(5.0)g(\(Alpha\))p
+ 827 1892 V 171 w(0.019)p 1080 1892 V 104 w(0.235)p 1332
+ 1892 V 247 w(12.4)78 1947 y(SGI)g(IRIX)g(6.5)f(\(MIPS\))p
+ 827 1971 V 227 w(0.105)p 1080 1971 V 104 w(1.523)p 1332
+ 1971 V 247 w(14.5)78 2026 y(SCO)h(UnixW)-5 b(are)18 b(7.0)e(\(Intel\))p
+ 827 2050 V 105 w(0.204)p 1080 2050 V 104 w(3.827)p 1332
+ 2050 V 247 w(18.8)78 2105 y(HP)h(HP/UX)f(11.0)h(\(HPP)-6
+ b(A\))p 827 2128 V 144 w(0.057)p 1080 2128 V 104 w(0.667)p
+ 1332 2128 V 247 w(11.8)1192 2184 y Fn(A)f(v)o(erage:)89
+ b(14.8)78 2311 y(10000)18 b Ff(\002)e Fn(mctx)p 475 2311
+ 20 4 v 25 w(switch)i(\(in)f(seconds\):)78 2410 y(Platf)n(orm)p
+ 827 2433 4 79 v 561 w(mcsc)p 1080 2433 V 165 w(sjlj)p
+ 1332 2433 V 103 w(o)o(v)o(erhead)78 2488 y Fm(Sun)g(Solaris)h(2.6)f
+ (\(SP)-6 b(ARC\))p 827 2512 V 133 w(0.137)p 1080 2512
+ V 104 w(0.210)p 1332 2512 V 281 w(1.5)78 2567 y(DEC)16
+ b(T)n(ru64)h(5.0)g(\(Alpha\))p 827 2591 V 171 w(0.034)p
+ 1080 2591 V 104 w(0.022)p 1332 2591 V 281 w(0.6)78 2646
+ y(SGI)g(IRIX)g(6.5)f(\(MIPS\))p 827 2670 V 227 w(0.235)p
+ 1080 2670 V 104 w(0.190)p 1332 2670 V 281 w(0.8)78 2725
+ y(SCO)h(UnixW)-5 b(are)18 b(7.0)e(\(Intel\))p 827 2749
+ V 105 w(0.440)p 1080 2749 V 104 w(0.398)p 1332 2749 V
+ 281 w(0.9)78 2804 y(HP)h(HP/UX)f(11.0)h(\(HPP)-6 b(A\))p
+ 827 2828 V 144 w(0.106)p 1080 2828 V 104 w(0.065)p 1332
+ 2828 V 281 w(0.6)1225 2883 y Fn(A)f(v)o(erage:)90 b(0.9)p
+ 1896 2931 4 1440 v 0 2934 1899 4 v 0 3022 a(T)-6 b(able)18
+ b(3:)67 b Fm(Summary)20 b(of)h Fl(Simple)i(Mac)o(hine)g(Conte)o(xt)g
+ (Benc)o(hmark)g Fm(\(SMCB,)295 3090 y([32]\).)d(The)d(speed)g(of)g
+ (machine)h(conte)o(xt)h(creation)g(and)e(switching)295
+ 3158 y(found)25 b(on)g(each)h(tested)g(operating)i(system.)44
+ b Fn(mcsc)p Fm(:)38 b(functional)295 3226 y Fh(makecontext)p
+ Fm(\(3\))11 b(/)i Fh(switchcontext)p Fm(\(3\),)f Fn(sjlj)p
+ Fm(:)20 b(functional)295 3293 y Fh(sigsetjmp)p Fm(\(3\)/)p
+ Fh(siglongjmp)p Fm(\(3\).)58 b Fn(o)o(v)o(erhead)p Fm(:)49
+ b(the)31 b(o)o(v)o(er)o(-)295 3359 y(head)18 b(of)f(using)g
+ Fn(sjlj)g Fm(instead)i(of)e Fn(mcsc)p Fm(.)0 3573 y FA(3.5)99
+ b(Remaining)25 b(Issues)0 3730 y Fx(The)20 b(presented)e(algorithm)h
+ (and)g(source)g(code)h(can)f(be)h(directly)0 3829 y(used)29
+ b(in)h(practice)f(for)f(implementing)g(a)i(minimal)e(threading)0
+ 3929 y(system)e(or)g(the)g(concept)e(of)i(co-routines.)40
+ b(Its)27 b(big)f(adv)n(antage)0 4029 y(is)20 b(that)f(if)g(the)g
+ (operating)e(system)i(pro)o(vides)e(the)i(required)e(stan-)0
+ 4128 y(dardized)j(primiti)n(v)o(es,)g(we)h(do)g(not)g(need)f(to)i(kno)n
+ (w)e(an)o(ything)f(at)0 4228 y(all)28 b(about)e(the)h(machine)g(we)g
+ (are)g(running)f(on)g(\227)i(e)n(v)o(erything)0 4327
+ y(just)d(w)o(orks.)38 b(Ne)n(v)o(ertheless,)25 b(there)f(remain)g(a)h
+ (fe)n(w)f(special)h(is-)0 4427 y(sues)c(we)f(still)i(ha)n(v)o(e)d(to)i
+ (discuss.)0 4577 y FA(The)26 b(W)-6 b(aggly)23 b(longjmp\(3\))i(after)h
+ (Retur)o(n)0 4702 y Fx(On)e(some)f(platforms,)h Fp(longjmp)p
+ Fx(\(3\))e(may)h(not)g(be)h(called)g(af-)0 4802 y(ter)30
+ b(the)g(function)e(which)i(called)f(the)h Fp(setjmp)p
+ Fx(\(3\))f(returned.)0 4902 y(When)22 b(this)i(is)f(done,)f(the)h
+ (stack)g(frame)e(situation)i(is)g(not)f(guar)n(-)0 5001
+ y(anteed)k(to)h(be)g(in)f(a)i(clean)e(and)g(consistent)h(state.)45
+ b(But)27 b(this)h(is)0 5101 y(e)o(xactly)c(the)h(mechanism)f(we)h(use)g
+ (in)g(order)f(to)h(get)g(rid)g(of)g(the)0 5200 y(signal)20
+ b(handler)f(scope)h(in)g(step)g(5.)125 5300 y(The)c(only)g(alternati)n
+ (v)o(e)g(w)o(ould)g(be)h(to)g(lea)n(v)o(e)g(the)g(signal)f(han-)0
+ 5400 y(dler)27 b(via)g Fp(longjmp)p Fx(\(3\),)g(b)n(ut)g(then)g(we)h(w)
+ o(ould)e(ha)n(v)o(e)h(another)2025 83 y(problem,)f(as)h(e)o(xperience)d
+ (sho)n(wed.)41 b(F)o(or)26 b(instance,)j(R)q Fm(O)t(B)t(E)t(RT)2027
+ 183 y Fx(S)t(.)k(T)t Fm(H)t(AU)r Fx(')-5 b(s)29 b Fr(Really)e(Simple)g
+ (Thr)m(eads)h Fx(\()p Fr(r)o(sthr)m(eads)p Fx(\))f([27)o(])h(w)o(as)
+ 2025 282 y(ported)17 b(to)h(se)n(v)o(eral)f(platforms)g(and)g(w)o(as)i
+ (used)f(to)g(run)f(an)h(e)o(xper)n(-)2025 382 y(imental)23
+ b(multithreaded)d(v)o(ersion)i(of)h(the)g(Apache)f(webserv)o(er)-5
+ b(.)2027 482 y(T)t Fm(H)t(AU)r Fx(')g(s)18 b(approach)d(w)o(as)i
+ (similar)g(to)g(ours,)g(b)n(ut)f(dif)n(fered)f(signif-)2025
+ 581 y(icantly)k(in)h(the)f(w)o(ay)g(the)h(signal)f(handler)f(is)i
+ (left.)25 b(In)19 b(particular)m(,)2025 681 y(in)27 b(an)f(attempt)g
+ (to)h(a)n(v)n(oid)f(the)g(unsafe)g(stack)h(frame,)g(it)g(used)f(a)2025
+ 780 y Fp(longjmp)p Fx(\(3\))19 b(call)i(to)g(lea)n(v)o(e)f(the)h
+ (signal)f(handler)m(,)f(rather)h(than)2025 880 y(returning)27
+ b(from)h(it.)51 b(But)30 b(this)f(approach)e(does)h(not)h(w)o(ork)f(on)
+ 2025 980 y(some)20 b Fr(SysV)6 b Fx(-deri)n(v)o(ed)18
+ b(k)o(ernels,)h(as)i(we)g(already)e(mentioned.)2150 1079
+ y(The)31 b(problem)e(is)k(that)e(these)h(k)o(ernels)f(do)g(not)g
+ (\223belie)n(v)o(e\224)2025 1179 y(that)e(the)g(code)g(is)h(out)e(of)h
+ (the)g(signal-handling)e(conte)o(xt,)i(un-)2025 1279
+ y(til)k(the)f(signal)f(handler)g(has)h(returned)e(\227)i(and)g
+ (accordingly)-5 b(,)2025 1378 y(refuse)28 b(to)g(allo)n(w)g
+ (readjustment)f(of)g(the)i(signal)f(stack)g(until)g(it)2025
+ 1478 y(has.)61 b(But)32 b(with)g(the)h Fr(r)o(sthr)m(eads)f
+ Fx(approach,)g(the)h(signal)e(han-)2025 1577 y(dler)23
+ b(that)f(created)h(the)f(\002rst)i(thread)e(ne)n(v)o(er)f(returns,)i
+ (and)f(when)2025 1677 y Fr(r)o(sthr)m(eads)17 b Fx(w)o(ants)g(to)g
+ (create)g(the)g(second)f(thread,)g(these)h(k)o(ernels)2025
+ 1777 y(refuse)23 b(to)g(readjust)g(the)h(signal)f(stack,)h(and)f(we)h
+ (are)f(stuck.)34 b(So)2025 1876 y(with)17 b(portability)e(in)i(mind,)f
+ (we)h(decided)e(that)i(it)g(is)h(better)e(to)h(get)2025
+ 1976 y(rid)23 b(of)f(the)h(signal)g(handler)f(scope)g(with)h(the)g
+ (straight-forw)o(ard)2025 2076 y(\223)p Fp(return)p Fx(\224)38
+ b(and)h(instead)g(\002ght)g(the)g(mentioned)f(\(simpler\))2025
+ 2175 y(problem)18 b(of)i(an)h(unsafe)e(stack)h(frame.)2150
+ 2275 y(F)o(ortunately)-5 b(,)24 b(in)i(practice)e(this)i(is)h(not)e(as)
+ h(problematic)e(as)2025 2374 y(it)j(seems,)h(because)e(e)n(v)n
+ (aluations)f(\(for)h Fr(GNU)h(Pth)p Fx(\))f(on)g(a)h(wide)2025
+ 2474 y(range)35 b(of)g(current)g(Unix)g(platforms)g(sho)n(wed)g(that)h
+ (one)f(can)2025 2574 y(reach)21 b(a)g(safe)h(stack)f(frame)f(again)h
+ (by)f(just)i(calling)f(a)h(function.)2025 2673 y(That)k(is)i(the)e
+ (reason)g(why)f(our)h(algorithm)f(enters)h(the)g(second)2025
+ 2773 y(trampoline)18 b(function)h(in)h(step)h(9.)2025
+ 2918 y FA(The)26 b(Uncooperati)o(v)o(e)g(longjmp\(3\))2025
+ 3040 y Fx(Ev)o(en)e(on)i(operating)d(systems)j(which)f(ha)n(v)o(e)g(w)o
+ (orking)f Fr(POSIX)2025 3140 y Fx(functions,)c(our)g(approach)f(may)h
+ (theoretically)g(still)i(not)e(w)o(ork,)2025 3240 y(because)48
+ b Fp(longjmp)p Fx(\(3\))f(does)i(not)f(cooperate.)109
+ b(F)o(or)49 b(in-)2025 3339 y(stance,)17 b(on)e(some)h(platforms)f(the)
+ h(standard)f Fr(libc)i Fp(longjmp)p Fx(\(3\))2025 3439
+ y(branches)d(to)h(error)n(-handling)d(code)j(if)g(it)h(detects)g(that)f
+ (the)h(caller)2025 3539 y(tries)j(to)h(jump)e Fr(up)g
+ Fx(the)h(stack,)g Fr(i.e)o(.)p Fx(,)g(into)g(a)g(stack)g(frame)f(that)h
+ (has)2025 3638 y(already)g(returned.)2150 3738 y(This)28
+ b(is)h(usually)f(implemented)f(by)h(comparing)e(the)i(cur)n(-)2025
+ 3837 y(rent)f(stack)g(pointer)f(to)h(the)g(one)f(in)h(the)g
+ Fp(jmp)p 3387 3837 25 4 v 30 w(buf)g Fx(structure.)2025
+ 3937 y(That)j(is)h(why)e(it)i(is)g(important)e(for)g(our)h(algorithm)e
+ (to)j(return)2025 4037 y(from)19 b(the)g(signal)h(handler)e(and)h(this)
+ h(w)o(ay)f(enter)g(the)h(\(dif)n(ferent\))2025 4136 y(stack)31
+ b(of)g(the)h(parent)e(thread.)57 b(In)31 b(practice,)i(the)e(implemen-)
+ 2025 4236 y(tation)26 b(in)g Fr(GNU)h(Pth)f Fx(sho)n(wed)g(that)g(then)
+ g(one)f(no)h(longer)f(suf-)2025 4336 y(fers)16 b(from)f(those)g
+ (uncooperati)n(v)o(e)d Fp(longjmp)p Fx(\(3\))i(implementa-)2025
+ 4435 y(tions,)k(b)n(ut)f(one)f(should)h(k)o(eep)f(this)i(point)e(in)i
+ (mind)e(when)h(reach-)2025 4535 y(ing)29 b(e)n(v)o(en)f(more)h
+ (uncooperati)n(v)o(e)d(v)n(ariants)j(on)g(esoteric)g(Unix)2025
+ 4634 y(platforms.)22 b(If)16 b(it)h(still)g(occurs,)f(one)g(can)g(only)
+ f(try)h(to)g(resume)g(the)2025 4734 y(operation)24 b(by)h(using)f(a)i
+ (possibly)f(e)o(xisting)g(platform-speci\002c)2025 4834
+ y(error)19 b(handling)f(hook.)2025 4979 y FA(Garbage)25
+ b(at)g(Bottom)g(of)g(Stacks)2025 5101 y Fx(There)17 b(is)i(a)f(subtle)f
+ (side-ef)n(fect)g(of)g(our)g(implementation:)22 b(there)2025
+ 5201 y(remains)16 b(some)h(garbage)e(at)j(the)f(bottom)e(of)i(each)g
+ (thread)f(stack.)2025 5300 y(The)33 b(reason)g(is)i(that)e(if)h(a)g
+ (signal)g(is)g(deli)n(v)o(ered,)h(the)f(operat-)2025
+ 5400 y(ing)d(system)g(pushes)f(some)h(state)h(onto)e(the)h(stack,)i
+ (which)e(is)p Black 1929 5700 a(8)p Black eop
+ %%Page: 9 9
+ 9 8 bop Black Black 0 83 a Fx(restored)27 b(later)m(,)j(when)e(the)h
+ (signal)f(handler)f(returns.)48 b(But)29 b(al-)0 183
+ y(though)h(we)h(return)f(from)h(the)g(signal)g(handler)m(,)h(we)g(jump)
+ e(in)0 282 y(again,)c(and)g(this)h(time)f(we)g(enter)g(not)g(directly)f
+ (at)i(the)f(bottom)0 382 y(of)17 b(the)g(stack,)g(because)f(of)h(the)g
+ Fp(setjmp)p Fx(\(3\))e(in)i(the)g(trampoline)0 482 y(function.)125
+ 587 y(Since)31 b(the)h(operating)d(system)j(has)f(to)h(capture)e(all)j
+ (CPU)0 687 y(re)o(gisters)22 b(\(including)d(those)j(that)g(are)g
+ (ordinarily)e(scratch)i(re)o(g-)0 787 y(isters)f(or)f(caller)n(-sa)n(v)
+ o(e)g(re)o(gisters\),)f(there)h(can)g(be)g(a)h(f)o(air)f(amount)0
+ 886 y(of)h(memory)e(at)i(the)h(bottom)d(of)i(the)g(established)g
+ (thread)f(stack.)0 986 y(F)o(or)d(some)h(systems)g(this)g(can)g(be)g(e)
+ n(v)o(en)e(up)i(to)g(1)g(KB)g(of)g(garbage)0 1085 y([27)o(].)25
+ b(But)19 b(e)o(xcept)g(for)f(the)i(additional)d(memory)h(consumption)0
+ 1185 y(it)j(does)f(not)g(hurt.)125 1291 y(W)-7 b(e)32
+ b(just)g(ha)n(v)o(e)f(to)h(k)o(eep)f(in)h(mind)f(this)h(additional)e
+ (stack)0 1391 y(consumption)25 b(when)j(deciding)e(the)i(stack)g(size)h
+ (\()p Fr(sk)p 1569 1391 25 4 v 29 w(size)p Fx(\).)49
+ b(A)0 1490 y(reasonable)23 b(stack)i(size)g(usually)f(is)i(between)e
+ (16)g(and)g(32)g(KB.)0 1590 y(Less)31 b(is)h(neither)e(reasonable)f
+ (nor)h(al)o(w)o(ays)h(allo)n(wed)f(\(current)0 1689 y(Unix)c(platforms)
+ f(usually)h(require)f(a)i(stack)g(to)f(be)h(at)g(least)g(16)0
+ 1789 y(KB)21 b(in)f(size\).)0 1957 y FA(Stack)26 b(Ov)o(er\003o)o(ws)0
+ 2094 y Fx(There)47 b(is)j(a)e(noticeable)f(dif)n(ference)g(between)g
+ (the)h(initial)0 2193 y Fp(main)p Fx(\(\))29 b(thread)f(and)h(the)h(e)o
+ (xplicitly)f(spa)o(wned)f(threads:)44 b(the)0 2293 y(initial)31
+ b(thread)f(runs)g(on)h(the)f(standard)g(process)g(stack.)57
+ b(This)0 2393 y(stack)43 b(automatically)e(can)h(gro)n(w)g(under)f
+ (Unix,)47 b(while)c(the)0 2492 y(stacks)22 b(of)g(the)g(spa)o(wned)f
+ (threads)g(are)h(\002x)o(ed)f(in)h(size.)31 b(So)22 b(stack)0
+ 2592 y(o)o(v)o(er\003o)n(ws)k(can)h(occur)f(for)h(the)g(spa)o(wned)f
+ (threads.)45 b(This)28 b(im-)0 2692 y(plies)g(that)g(the)g(parent)f
+ (has)h(to)h(mak)o(e)e(a)h(reasonable)f(guess)h(of)0 2791
+ y(the)22 b(threads)f(stack)h(space)g(requirement)d(already)i(at)h(spa)o
+ (wning)0 2891 y(time.)125 2997 y(And)g(there)g(is)i(no)e(really)h
+ (portable)e(solution)h(to)h(this)g(prob-)0 3096 y(lem,)32
+ b(because)d(e)n(v)o(en)f(if)i(the)g(thread)f(library')-5
+ b(s)28 b(scheduler)h(can)0 3196 y(detect)16 b(the)g(stack)g(o)o(v)o
+ (er\003o)n(w)-5 b(,)15 b(it)i(cannot)e(easily)h(resize)g(the)h(stack.)0
+ 3296 y(The)34 b(reason)g(is)h(simply)f(that)g(the)h(stack)f
+ (initialization)g(goes)0 3395 y(hand)26 b(in)h(hand)f(with)i(the)f
+ (initialization)f(of)h(the)g(start)h(routine,)0 3495
+ y(as)d(we)g(discussed)f(before.)36 b(And)24 b(this)h(start)g(routine)e
+ (has)i(to)g(be)0 3594 y(a)e(real)g(C)h(function)d(in)i(order)f(to)g
+ Fr(call)p Fx(.)33 b(But)24 b(once)e(the)h(thread)f(is)0
+ 3694 y(running,)i(there)g(no)h(longer)f(e)o(xists)h(such)g(an)g(entry)f
+ (point.)39 b(So,)0 3794 y(e)n(v)o(en)30 b(if)h(the)g(scheduler)f(w)o
+ (ould)g(be)h(able)f(to)h(gi)n(v)o(e)g(the)g(thread)0
+ 3893 y(a)g(ne)n(w)g(enlar)o(ged)e(stack,)34 b(there)c(is)i(no)e(chance)
+ g(to)i(restart)f(the)0 3993 y(thread)19 b(on)h(this)h(ne)n(w)f(stack.)
+ 125 4099 y(Or)i(more)f(correct,)g(there)g(is)i(no)f Fr(portable)f
+ 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)
+ n(vious)e(problems,)g(there)h(is)i(a)f(non-portable)0
+ 4298 y(solution.)49 b(That)28 b(is)i(why)d(our)h(implementation)e(did)j
+ (not)f(deal)0 4398 y(with)g(this)h(issue.)48 b(Instead)28
+ b(in)g(practice)f(one)g(usually)h(lets)h(the)0 4497 y(scheduler)16
+ b(just)h(detect)g(the)g(stack)h(o)o(v)o(er\003o)n(w)d(and)h(terminate)h
+ (the)0 4597 y(thread.)25 b(This)c(is)h(done)d(by)i(using)f(a)h(red)f
+ (zone)g(at)h(the)g(top)f(of)h(the)0 4696 y(stack)i(which)g(is)h(mark)o
+ (ed)e(with)h(a)h(magic)e(v)n(alue)h(the)g(scheduler)0
+ 4796 y(checks)d(between)f(thread)g(dispatching)g(operations.)125
+ 4902 y(Resizing)g(solutions)f(are)h(only)f(possible)h(in)g
+ (semi-portable)0 5001 y(w)o(ays.)39 b(One)25 b(approach)e(is)j(to)f
+ (place)f(the)h(thread)f(stacks)i(into)e(a)0 5101 y(memory)g(mapped)h
+ (area)h(\(see)h Fp(mmap)p Fx(\(2\)\))d(of)i(the)g(process)g(ad-)0
+ 5201 y(dress)31 b(space)f(and)g(let)h(the)g(scheduler)e(catch)i
+ Fp(SIGSEGV)e Fx(sig-)0 5300 y(nals.)70 b(When)34 b(such)h(a)g(signal)g
+ (occurs,)j(because)c(of)h(a)g(stack)0 5400 y(o)o(v)o(er\003o)n(w)i(in)j
+ (this)f(area,)44 b(the)39 b(scheduler)f(e)o(xplicitly)g(resizes)2025
+ 83 y(the)c(memory)e(mapped)h(area.)66 b(This)34 b(resizing)g(can)g(be)g
+ (done)2025 183 y(either)e(by)f(cop)o(ying)f(the)i(stack)h(contents)e
+ (into)h(a)g(ne)n(w)g(lar)o(ger)2025 282 y(area)c(which)g(is)h(then)f
+ (re-mapped)e(to)i(the)h(old)f(address)g(or)g(via)2025
+ 382 y(an)k(e)n(v)o(en)f(more)g(ele)o(gant)f(w)o(ay)-5
+ b(,)34 b(as)f(the)f(v)o(endor)d(threading)h(li-)2025
+ 482 y(braries)e(of)g Fr(Sun)f(Solaris)p Fx(,)j Fr(F)-5
+ b(r)m(eeBSD)28 b Fx(and)g Fr(DEC)h(T)-5 b(ru64)28 b Fx(do)g(it:)2025
+ 581 y(the)j(thread)g(stacks)h(are)f(allocated)g(inside)g(memory)f
+ (mapped)2025 681 y(areas)g(which)f(are)h(already)e(initially)i(a)g(fe)n
+ (w)g(MB)g(in)g(\(virtual\))2025 780 y(size)25 b(and)f(then)g(one)h
+ (just)g(relies)g(on)f(the)g(virtual)g(memory)f(sys-)2025
+ 880 y(tem')-5 b(s)31 b(feature)e(that)h(only)f(the)h(actually)g
+ (consumed)e(memory)2025 980 y(space)20 b(is)h(mapped.)2025
+ 1149 y FA(Startup)26 b(Routine)g(T)-9 b(ermination)2025
+ 1287 y Fx(There)48 b(is)i(a)g(cruel)e Fp(abort)p Fx(\(3\))g(call)h(at)h
+ (the)f(end)g(of)f(our)2025 1387 y Fp(mctx)p 2230 1387
+ V 29 w(create)p 2559 1387 V 29 w(boot)d Fx(function.)97
+ b(This)45 b(means,)50 b(if)c(the)2025 1486 y(startup)18
+ b(routine)g(w)o(ould)g(return,)f(the)i(process)f(is)i(aborted.)j(That)
+ 2025 1586 y(is)29 b(ob)o(viously)e(not)h(reasonable,)h(so)f(why)g(ha)n
+ (v)o(e)g(we)h(written)f(it)2025 1685 y(this)21 b(w)o(ay?)2150
+ 1792 y(If)15 b(the)g(thread)f(returns)h(from)f(the)h(startup)g
+ (routine,)g(it)h(should)2025 1891 y(be)22 b(cleanly)f(terminated.)29
+ b(But)23 b(it)g(cannot)e(terminate)g(itself)i(\(for)2025
+ 1991 y(instance,)g(because)f(it)h(cannot)f(free)g(its)i(o)n(wn)e(stack)
+ h(while)g(run-)2025 2091 y(ning)31 b(on)g(it,)j Fr(etc.)p
+ Fx(\).)59 b(So)31 b(the)h(termination)e(handling)f(actually)2025
+ 2190 y(is)g(the)f(task)g(of)g(the)f(thread)g(library)g(scheduler)-5
+ b(.)47 b(As)29 b(a)f(conse-)2025 2290 y(quence,)21 b(the)h(thread)f
+ (spa)o(wning)g(function)f(of)i(a)h(thread)e(library)2025
+ 2389 y(should)e(be)h(not)g(directly)g Fp(mctx)p 2973
+ 2389 V 29 w(create)p Fx(.)2150 2496 y(Instead)27 b(the)g(thread)g(spa)o
+ (wning)f(function)g(should)h(use)h(an)2025 2595 y(additional)17
+ b(trampoline)g(function)f(as)j(the)g(higher)n(-le)n(v)o(el)d(startup)
+ 2025 2695 y(routine.)23 b(And)18 b(this)h(trampoline)e(function)g
+ (performs)g(a)i(conte)o(xt)2025 2795 y(switch)26 b(back)f(into)h(the)f
+ (thread)g(library)g(scheduler)f(before)h(the)2025 2894
+ y(lo)n(wer)n(-le)n(v)o(el)f(startup)h(routine)f(w)o(ould)g(return.)39
+ b(The)25 b(scheduler)2025 2994 y(then)g(can)h(safely)f(remo)o(v)o(e)f
+ (the)i(thread)e(and)h(its)i(machine)d(con-)2025 3094
+ y(te)o(xt.)35 b(That)24 b(is)g(why)f(the)h Fp(abort)p
+ Fx(\(3\))e(call)i(is)h(ne)n(v)o(er)d(reached)g(in)2025
+ 3193 y(practice)27 b(\(more)f(details)i(can)f(be)h(found)d(in)j(the)f
+ (implementa-)2025 3293 y(tions)22 b(of)f Fp(pth)p 2455
+ 3293 V 29 w(spawn)h Fx(and)f Fp(pth)p 3048 3293 V 29
+ w(exit)g Fx(in)h Fp(pth)p 3535 3293 V 30 w(lib.c)f Fx(of)2025
+ 3392 y Fr(GNU)g(Pth)f Fx([25)o(]\))2025 3562 y FA(The)26
+ b(sigstack\(2\))f(F)n(allback)f(Situation)2025 3700 y
+ Fx(Not)37 b(all)h(platforms)e(pro)o(vide)g(the)h(standardized)e
+ Fp(sigalt-)2025 3799 y(stack)p Fx(\(2\).)d(Instead)22
+ b(the)o(y)g(at)i(least)g(pro)o(vide)c(the)j Fr(4.2BSD)f
+ Fx(an-)2025 3899 y(cestor)i(function)f Fp(sigstack)p
+ Fx(\(2\).)35 b(But)24 b(one)g(cannot)f(tri)n(vially)2025
+ 3999 y(replace)c Fp(sigaltstack)p Fx(\(2\))e(by)i Fp(sigstack)p
+ Fx(\(2\))f(in)i(this)g(sit-)2025 4098 y(uation,)c(because)f(in)i
+ (contrast)e(to)i Fp(sigaltstack)p Fx(\(2\),)d(the)i(old)2025
+ 4198 y Fp(sigstack)p Fx(\(2\))34 b(does)h(not)g(automatically)g(handle)
+ f(the)i(ma-)2025 4297 y(chine)20 b(dependent)e(direction)g(of)i(stack)h
+ (gro)n(wth.)2150 4404 y(Instead,)44 b(the)c(caller)g(has)g(to)g(kno)n
+ (w)f(the)h(direction)f(and)2025 4503 y(al)o(w)o(ays)52
+ b(call)f Fp(sigstack)p Fx(\(2\))e(with)j(the)f(address)g(of)g(the)2025
+ 4603 y(bottom)h(of)g(the)h(stack.)123 b(So,)61 b(in)54
+ b(a)f(real-w)o(orld)e(imple-)2025 4703 y(mentation)38
+ b(one)h(\002rst)h(has)g(to)g(determine)e(the)i(direction)e(of)2025
+ 4802 y(stack)i(gro)n(wth)e(in)i(order)f(to)h(use)g Fp(sigstack)p
+ Fx(\(2\))d(as)k(a)f(re-)2025 4902 y(placement)49 b(for)h
+ Fp(sigaltstack)p Fx(\(2\).)113 b(F)o(ortunately)49 b(this)2025
+ 5001 y(is)55 b(easier)e(than)h(it)g(seems)g(on)f(the)h(\002rst)g(look)f
+ (\(for)g(de-)2025 5101 y(tails)43 b(see)g(the)f(macros)f
+ Fp(AC)p 2886 5101 V 30 w(CHECK)p 3166 5101 V 29 w(STACKGROWTH)f
+ Fx(and)2025 5201 y Fp(AC)p 2130 5201 V 30 w(CHECK)p 2410
+ 5201 V 28 w(STACKSETUP)33 b Fx(in)h(\002le)h Fp(aclocal.m4)e
+ Fx(from)2025 5300 y Fr(GNU)24 b(Pth)f Fx([25)o(]\).)33
+ b(Alternati)n(v)o(ely)21 b(if)j(one)e(can)h(af)n(ford)f(to)h(w)o(aste)
+ 2025 5400 y(memory)-5 b(,)16 b(one)h(can)h(use)g(an)g(ele)o(gant)f
+ (trick:)24 b(to)18 b(set)h(up)e(a)i(stack)f(of)p Black
+ 1929 5700 a(9)p Black eop
+ %%Page: 10 10
+ 10 9 bop Black Black 0 83 a Fx(size)21 b Fe(N)9 b Fx(,)21
+ b(one)f(allocates)g(a)h(chunk)e(of)h(memory)f(\(starting)h(at)h(ad-)0
+ 183 y(dress)c Fe(A)p Fx(\))h(of)f(size)h Fe(N)f Fd(\002)8
+ b Fc(2)17 b Fx(and)f(then)h(calls)h Fp(sigstack)p Fx(\(2\))d(with)0
+ 282 y(the)20 b(parameters)f Fr(sk)p 581 282 25 4 v 30
+ w(addr=)p Fe(A)d Fc(+)h Fe(N)30 b Fx(and)19 b Fr(sk)p
+ 1291 282 V 30 w(size=)p Fe(N)9 b Fx(,)21 b Fr(i.e)o(.)p
+ Fx(,)e(one)0 382 y(speci\002es)29 b(the)g(middle)g(of)f(the)h(memory)e
+ (chunk)h(as)h(the)g(stack)0 482 y(base.)0 651 y FA(The)d(Blind)g(Alley)
+ e(of)h(Brain-Dead)h(Platf)n(orms)0 789 y Fx(The)31 b(w)o(orld)g(w)o
+ (ould)f(not)i(be)f(as)h(funn)o(y)d(as)j(it)g(is,)j(if)d(really)f(all)0
+ 888 y(Unix)f(platforms)e(w)o(ould)i(be)g(f)o(air)g(to)g(us.)55
+ b(Instead,)31 b(currently)0 988 y(at)24 b(least)g(one)e(platform)g(e)o
+ (xists)i(which)f(plays)g(unf)o(air:)30 b(unfortu-)0 1088
+ y(nately)-5 b(,)26 b(ancient)e(v)o(ersions)h(of)g(the)g(popular)f
+ Fr(GNU/Linux)p Fx(.)40 b(Al-)0 1187 y(though)21 b(we)i(will)h(disco)o
+ (v)o(er)d(that)i(it)h(both)e(pro)o(vides)f Fp(sigalt-)0
+ 1287 y(stack)p Fx(\(2\))c(and)i Fp(sigstack)p Fx(\(2\),)d(our)j
+ (approach)d(w)o(on')o(t)i(w)o(ork)0 1387 y(on)27 b Fr(Linux)g
+ Fx(k)o(ernels)g(prior)f(to)i(v)o(ersion)e(2.2)g(and)h
+ Fr(glibc)g Fx(prior)f(to)0 1486 y(v)o(ersion)19 b(2.1.)125
+ 1592 y(Why?)42 b(Because)26 b(its)h Fr(libc)g Fx(pro)o(vides)d(only)h
+ (stubs)i(of)e(these)0 1692 y(functions)h(which)i(al)o(w)o(ays)g(return)
+ f(just)h Fp(-1)g Fx(with)g Fp(errno)g Fx(set)0 1792 y(to)g
+ Fp(ENOSYS)p Fx(.)f(So,)j(this)e(de\002nitely)f(means)g(that)h(our)f
+ (nifty)g(al-)0 1891 y(gorithm)40 b(is)i(useless)h(there,)j(because)40
+ b(its)j(central)e(point)g Fr(is)0 1991 y Fp(sigaltstack)p
+ Fx(\(2\)/)p Fp(sigstack)p Fx(\(2\).)31 b(Ne)n(v)o(ertheless)23
+ b(we)h(do)0 2091 y(not)17 b(need)g(to)h(gi)n(v)o(e)f(up.)23
+ b(At)18 b(least)h(not,)e(if)h(we,)g(for)f(a)h(single)g(brain-)0
+ 2190 y(dead)29 b(platform,)i(accept)f(to)g(break)f(our)g(general)g
+ (goal)g(of)h(not)0 2290 y(using)20 b(an)o(y)f(platform)g(dependent)f
+ (code.)125 2396 y(So,)g(what)h(can)g(we)g(actually)f(do)g(here?)24
+ b(All)19 b(we)g(ha)n(v)o(e)f(to)h(do,)0 2496 y(is)f(to)f(\002ddle)g
+ (around)e(a)j(little)g(bit)f(with)h(the)f(machine-dependent)0
+ 2595 y Fp(jmp)p 155 2595 V 29 w(buf)23 b Fx(ingredients)f(\(by)h
+ (poking)e(around)g(in)i Fp(setjmp.h)0 2695 y Fx(or)16
+ b(by)f(disassembling)g Fp(longjmp)p Fx(\(3\))f(in)j(the)f(deb)n
+ (ugger\).)21 b(Usu-)0 2795 y(ally)e(one)f(just)h(has)g(to)f(do)g(a)h
+ Fp(setjmp)p Fx(\(3\))e(to)i(get)f(an)h(initial)g(state)0
+ 2894 y(in)24 b(the)g Fp(jmp)p 370 2894 V 29 w(buf)g Fx(structure)f(and)
+ h(then)f(manually)f(adjust)i(tw)o(o)0 2994 y(of)34 b(its)h(\002elds:)54
+ b(the)35 b(program)d(counter)g(\(usually)i(a)h(structure)0
+ 3094 y(member)29 b(with)i(\223)p Fp(pc)p Fx(\224)g(in)g(the)f(name\))g
+ (and)g(the)h(stack)g(pointer)0 3193 y(\(usually)19 b(a)i(structure)e
+ (member)g(with)h(\223)p Fp(sp)p Fx(\224)g(in)h(the)f(name\).)125
+ 3299 y(That)f(is)i(all)f(and)f(can)g(be)h(acceptable)e(for)h(a)i
+ (real-w)o(orld)d(im-)0 3399 y(plementation)e(which)g(really)i(w)o(ants)
+ f(to)h(co)o(v)o(er)e(mostly)h Fr(all)h Fx(plat-)0 3499
+ y(forms)f(\226)i(at)f(least)h(as)g(long)e(as)i(the)f(special)h
+ (treatment)e(is)i(needed)0 3598 y(just)31 b(for)f(one)h(or)f(tw)o(o)h
+ (platforms.)56 b(But)31 b(one)f(has)h(to)g(k)o(eep)f(in)0
+ 3698 y(mind)e(that)h(it)h(at)g(least)f(breaks)g(one)f(of)h(the)g
+ (initial)g(goals)g(and)0 3798 y(has)20 b(to)h(be)f(treated)g(as)g(a)h
+ (last)g(chance)e(solution.)0 3967 y FA(Functions)26 b(sigsetjmp\(3\))f
+ (and)g(siglongjmp\(3\))125 4105 y Fx(One)42 b(certainly)f(w)o(ants)i
+ (the)g Fr(POSIX)i Fx(thread)d(semantics)0 4204 y(where)50
+ b(a)h(thread)e(has)i(its)g(o)n(wn)f(signal)g(mask.)115
+ b(As)51 b(al-)0 4304 y(ready)36 b(mentioned,)i(on)e(some)h(platforms)e
+ Fp(setjmp)p Fx(\(3\))g(and)0 4404 y Fp(longjmp)p Fx(\(3\))e(do)h(not)h
+ (pro)o(vide)d(this)j(and)g(instead)f(one)g(has)0 4503
+ y(to)23 b(e)o(xplicitly)f(call)i Fp(sigsetjmp)p Fx(\(3\))d(and)h
+ Fp(siglongjmp)p Fx(\(3\))0 4603 y(instead.)111 b(There)49
+ b(is)h(only)e(one)g(snare:)83 b(on)49 b(some)g(plat-)0
+ 4703 y(forms)36 b Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p
+ Fx(\(3\))31 b(sa)n(v)o(e)36 b(also)h(in-)0 4802 y(formation)g(about)i
+ (the)g(alternate)g(signals)h(stack.)82 b(So)40 b(here)0
+ 4902 y(one)45 b(has)h(to)f(mak)o(e)g(sure)g(that)h(although)e(the)h
+ (thread)f(dis-)0 5001 y(patching)36 b(later)i(uses)g
+ Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p Fx(\(3\),)0
+ 5101 y(the)43 b(thread)f(creation)g(step)h(in)g Fp(mctx)p
+ 1197 5101 V 29 w(create)g Fx(still)h(uses)0 5201 y(plain)h
+ Fp(setjmp)p Fx(\(3\)/)p Fp(longjmp)p Fx(\(3\))d(calls)k(for)f(the)h
+ (trampo-)0 5300 y(line)g(trick.)100 b(One)46 b(just)g(has)g(to)g(be)f
+ (careful)g(because)g(the)0 5400 y Fp(jmp)p 155 5400 V
+ 29 w(buf)20 b Fx(and)e Fp(sigjmp)p 793 5400 V 29 w(buf)i
+ Fx(structures)e(cannot)g(be)i(mix)o(ed)2025 83 y(between)28
+ b(calls)h(to)g(the)g Fp(sigsetjmp)p Fx(\(3\)/)p Fp(siglongjmp)p
+ Fx(\(3\))2025 183 y(and)20 b Fp(setjmp)p Fx(\(3\)/)p
+ Fp(longjmp)p Fx(\(3\).)2025 340 y FA(Mor)n(e)25 b(Machine)h(Context)g
+ (Ingr)n(edients)2025 470 y Fx(Finally)-5 b(,)33 b(for)d(a)h(real-w)o
+ (orld)f(threading)f(implementation)f(one)2025 570 y(usually)j(w)o(ants)
+ h(to)g(put)f(more)g(state)h(into)f(the)h(machine)e(con-)2025
+ 670 y(te)o(xt)43 b(structure)f Fp(mctx)p 2731 670 V 29
+ w(t)p Fx(.)94 b(F)o(or)42 b(instance)h(to)g(ful\002ll)g(more)2025
+ 769 y Fr(POSIX)25 b Fx(threading)20 b(semantics,)i(it)g(is)h
+ (reasonable)d(to)i(also)g(sa)n(v)o(e)2025 869 y(and)37
+ b(restore)g(the)g(global)g Fp(errno)g Fx(v)n(ariable.)76
+ b(All)38 b(this)g(can)2025 968 y(be)32 b(easily)h(achie)n(v)o(ed)e(by)h
+ (e)o(xtending)e(the)j Fp(mctx)p 3503 968 V 29 w(t)g Fx(structure)2025
+ 1068 y(with)d(additional)f(\002elds)h(and)f(by)h(making)e(the)i
+ Fp(mctx)p 3656 1068 V 29 w(save)p Fx(,)2025 1168 y Fp(mctx)p
+ 2230 1168 V 29 w(restore)38 b Fx(and)h Fp(mctx)p 3007
+ 1168 V 29 w(switch)f Fx(functions)g(to)h(be)2025 1267
+ y(a)o(w)o(are)20 b(of)g(them.)2025 1520 y FA(3.6)99 b(Related)26
+ b(W)-7 b(ork)2025 1681 y Fx(Beside)38 b Fr(GNU)h(Pth)e
+ Fx([25)o(],)42 b(there)37 b(are)h(other)f(multithreading)2025
+ 1781 y(libraries)c(which)f(use)i(v)n(ariants)e(of)h(the)g(presented)f
+ (approach)2025 1880 y(for)23 b(implementing)e(machine)h(conte)o(xts)h
+ (in)g(user)n(-space.)34 b(Most)2025 1980 y(notably)40
+ b(there)g(are)j(R)q Fm(O)t(B)t(E)t(RT)k Fx(S)t(.)f(T)t
+ Fm(H)t(AU)r Fx(')-5 b(s)42 b Fr(Really)f(Simple)2025
+ 2079 y(Thr)m(eads)18 b Fx(\()p Fr(r)o(sthr)m(eads)p Fx(,)h([27)o(]\))f
+ (package)f(which)h(uses)h Fp(sigalt-)2025 2179 y(stack)p
+ Fx(\(2\))h(in)i(a)g(v)o(ery)f(similar)h(w)o(ay)f(for)h(thread)e
+ (creation,)h(and)2027 2279 y(K)r Fm(O)q(T)n(A)h Fx(A)t
+ Fm(B)t(E)r Fx(')-5 b(s)19 b Fr(P)-7 b(ortable)17 b(Thr)m(ead)g(Libr)o
+ (ary)g Fx(\()p Fr(PTL)p Fx(,)h([24)o(]\))f(which)2025
+ 2378 y(uses)30 b(a)g Fp(sigstack)p Fx(\(2\))d(approach.)51
+ b(But)30 b(because)f(their)g(ap-)2025 2478 y(proaches)14
+ b(handle)h(the)h(signal)g(handler)e(scope)h(dif)n(ferently)-5
+ b(,)14 b(the)o(y)2025 2578 y(are)30 b(not)g(able)h(to)f(achie)n(v)o(e)f
+ (the)i(same)f(amount)f(of)h(portability)2025 2677 y(and)23
+ b(this)h(w)o(ay)f(do)g(not)g(w)o(ork)g(for)g(instance)g(on)g(some)g
+ (System-)2025 2777 y(V)-8 b(-deri)n(v)o(ed)18 b(platforms.)2025
+ 3030 y FA(3.7)99 b(Summary)26 b(&)f(A)-10 b(v)o(ailability)2025
+ 3190 y Fx(W)j(e)22 b(ha)n(v)o(e)e(presented)f(a)i(pragmatic)f(and)g
+ (mostly)g(portable)g(f)o(all-)2025 3290 y(back)e(approach)e(for)i
+ (implementing)e(the)j(machine)e(conte)o(xt)g(for)2025
+ 3390 y(user)n(-space)30 b(threads,)j(based)e(entirely)f(on)g(Unix)h
+ (system)g(and)2025 3489 y(ANSI-C)24 b(language)d(f)o(acilities.)35
+ b(The)23 b(approach)e(w)o(as)j(success-)2025 3589 y(fully)i(tested)h
+ (in)g(practice)f(on)h(a)g(wide)g(range)e(of)i(Unix)f(\003a)n(v)n(ors)
+ 2025 3689 y(by)17 b Fr(GNU)h(Pth)f Fx(and)g(should)f(also)h(adapt)g(to)
+ g(the)h(remaining)d(Unix)2025 3788 y(platforms)f(as)i(long)f(as)h(the)o
+ (y)f(adhere)f(to)i(the)f(rele)n(v)n(ant)g(standards.)2150
+ 3891 y(The)50 b Fr(GNU)i(Pth)e Fx(package)g(is)h(distrib)n(uted)f
+ (under)g(the)2025 3990 y(GNU)32 b(Library)f(General)g(Public)g(License)
+ h(\(LGPL)f(2.1\))g(and)2025 4090 y(freely)40 b(a)n(v)n(ailable)h(from)e
+ Fr(http://www)-6 b(.gnu.or)m(g/softwar)m(e/pth/)2025
+ 4189 y Fx(and)20 b Fr(ftp://ftp.gnu.or)m(g/gnu/pth/)p
+ Fx(.)2025 4442 y FA(3.8)99 b(Ackno)o(wledgements)2025
+ 4603 y Fx(I)17 b(w)o(ould)f(lik)o(e)h(to)f(thank)i(R)q
+ Fm(O)t(B)t(E)t(RT)k Fx(S)t(.)f(T)t Fm(H)t(AU)r Fx(,)f(D)q
+ 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
+ 4703 y Fm(H)t(O)t(F)r Fx(,)k(M)t Fm(A)t(RT)t(I)t(N)i
+ 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
+ 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
+ 4802 y Fx(H)t Fm(A)t(I)t(B)t(L)t(E)33 b Fx(for)c(their)g(comments)g
+ (which)h(helped)e(to)i(write)h(the)2025 4902 y(initial)d(v)o(ersion)f
+ (of)g(this)h(paper)-5 b(.)48 b(Additionally)-5 b(,)27
+ b(credit)g(has)h(to)2025 5001 y(be)21 b(gi)n(v)o(en)e(to)k(C)t
+ 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
+ Fx(and)d(the)g(USENIX)h(re-)2025 5101 y(vie)n(wers)f(for)g(their)g(in)m
+ (v)n(aluable)e(feedback)h(which)g(allo)n(wed)h(this)2025
+ 5201 y(paper)28 b(to)h(be)f(e)o(xtended,)h(cleaned)f(up)g(and)h
+ (\002nally)f(published)2025 5300 y(at)c(the)f(USENIX)g(Annual)f(T)-6
+ b(echnical)22 b(Conference)g(2000.)32 b(Fi-)2025 5400
+ y(nally)-5 b(,)27 b(thanks)e(go)h(to)h(all)f(users)h(of)f
+ Fr(GNU)h(Pth)f Fx(for)f(their)h(feed-)p Black 1908 5700
+ a(10)p Black eop
+ %%Page: 11 11
+ 11 10 bop Black Black 0 83 a Fx(back)19 b(on)f(the)i(implementation,)c
+ (which)j(helped)f(in)i(\002ne-tuning)0 183 y(the)g(presented)f
+ (approach.)927 b([)p Fb(rse)p Fx(])0 446 y Fs(Refer)n(ences)p
+ Black 71 615 a Fv([1])p Black 41 w Fu(POSIX)18 b(1003.1c)j(Thr)m
+ (eading)p Fv(,)e(IEEE)f(POSIX)f(1003.1c-1995,)199 706
+ y(ISO/IEC)g(9945-1:1996)p Black 71 821 a([2])p Black
+ 43 w(M)t(.)t(E)t(.)46 b(C)t Fa(O)t(N)t(W)m(A)n(Y)r Fv(:)70
+ b Fu(Design)44 b(of)f(a)h(separ)o(able)h(tr)o(ansition-)199
+ 913 y(dia)o(gr)o(am)20 b(compiler)-8 b(.)p Fv(,)19 b(Comm.)f(A)m(CM)h
+ (6:7,)g(1963,)h(p.396-408)p Black 71 1028 a([3])p Black
+ 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
+ Fv(:)f Fu(Co-oper)o(ating)g(sequential)g(pr)m(ocesses)p
+ Fv(,)g(in)199 1119 y(F)-6 b(.)24 b(Genuys)j(\(Ed.\),)e
+ Fu(Pr)m(o)o(gr)o(amming)h(Langua)o(g)o(es)p Fv(,)j(N)m(A)-8
+ b(T)o(O)24 b(Ad-)199 1211 y(v)n(anced)f(Study)f(Institute,)f(Academic)i
+ (Press,)e(London,)i(1965,)199 1302 y(p.42-112.)p Black
+ 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
+ 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)
+ o Fa(A)t(R)t(R)t(E)t(L)r Fv(:)45 b Fu(Pthr)m(eads)199
+ 1509 y(Pr)m(o)o(gr)o(amming)23 b(-)g(A)e(POSIX)h(Standar)m(d)j(for)d
+ (Better)g(Multipr)m(o-)199 1600 y(cessing)p Fv(,)e(O'Reilly)-5
+ b(,)18 b(1996;)h(ISBN)f(1-56592-115-1)p Black 71 1715
+ a([5])p Black 43 w(B)t(.)27 b(L)t Fa(E)t(W)t(I)t(S)t
+ Fv(,)g(D)t(.)f(J)t(.)h(B)t Fa(E)t(R)t(G)r Fv(:)k Fu(Thr)m(eads)25
+ b(Primer)f(-)f(A)h(Guide)g(T)-7 b(o)199 1807 y(Multithr)m(eaded)19
+ b(Pr)m(o)o(gr)o(amming)p Fv(,)f(Prentice)f(Hall,)f(1996;)j(ISBN)199
+ 1898 y(0-13-443698-9)p Black 71 2013 a([6])p Black 43
+ 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
+ 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
+ (-)h(The)199 2105 y(Multithr)m(eaded)g(Pr)m(o)o(gr)o(amming)g(Guide)p
+ Fv(,)f(Prentice)f(Hall,)h(1997;)199 2196 y(ISBN)j(0-13-190067-6)p
+ Black 71 2312 a([7])p Black 43 w(D)t(.)24 b(R)t(.)g(B)s
+ 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
+ (POSIX)g(Thr)m(eads)p Fv(,)199 2403 y(Addison)g(W)-6
+ b(esle)o(y)h(,)19 b(1997;)g(ISBN)f(0-201-63392-2)p Black
+ 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
+ Fv(:)32 b Fu(Multithr)m(eading)26 b(Pr)m(o)o(gr)o(amming)f(T)-7
+ b(ec)o(hniques)p Fv(,)199 2610 y(McGra)o(w-Hill,)18 b(1996;)i(ISBN)e
+ (0-079-12250-7)p Black 71 2725 a([9])p Black 43 w(S)t(.)32
+ 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
+ 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
+ Fv(:)43 b Fu(Pr)m(o)o(gr)o(am-)199 2816 y(ming)29 b(with)e(Thr)m(eads)p
+ Fv(,)k(Prentice)d(Hall,)i(1995;)k(ISBN)27 b(0-131-)199
+ 2908 y(72389-8)p Black 33 3023 a([10])p Black 44 w(C)t(.)t(J)t(.)40
+ 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
+ b(W)l(ith)g(Unix)f(Thr)m(eads)p Fv(,)199 3114 y(John)20
+ b(W)m(ile)o(y)e(&)h(Sons,)g(1996;)h(ISBN)d(0-471-13751-0)p
+ Black 33 3230 a([11])p Black 44 w(P)l(.)29 b(B)r Fa(A)t(RT)s(O)t(N)t
+ Fv(-)t(D)q Fa(A)l(V)t(I)t(S)t Fv(,)g(D)t(.)g(M)t Fa(C)t
+ 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
+ (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
+ Fv(:)19 b Fu(Adding)d(Sc)o(heduler)g(Activations)f(to)f(Mac)o(h)i(3.0)p
+ Fv(,)199 3412 y(Uni)n(v)o(ersity)27 b(of)g(W)-6 b(ashington,)29
+ b(1992;)j(T)-5 b(echnical)27 b(Report)f(92-)199 3504
+ y(08-03)p Black 33 3619 a([12])p Black 44 w(D)t(.)18
+ 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
+ Fv(:)j Fu(Implementing)c(Lightwight)e(Thr)m(eads)p Fv(,)199
+ 3710 y(SunSoft)19 b(Inc.,)f(1992)i(\(published)g(at)f(USENIX'92\).)p
+ Black 33 3826 a([13])p Black 44 w(W)m(.)t(R)t(.)t(S)t
+ 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
+ (amming)g(in)f(the)h(Unix)199 3917 y(En)m(vir)m(onment)p
+ Fv(,)58 b(Addison-W)-6 b(esle)o(y)h(,)58 b(1992;)66 b(ISBN)49
+ b(0-201-)199 4008 y(56317-7)p Black 33 4124 a([14])p
+ Black 44 w(D)t(.)42 b(L)t Fa(E)t(W)t(I)t(N)t(E)r Fv(:)59
+ b Fu(POSIX)38 b(Pr)m(o)o(gr)o(ammer')m(s)h(Guide:)63
+ b(Writing)199 4215 y(P)-6 b(ortable)34 b(Unix)g(Pr)m(o)o(gr)o(ams)p
+ Fv(,)k(O'Reilly)33 b(&)h(Associates,Inc.,)199 4306 y(1994;)20
+ b(ISBN)e(0-937175-73-0)p Black 33 4422 a([15])p Black
+ 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
+ (N)r Fv(:)250 b Fu(F)l(r)m(equently)136 b(ask)o(ed)199
+ 4513 y(questions)187 b(for)e(comp.os.r)m(esear)m(c)o(h)p
+ Fv(,)229 b(1995;)199 4604 y(http://www)-5 b(.serpentine.com/)p
+ Fk(\230)p Fv(bos/os-f)o(aq/,)199 4696 y
+ (ftp://rtfm.mit.edu/pub/usenet/comp.os.research/)p Black
+ 33 4811 a([16])p Black 44 w(S)t Fa(U)t(N)24 b Fv(M)t
+ 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
+ Fa(N)t(C)r Fv(:)27 b Fu(Thr)m(eads)22 b(F)l(r)m(equently)g(Ask)o(ed)199
+ 4902 y(Questions)p Fv(,)111 b(1995,)f(http://www.sun.com/w)o(orkshop/-)
+ 199 4994 y(threads/f)o(aq.html)p Black 2058 83 a([17])p
+ 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
+ (A)t(N)r Fv(:)132 b Fu(F)l(r)m(equently)76 b(ask)o(ed)g(ques-)2224
+ 174 y(tions)134 b(for)g(comp.pr)m(o)o(gr)o(amming)o(.thr)m(eads)p
+ Fv(,)165 b(1997;)2224 266 y(http://www)-5 b(.serpentine.com/)p
+ Fk(\230)p Fv(bos/threads-f)o(aq/.)p Black 2058 410 a([18])p
+ Black 44 w(B)t Fa(I)t(L)83 b Fv(L)t Fa(E)t(W)t(I)t(S)r
+ Fv(:)144 b Fu(F)l(r)m(equently)82 b(ask)o(ed)f(questions)h(for)2224
+ 502 y(comp.pr)m(o)o(gr)o(amming)o(.thr)m(eads)p Fv(,)213
+ b(1999;)250 b(http://-)2224 593 y(www)-5 b(.lambdacs.com/ne)n
+ (wsgroup/F)f(A)l(Q.html)p Black 2058 738 a([19])p Black
+ 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
+ Fv(I)t Fa(N)t(C)r Fv(:)96 b Fu(Multithr)m(eading)58 b(-)e(De\002ni-)
+ 2224 829 y(tions)k(and)h(Guidelines)p Fv(;)81 b(1998;)g(http://www)-5
+ b(.numeric-)2224 920 y(quest.com/lang/multi-frame.html)p
+ Black 2058 1065 a([20])p Black 44 w(T)t Fa(H)t(E)42 b
+ Fv(O)t Fa(P)t(E)t(N)f Fv(G)t Fa(R)r(O)t(U)t(P)r Fv(:)62
+ b Fu(The)39 b(Single)h(Unix)f(Speci\002cation,)2224 1156
+ y(V)-8 b(er)o(sion)46 b(2)g(-)f(Thr)m(eads)p Fv(;)60
+ b(1997;)f(http://www.opengroup-)2224 1248 y(.or)o
+ (g/onlinepubs/007908799/xsh/threads.html)p Black 2058
+ 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)
+ t(Y)t(S)t(T)t(E)t(M)t(S)d Fv(I)t Fa(N)t(C)r Fv(:)61 b
+ Fu(SMI)39 b(Thr)m(ead)g(Resour)m(ces)p Fv(;)2224 1484
+ y(http://www)-5 b(.sun.com/w)o(orkshop/threads)p Black
+ 2058 1629 a([22])p Black 44 w(F)t Fa(R)t(A)t(N)t(K)29
+ b Fv(M)t Fa(U)t(E)t(L)t(L)t(E)t(R)r Fv(:)35 b Fu(FSU)26
+ b(pthr)m(eads)p Fv(;)32 b(1997;)g(http://www-)2224 1720
+ y(.cs.fsu.edu/)p Fk(\230)p Fv(mueller/pthreads/)p Black
+ 2058 1865 a([23])p Black 44 w(C)t Fa(H)t(R)t(I)t(S)85
+ 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
+ b Fu(MIT)82 b(pthr)m(eads)p Fv(;)115 b(1993;)2224 1956
+ y(http://www)-5 b(.mit.edu/people/prov)o(en/pthreads.html)2224
+ 2047 y(\(old\),)209 b(http://www.humanf)o(actor.com/pthreads/mit-)2224
+ 2139 y(pthreads.html)20 b(\(updated\))p Black 2058 2283
+ a([24])p Black 44 w(K)r Fa(O)r(T)n(A)29 b Fv(A)t Fa(B)t(E)r
+ Fv(:)35 b Fu(P)-6 b(ortable)27 b(Thr)m(eading)g(Libr)o(ary)g
+ Fv(\(PTL\);)d(1999;)2224 2375 y(http://www.media.osaka-cu.ac.jp/)p
+ Fk(\230)p Fv(k-abe/PTL/)p Black 2058 2519 a([25])p Black
+ 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)
+ t(A)t(L)t(L)r Fv(:)d Fu(GNU)g(P)-6 b(ortable)17 b(Thr)m(eads)h
+ Fv(\(Pth\);)2224 2611 y(1999;)55 b(http://www.gnu.or)o(g/softw)o
+ (are/pth/,)47 b(ftp://ftp.gnu-)2224 2702 y(.or)o(g/gnu/pth/)p
+ Black 2058 2847 a([26])p Black 44 w(M)t Fa(I)t(C)t(H)t(A)t(E)t(L)36
+ b Fv(T)n(.)i(P)t Fa(E)t(T)t(E)t(R)t(S)t(O)t(N)r Fv(:)50
+ b Fu(POSIX)34 b(and)h(DCE)f(Thr)m(eads)2224 2938 y(F)-8
+ b(or)57 b(Linux)h Fv(\(PCThreads\);)75 b(1995;)j(http://members.aa-)
+ 2224 3029 y(.net/)p Fk(\230)p Fv(mtp/PCthreads.html)p
+ Black 2058 3174 a([27])p Black 44 w(R)q Fa(O)t(B)t(E)t(RT)27
+ b Fv(S)t(.)h(T)t Fa(H)t(A)q(U)r Fv(:)35 b Fu(Really)25
+ b(Simple)g(Thr)m(eads)i Fv(\(rsthreads\);)2224 3265 y(1996;)20
+ b(ftp://ftp.ai.mit.edu/pub/rst/)p Black 2058 3410 a([28])p
+ 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
+ Fv(:)163 b Fu(F)l(r)m(eeBSD)91 b(uthr)m(eads)p Fv(;)129
+ b(1998;)2224 3502 y(ftp://ftp.freebsd.or)o(g/pub/FreeBSD/FreeBSD-)2224
+ 3593 y(current/src/lib/libc)p 2780 3593 23 4 v 27 w(r/uthread/)p
+ Black 2058 3738 a([29])p Black 44 w(X)t Fa(A)l(V)t(I)t(E)t(R)46
+ b Fv(L)t Fa(E)t(R)r(O)q(Y)r Fv(:)70 b Fu(The)44 b(LinuxThr)m(eads)h
+ (libr)o(ary)p Fv(;)57 b(1999;)2224 3829 y(http://pauillac.inria.fr/)p
+ Fk(\230)p Fv(xlero)o(y/linuxthreads/)p Black 2058 3974
+ a([30])p Black 44 w(I)t(B)t(M)r(:)17 b Fu(AIX)h(V)-8
+ b(er)o(sion)18 b(4.3)h(Gener)o(al)g(Pr)m(o)o(gr)o(amming)g(Concepts:)
+ 2224 4065 y(Writing)56 b(and)g(Deb)o(ug)o(ging)h(Pr)m(o)o(gr)o(ams;)74
+ b(Under)o(standing)2224 4156 y(Thr)m(eads)p Fv(;)41 b(1998;)h
+ (http://www.rs6000.ibm.com/doc)p 3714 4156 V 28 w(link/-)2224
+ 4248 y(en)p 2298 4248 V 28 w(US/a)p 2476 4248 V 26 w(doc)p
+ 2609 4248 V 28 w(lib/aixpr)o(ggd/genprogc/understanding-)p
+ 2224 4339 V 2247 4339 a(threads.htm)p Black 2058 4484
+ a([31])p Black 42 w Fu(Netscape)110 b(P)-6 b(ortable)110
+ b(Runtime)f Fv(\(NSPR\);)f(http://-)2224 4575 y(www)-5
+ b(.mozilla.or)o(g/docs/refList/refNSPR/,)246 b(http://-)2224
+ 4666 y(lxr)l(.mozilla.or)o(g/seamonk)o(e)o(y/source/nsprpub/)p
+ Black 2058 4811 a([32])p Black 44 w(R)t Fa(A)t(L)t(F)45
+ 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
+ Fv(:)65 b Fu(Simple)42 b(Mac)o(hine)h(Conte)o(xt)2224
+ 4902 y(Benc)o(hmark)q Fv(;)73 b(2000;)f(http://www)-5
+ b(.gnu.or)o(g/softw)o(are/pth-)2224 4994 y(/smcb)m(.tar)l(.gz)p
+ Black 1908 5700 a Fx(11)p Black eop
+ %%Trailer
+ end
+ userdict /end-hook known{end-hook}if
+ %%EOF

CVSTrac 2.0.1