home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MAILBOX.ZIP / MPTHD.TEX / node5_ct.html < prev    next >
LaTeX Document  |  1988-06-27  |  5.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: node5_ct.html

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
90% dexvert Hypertext Markup Language File (text/html) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file HTML document text default (weak)
99% file LaTeX document text default
98% file exported SGML document text default
97% file exported SGML document, ASCII text, with CRLF, LF line terminators default
80% TrID HyperText Markup Language with DOCTYPE default
19% TrID HyperText Markup Language default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% gt2 HTML (Hyper Text Markup Language) Datei default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime text/html default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3c 21 44 4f 43 54 59 50 | 45 20 48 54 4d 4c 20 50 |<!DOCTYP|E HTML P|
|00000010| 55 42 4c 49 43 20 22 2d | 2f 2f 57 33 43 2f 2f 44 |UBLIC "-|//W3C//D|
|00000020| 54 44 20 48 54 4d 4c 20 | 33 2e 32 20 46 69 6e 61 |TD HTML |3.2 Fina|
|00000030| 6c 2f 2f 65 6e 22 3e 0a | 0a 3c 21 2d 2d 43 6f 6e |l//en">.|.<!--Con|
|00000040| 76 65 72 74 65 64 20 77 | 69 74 68 20 4c 61 54 65 |verted w|ith LaTe|
|00000050| 58 32 48 54 4d 4c 20 32 | 30 32 32 20 28 52 65 6c |X2HTML 2|022 (Rel|
|00000060| 65 61 73 65 64 20 4a 61 | 6e 75 61 72 79 20 31 2c |eased Ja|nuary 1,|
|00000070| 20 32 30 32 32 29 20 2d | 2d 3e 0a 3c 48 54 4d 4c | 2022) -|->.<HTML|
|00000080| 20 6c 61 6e 67 3d 22 65 | 6e 22 3e 0a 3c 48 45 41 | lang="e|n">.<HEA|
|00000090| 44 3e 0a 3c 54 49 54 4c | 45 3e 43 6f 6e 74 65 6e |D>.<TITL|E>Conten|
|000000a0| 74 73 20 6f 66 20 42 75 | 69 6c 64 69 6e 67 20 61 |ts of Bu|ilding a|
|000000b0| 20 43 6f 6e 74 65 78 74 | 20 53 77 69 74 63 68 20 | Context| Switch |
|000000c0| 69 6e 20 60 60 43 27 27 | 3c 2f 54 49 54 4c 45 3e |in ``C''|</TITLE>|
|000000d0| 0a 0a 3c 4d 45 54 41 20 | 48 54 54 50 2d 45 51 55 |..<META |HTTP-EQU|
|000000e0| 49 56 3d 22 43 6f 6e 74 | 65 6e 74 2d 54 79 70 65 |IV="Cont|ent-Type|
|000000f0| 22 20 43 4f 4e 54 45 4e | 54 3d 22 74 65 78 74 2f |" CONTEN|T="text/|
|00000100| 68 74 6d 6c 3b 20 63 68 | 61 72 73 65 74 3d 75 74 |html; ch|arset=ut|
|00000110| 66 2d 38 22 3e 0a 3c 4d | 45 54 41 20 4e 41 4d 45 |f-8">.<M|ETA NAME|
|00000120| 3d 22 76 69 65 77 70 6f | 72 74 22 20 43 4f 4e 54 |="viewpo|rt" CONT|
|00000130| 45 4e 54 3d 22 77 69 64 | 74 68 3d 64 65 76 69 63 |ENT="wid|th=devic|
|00000140| 65 2d 77 69 64 74 68 2c | 20 69 6e 69 74 69 61 6c |e-width,| initial|
|00000150| 2d 73 63 61 6c 65 3d 31 | 2e 30 22 3e 0a 3c 4d 45 |-scale=1|.0">.<ME|
|00000160| 54 41 20 4e 41 4d 45 3d | 22 47 65 6e 65 72 61 74 |TA NAME=|"Generat|
|00000170| 6f 72 22 20 43 4f 4e 54 | 45 4e 54 3d 22 4c 61 54 |or" CONT|ENT="LaT|
|00000180| 65 58 32 48 54 4d 4c 20 | 76 32 30 32 32 22 3e 0a |eX2HTML |v2022">.|
|00000190| 0a 3c 4c 49 4e 4b 20 52 | 45 4c 3d 22 53 54 59 4c |.<LINK R|EL="STYL|
|000001a0| 45 53 48 45 45 54 22 20 | 48 52 45 46 3d 22 4d 50 |ESHEET" |HREF="MP|
|000001b0| 54 48 44 2e 63 73 73 22 | 3e 0a 0a 3c 4c 49 4e 4b |THD.css"|>..<LINK|
|000001c0| 20 52 45 4c 3d 22 6e 65 | 78 74 22 20 48 52 45 46 | REL="ne|xt" HREF|
|000001d0| 3d 22 6e 6f 64 65 31 31 | 5f 6d 6e 2e 68 74 6d 6c |="node11|_mn.html|
|000001e0| 22 3e 0a 3c 4c 49 4e 4b | 20 52 45 4c 3d 22 70 72 |">.<LINK| REL="pr|
|000001f0| 65 76 69 6f 75 73 22 20 | 48 52 45 46 3d 22 6e 6f |evious" |HREF="no|
|00000200| 64 65 32 5f 6d 6e 2e 68 | 74 6d 6c 22 3e 0a 3c 4c |de2_mn.h|tml">.<L|
|00000210| 49 4e 4b 20 52 45 4c 3d | 22 75 70 22 20 48 52 45 |INK REL=|"up" HRE|
|00000220| 46 3d 22 4d 50 54 48 44 | 5f 6d 6e 2e 68 74 6d 6c |F="MPTHD|_mn.html|
|00000230| 22 3e 0a 3c 4c 49 4e 4b | 20 52 45 4c 3d 22 6e 65 |">.<LINK| REL="ne|
|00000240| 78 74 22 20 48 52 45 46 | 3d 22 6e 6f 64 65 36 5f |xt" HREF|="node6_|
|00000250| 6d 6e 2e 68 74 6d 6c 22 | 3e 0a 3c 2f 48 45 41 44 |mn.html"|>.</HEAD|
|00000260| 3e 0a 20 0a 3c 42 4f 44 | 59 20 62 67 63 6f 6c 6f |>. .<BOD|Y bgcolo|
|00000270| 72 3d 22 23 66 66 66 66 | 66 66 22 20 74 65 78 74 |r="#ffff|ff" text|
|00000280| 3d 22 23 30 30 30 30 30 | 30 22 20 6c 69 6e 6b 3d |="#00000|0" link=|
|00000290| 22 23 39 39 34 34 45 45 | 22 20 76 6c 69 6e 6b 3d |"#9944EE|" vlink=|
|000002a0| 22 23 30 30 30 30 66 66 | 22 20 61 6c 69 6e 6b 3d |"#0000ff|" alink=|
|000002b0| 22 23 30 30 66 66 30 30 | 22 3e 0a 0a 3c 48 31 3e |"#00ff00|">..<H1>|
|000002c0| 3c 41 20 49 44 3d 22 53 | 45 43 54 49 4f 4e 30 30 |<A ID="S|ECTION00|
|000002d0| 30 33 30 30 30 30 30 30 | 30 30 30 30 30 30 30 30 |03000000|00000000|
|000002e0| 30 30 22 3e 0a 42 75 69 | 6c 64 69 6e 67 20 61 20 |00">.Bui|lding a |
|000002f0| 43 6f 6e 74 65 78 74 20 | 53 77 69 74 63 68 20 69 |Context |Switch i|
|00000300| 6e 20 60 60 43 27 27 3c | 2f 41 3e 0a 3c 2f 48 31 |n ``C''<|/A>.</H1|
|00000310| 3e 0a 0a 3c 50 3e 0a 49 | 6e 20 69 6d 70 6c 65 6d |>..<P>.I|n implem|
|00000320| 65 6e 74 69 6e 67 20 74 | 68 65 20 63 6f 6e 74 65 |enting t|he conte|
|00000330| 78 74 20 73 77 69 74 63 | 68 20 28 73 65 65 20 63 |xt switc|h (see c|
|00000340| 6f 64 65 20 69 6e 20 6d | 70 2a 2e 68 20 61 6e 64 |ode in m|p*.h and|
|00000350| 20 6d 70 2a 2e 63 20 66 | 69 6c 65 73 29 2c 20 77 | mp*.c f|iles), w|
|00000360| 65 0d 0a 75 73 65 20 74 | 68 65 20 70 6f 77 65 72 |e..use t|he power|
|00000370| 66 75 6c 20 70 72 6f 67 | 72 61 6d 6d 69 6e 67 20 |ful prog|ramming |
|00000380| 6d 65 74 68 6f 64 6f 6c | 6f 67 79 20 6f 66 20 60 |methodol|ogy of `|
|00000390| 60 63 6c 75 73 74 65 72 | 69 6e 67 27 27 20 73 69 |`cluster|ing'' si|
|000003a0| 6d 69 6c 61 72 0d 0a 63 | 6f 64 65 20 61 6e 64 20 |milar..c|ode and |
|000003b0| 64 61 74 61 20 69 6e 74 | 6f 20 6f 6e 65 20 6d 6f |data int|o one mo|
|000003c0| 64 75 6c 61 72 20 75 6e | 69 74 20 77 69 74 68 20 |dular un|it with |
|000003d0| 64 65 66 69 6e 65 64 0d | 0a 69 6e 74 65 72 66 61 |defined.|.interfa|
|000003e0| 63 65 73 2e 3c 41 20 4e | 41 4d 45 3d 22 74 65 78 |ces.<A N|AME="tex|
|000003f0| 32 68 74 6d 6c 33 22 20 | 48 52 45 46 3d 22 66 6f |2html3" |HREF="fo|
|00000400| 6f 74 6e 6f 64 65 5f 6d | 6e 2e 68 74 6d 6c 23 66 |otnode_m|n.html#f|
|00000410| 6f 6f 74 31 33 34 22 20 | 54 41 52 47 45 54 3d 22 |oot134" |TARGET="|
|00000420| 66 6f 6f 74 65 72 22 3e | 3c 53 55 50 3e 32 3c 2f |footer">|<SUP>2</|
|00000430| 53 55 50 3e 3c 2f 41 3e | 20 49 6e 20 74 68 69 73 |SUP></A>| In this|
|00000440| 20 63 61 73 65 2c 20 77 | 65 20 63 72 65 61 74 65 | case, w|e create|
|00000450| 20 61 0d 0a 74 68 72 65 | 61 64 20 63 6c 75 73 74 | a..thre|ad clust|
|00000460| 65 72 20 66 6f 72 20 69 | 6e 69 74 69 61 6c 69 7a |er for i|nitializ|
|00000470| 69 6e 67 2c 20 6d 61 6e | 69 70 75 6c 61 74 69 6e |ing, man|ipulatin|
|00000480| 67 2c 20 61 6e 64 20 64 | 65 69 6e 69 74 69 61 6c |g, and d|einitial|
|00000490| 69 7a 69 6e 67 20 74 68 | 72 65 61 64 73 0d 0a 6f |izing th|reads..o|
|000004a0| 66 20 65 78 65 63 75 74 | 69 6f 6e 2e 20 20 54 68 |f execut|ion. Th|
|000004b0| 65 20 3c 42 3e 69 6e 74 | 65 72 66 61 63 65 3c 2f |e <B>int|erface</|
|000004c0| 42 3e 20 66 6f 72 20 74 | 68 65 20 74 68 72 65 61 |B> for t|he threa|
|000004d0| 64 20 63 6c 75 73 74 65 | 72 20 69 73 20 69 6e 20 |d cluste|r is in |
|000004e0| 74 68 65 20 66 69 6c 65 | 0d 0a 3c 45 4d 3e 6d 70 |the file|..<EM>mp|
|000004f0| 74 68 64 2e 68 3c 2f 45 | 4d 3e 3b 20 79 6f 75 20 |thd.h</E|M>; you |
|00000500| 73 68 6f 75 6c 64 20 69 | 6e 63 6c 75 64 65 20 3c |should i|nclude <|
|00000510| 45 4d 3e 6d 70 74 68 64 | 2e 68 3c 2f 45 4d 3e 20 |EM>mpthd|.h</EM> |
|00000520| 69 6e 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 73 |in your |programs|
|00000530| 20 77 68 65 6e 20 79 6f | 75 0d 0a 77 69 73 68 20 | when yo|u..wish |
|00000540| 74 6f 20 68 61 76 65 20 | 6d 75 6c 74 69 70 6c 65 |to have |multiple|
|00000550| 20 74 68 72 65 61 64 73 | 20 6f 66 20 65 78 65 63 | threads| of exec|
|00000560| 75 74 69 6f 6e 2e 20 20 | 54 68 65 20 3c 42 3e 69 |ution. |The <B>i|
|00000570| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 20 61 6e |mplement|ation an|
|00000580| 64 20 72 65 70 72 65 73 | 65 6e 74 61 74 69 6f 6e |d repres|entation|
|00000590| 3c 2f 42 3e 20 66 6f 72 | 20 74 68 65 20 74 68 72 |</B> for| the thr|
|000005a0| 65 61 64 73 20 69 73 20 | 69 6e 20 74 68 65 20 66 |eads is |in the f|
|000005b0| 69 6c 65 0d 0a 3c 45 4d | 3e 6d 70 74 68 64 2e 63 |ile..<EM|>mpthd.c|
|000005c0| 3c 2f 45 4d 3e 3b 20 79 | 6f 75 72 20 70 72 6f 67 |</EM>; y|our prog|
|000005d0| 72 61 6d 73 20 73 68 6f | 75 6c 64 20 6e 6f 74 20 |rams sho|uld not |
|000005e0| 6b 6e 6f 77 20 61 62 6f | 75 74 20 74 68 69 73 20 |know abo|ut this |
|000005f0| 66 69 6c 65 2c 20 61 6e | 64 20 6e 6f 74 20 6d 61 |file, an|d not ma|
|00000600| 6b 65 0d 0a 61 6e 79 20 | 61 73 73 75 6d 70 74 69 |ke..any |assumpti|
|00000610| 6f 6e 73 20 61 62 6f 75 | 74 20 68 6f 77 20 74 68 |ons abou|t how th|
|00000620| 72 65 61 64 73 20 61 72 | 65 20 77 6f 72 6b 20 62 |reads ar|e work b|
|00000630| 65 79 6f 6e 64 20 74 68 | 65 69 72 20 69 6e 74 65 |eyond th|eir inte|
|00000640| 72 66 61 63 65 2e 20 20 | 54 68 65 73 65 0d 0a 67 |rface. |These..g|
|00000650| 6f 6f 64 20 70 72 6f 67 | 72 61 6d 6d 69 6e 67 20 |ood prog|ramming |
|00000660| 64 69 73 63 69 70 6c 69 | 6e 65 73 20 68 65 6c 70 |discipli|nes help|
|00000670| 20 62 75 69 6c 64 20 63 | 6c 65 61 6e 2c 20 77 65 | build c|lean, we|
|00000680| 6c 6c 2d 64 65 66 69 6e | 65 64 20 69 6e 74 65 72 |ll-defin|ed inter|
|00000690| 66 61 63 65 73 0d 0a 62 | 65 74 77 65 65 6e 20 70 |faces..b|etween p|
|000006a0| 72 6f 67 72 61 6d 20 6d | 6f 64 75 6c 65 73 20 26 |rogram m|odules &|
|000006b0| 6e 64 61 73 68 3b 20 61 | 20 62 69 67 20 68 65 6c |ndash; a| big hel|
|000006c0| 70 20 77 68 65 6e 20 79 | 6f 75 72 20 74 65 73 74 |p when y|our test|
|000006d0| 69 6e 67 2c 20 64 65 62 | 75 67 67 69 6e 67 2c 20 |ing, deb|ugging, |
|000006e0| 6f 72 0d 0a 6d 6f 64 69 | 66 79 69 6e 67 20 79 6f |or..modi|fying yo|
|000006f0| 75 72 20 63 6f 64 65 2e | 0a 0a 3c 50 3e 0a 4d 6f |ur code.|..<P>.Mo|
|00000700| 72 65 20 67 65 6e 65 72 | 61 6c 6c 79 2c 20 6d 6f |re gener|ally, mo|
|00000710| 73 74 20 3c 45 4d 3e 2a | 2e 68 3c 2f 45 4d 3e 20 |st <EM>*|.h</EM> |
|00000720| 66 69 6c 65 73 20 61 72 | 65 20 63 6c 75 73 74 65 |files ar|e cluste|
|00000730| 72 20 69 6e 74 65 72 66 | 61 63 65 73 20 28 65 78 |r interf|aces (ex|
|00000740| 63 65 70 74 0d 0a 74 68 | 65 20 73 65 63 74 69 6f |cept..th|e sectio|
|00000750| 6e 73 20 6d 61 72 6b 65 | 64 20 3c 45 4d 3e 49 4e |ns marke|d <EM>IN|
|00000760| 54 45 52 4e 41 4c 20 55 | 53 45 20 4f 4e 4c 59 3c |TERNAL U|SE ONLY<|
|00000770| 2f 45 4d 3e 29 2c 20 61 | 6e 64 20 74 68 65 69 72 |/EM>), a|nd their|
|00000780| 20 72 65 73 70 65 63 74 | 69 76 65 0d 0a 3c 45 4d | respect|ive..<EM|
|00000790| 3e 2a 2e 63 3c 2f 45 4d | 3e 20 66 69 6c 65 20 28 |>*.c</EM|> file (|
|000007a0| 69 66 20 69 74 20 65 78 | 69 73 74 73 29 20 74 68 |if it ex|ists) th|
|000007b0| 65 20 63 6c 75 73 74 65 | 72 20 69 6d 70 6c 65 6d |e cluste|r implem|
|000007c0| 65 6e 74 61 74 69 6f 6e | 2e 20 20 57 69 74 68 69 |entation|. Withi|
|000007d0| 6e 20 74 68 65 0d 0a 63 | 6c 75 73 74 65 72 73 2c |n the..c|lusters,|
|000007e0| 20 61 6c 6c 20 64 61 74 | 61 74 79 70 65 73 20 61 | all dat|atypes a|
|000007f0| 72 65 20 69 6e 20 75 70 | 70 65 72 20 63 61 73 65 |re in up|per case|
|00000800| 20 28 65 67 2c 20 3c 49 | 3e 4d 50 54 48 44 3c 2f | (eg, <I|>MPTHD</|
|00000810| 49 3e 29 20 61 6e 64 2c | 20 69 66 0d 0a 61 73 73 |I>) and,| if..ass|
|00000820| 6f 63 69 61 74 65 64 20 | 77 69 74 68 20 61 20 63 |ociated |with a c|
|00000830| 6c 75 73 74 65 72 2c 20 | 61 72 65 20 72 65 66 65 |luster, |are refe|
|00000840| 72 65 6e 63 65 64 20 65 | 78 74 65 72 6e 61 6c 6c |renced e|xternall|
|00000850| 79 20 62 79 20 6e 61 6d | 65 20 28 70 6f 69 6e 74 |y by nam|e (point|
|00000860| 65 72 29 0d 0a 61 6e 64 | 20 69 6e 74 65 72 6e 61 |er)..and| interna|
|00000870| 6c 6c 79 20 62 79 20 76 | 61 6c 75 65 20 28 63 6f |lly by v|alue (co|
|00000880| 6e 74 65 6e 74 73 29 3b | 20 6f 6e 20 74 68 65 20 |ntents);| on the |
|00000890| 6f 74 68 65 72 20 68 61 | 6e 64 2c 20 61 6c 6c 20 |other ha|nd, all |
|000008a0| 70 72 6f 63 65 64 75 72 | 65 73 0d 0a 61 72 65 20 |procedur|es..are |
|000008b0| 69 6e 20 6c 6f 77 65 72 | 20 63 61 73 65 2c 20 61 |in lower| case, a|
|000008c0| 6e 64 20 70 72 65 66 69 | 78 65 64 20 77 69 74 68 |nd prefi|xed with|
|000008d0| 20 74 68 65 20 6d 61 6a | 6f 72 20 64 61 74 61 74 | the maj|or datat|
|000008e0| 79 70 65 20 74 68 65 79 | 20 6f 70 65 72 61 74 65 |ype they| operate|
|000008f0| 0d 0a 6f 6e 20 28 65 67 | 2c 20 3c 21 2d 2d 20 4d |..on (eg|, <!-- M|
|00000900| 41 54 48 0a 20 24 6d 70 | 74 68 64 5c 5f 73 77 69 |ATH. $mp|thd\_swi|
|00000910| 74 63 68 24 0a 20 2d 2d | 3e 0a 3c 49 3e 6d 70 74 |tch$. --|>.<I>mpt|
|00000920| 68 64 3c 2f 49 3e 3c 49 | 4d 47 0a 20 53 54 59 4c |hd</I><I|MG. STYL|
|00000930| 45 3d 22 68 65 69 67 68 | 74 3a 20 33 37 2e 36 33 |E="heigh|t: 37.63|
|00000940| 65 78 3b 20 76 65 72 74 | 69 63 61 6c 2d 61 6c 69 |ex; vert|ical-ali|
|00000950| 67 6e 3a 20 31 33 35 2e | 31 30 65 78 3b 20 22 20 |gn: 135.|10ex; " |
|00000960| 53 52 43 3d 22 69 6d 67 | 32 2e 70 6e 67 22 0a 20 |SRC="img|2.png". |
|00000970| 41 4c 54 3d 22 24 5c 5f | 73 77 69 74 63 68 24 22 |ALT="$\_|switch$"|
|00000980| 3e 29 2e 20 20 54 6f 20 | 68 65 6c 70 20 70 72 65 |>). To |help pre|
|00000990| 76 65 6e 74 20 6e 61 6d | 69 6e 67 20 63 6f 6e 66 |vent nam|ing conf|
|000009a0| 6c 69 63 74 73 2c 20 61 | 6c 6c 0d 0a 67 6c 6f 62 |licts, a|ll..glob|
|000009b0| 61 6c 20 6e 61 6d 65 73 | 20 61 72 65 20 70 72 65 |al names| are pre|
|000009c0| 66 69 78 65 64 20 77 69 | 74 68 20 74 68 65 20 69 |fixed wi|th the i|
|000009d0| 6e 69 74 69 61 6c 73 20 | 6f 66 20 74 68 65 69 72 |nitials |of their|
|000009e0| 20 63 72 65 61 74 6f 72 | 2e 20 20 49 6e 20 74 68 | creator|. In th|
|000009f0| 69 73 0d 0a 63 61 73 65 | 2c 20 65 76 65 72 79 20 |is..case|, every |
|00000a00| 6e 61 6d 65 20 62 65 67 | 69 6e 73 20 77 69 74 68 |name beg|ins with|
|00000a10| 20 3c 45 4d 3e 6d 70 3c | 2f 45 4d 3e 20 66 6f 72 | <EM>mp<|/EM> for|
|00000a20| 20 4d 69 6b 65 20 50 61 | 72 6b 65 72 2e 20 20 54 | Mike Pa|rker. T|
|00000a30| 68 65 72 65 20 61 72 65 | 0d 0a 71 75 69 74 65 20 |here are|..quite |
|00000a40| 61 20 6e 75 6d 62 65 72 | 20 6f 66 20 6f 74 68 65 |a number| of othe|
|00000a50| 72 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 64 69 |r progra|mming di|
|00000a60| 73 63 69 70 6c 69 6e 65 | 73 20 61 64 68 65 72 65 |scipline|s adhere|
|00000a70| 64 20 74 6f 20 77 69 74 | 68 69 6e 20 74 68 65 0d |d to wit|hin the.|
|00000a80| 0a 63 6f 64 65 20 6e 6f | 74 20 72 65 6c 65 76 61 |.code no|t releva|
|00000a90| 6e 74 20 74 6f 20 63 6f | 6e 74 65 78 74 20 73 77 |nt to co|ntext sw|
|00000aa0| 69 74 63 68 69 6e 67 20 | 62 75 74 20 77 6f 72 74 |itching |but wort|
|00000ab0| 68 20 6c 6f 6f 6b 69 6e | 67 20 61 74 2e 0a 0a 3c |h lookin|g at...<|
|00000ac0| 50 3e 0a 54 68 6f 75 67 | 68 20 79 6f 75 72 20 70 |P>.Thoug|h your p|
|00000ad0| 72 6f 67 72 61 6d 73 20 | 6d 61 79 20 6e 6f 74 20 |rograms |may not |
|00000ae0| 6b 6e 6f 77 20 68 6f 77 | 20 74 68 72 65 61 64 73 |know how| threads|
|00000af0| 20 61 72 65 20 69 6d 70 | 6c 65 6d 65 6e 74 65 64 | are imp|lemented|
|00000b00| 2c 20 49 20 65 78 70 65 | 63 74 20 61 0d 0a 66 65 |, I expe|ct a..fe|
|00000b10| 77 20 68 75 6d 61 6e 73 | 20 61 72 65 20 63 75 72 |w humans| are cur|
|00000b20| 69 6f 75 73 2e 20 20 53 | 6f 20 69 66 20 79 6f 75 |ious. S|o if you|
|00000b30| 20 68 61 76 65 6e 27 74 | 20 61 6c 72 65 61 64 79 | haven't| already|
|00000b40| 2c 20 74 61 6b 65 20 61 | 20 6d 6f 6d 65 6e 74 20 |, take a| moment |
|00000b50| 6e 6f 77 20 61 6e 64 0d | 0a 72 65 61 64 20 74 68 |now and.|.read th|
|00000b60| 65 20 6f 76 65 72 76 69 | 65 77 20 61 6e 64 20 66 |e overvi|ew and f|
|00000b70| 75 6e 63 74 69 6f 6e 61 | 6c 20 73 70 65 63 69 66 |unctiona|l specif|
|00000b80| 69 63 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 74 |ication |of the t|
|00000b90| 68 72 65 61 64 20 63 6c | 75 73 74 65 72 20 69 6e |hread cl|uster in|
|00000ba0| 0d 0a 3c 45 4d 3e 6d 70 | 74 68 64 2e 68 3c 2f 45 |..<EM>mp|thd.h</E|
|00000bb0| 4d 3e 2c 20 61 6e 64 20 | 62 72 69 65 66 6c 79 20 |M>, and |briefly |
|00000bc0| 73 63 61 6e 20 69 74 73 | 20 69 6d 70 6c 65 6d 65 |scan its| impleme|
|00000bd0| 6e 74 61 74 69 6f 6e 20 | 69 6e 20 3c 45 4d 3e 6d |ntation |in <EM>m|
|00000be0| 70 74 68 64 2e 63 3c 2f | 45 4d 3e 2e 20 20 41 6c |pthd.c</|EM>. Al|
|00000bf0| 73 6f 0d 0a 67 6c 61 6e | 63 65 20 61 74 20 74 68 |so..glan|ce at th|
|00000c00| 65 20 74 77 6f 20 6d 61 | 6a 6f 72 20 63 6c 75 73 |e two ma|jor clus|
|00000c10| 74 65 72 73 20 69 74 20 | 64 65 70 65 6e 64 73 20 |ters it |depends |
|00000c20| 6f 6e 2c 20 3c 45 4d 3e | 6d 70 73 69 67 2e 68 3c |on, <EM>|mpsig.h<|
|00000c30| 2f 45 4d 3e 20 61 6e 64 | 20 3c 45 4d 3e 0d 0a 6d |/EM> and| <EM>..m|
|00000c40| 70 73 65 6d 2e 68 3c 2f | 45 4d 3e 2e 20 20 48 65 |psem.h</|EM>. He|
|00000c50| 72 65 27 73 20 61 20 6d | 61 70 20 74 6f 20 68 65 |re's a m|ap to he|
|00000c60| 6c 70 20 67 75 69 64 65 | 20 79 6f 75 72 20 77 61 |lp guide| your wa|
|00000c70| 79 20 28 73 65 65 20 66 | 69 67 75 72 65 29 2e 0a |y (see f|igure)..|
|00000c80| 0a 3c 50 3e 0a 0a 3c 44 | 49 56 20 63 6c 61 73 73 |.<P>..<D|IV class|
|00000c90| 3d 22 43 45 4e 54 45 52 | 22 3e 3c 41 20 49 44 3d |="CENTER|"><A ID=|
|00000ca0| 22 36 36 22 3e 3c 2f 41 | 3e 0a 3c 54 41 42 4c 45 |"66"></A|>.<TABLE|
|00000cb0| 3e 0a 3c 43 41 50 54 49 | 4f 4e 20 63 6c 61 73 73 |>.<CAPTI|ON class|
|00000cc0| 3d 22 42 4f 54 54 4f 4d | 22 3e 3c 53 54 52 4f 4e |="BOTTOM|"><STRON|
|00000cd0| 47 3e 46 69 67 75 72 65 | 3a 3c 2f 53 54 52 4f 4e |G>Figure|:</STRON|
|00000ce0| 47 3e 0a 4d 6f 64 75 6c | 61 72 20 44 65 70 65 6e |G>.Modul|ar Depen|
|00000cf0| 64 65 6e 63 79 20 44 69 | 61 67 72 61 6d 20 66 72 |dency Di|agram fr|
|00000d00| 6f 6d 20 6d 70 74 68 64 | 20 54 68 72 65 61 64 20 |om mpthd| Thread |
|00000d10| 43 6c 75 73 74 65 72 3c | 2f 43 41 50 54 49 4f 4e |Cluster<|/CAPTION|
|00000d20| 3e 0a 3c 54 52 3e 3c 54 | 44 3e 3c 49 4d 47 0a 20 |>.<TR><T|D><IMG. |
|00000d30| 53 54 59 4c 45 3d 22 68 | 65 69 67 68 74 3a 20 33 |STYLE="h|eight: 3|
|00000d40| 31 34 2e 30 30 65 78 3b | 20 22 20 53 52 43 3d 22 |14.00ex;| " SRC="|
|00000d50| 69 6d 67 33 2e 70 6e 67 | 22 0a 20 41 4c 54 3d 22 |img3.png|". ALT="|
|00000d60| 5c 62 65 67 69 6e 7b 66 | 69 67 75 72 65 7d 0a 5c |\begin{f|igure}.\|
|00000d70| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00000d80| 2f 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/-------|--------|
|00000d90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 5c 0a 5c 76 65 72 74 |--------|-\.\vert|
|00000da0| 20 6d 70 74 68 64 2e 2a | 2e 2e 2e 0a 2e 2e 2e 2d | mpthd.*|.......-|
|00000db0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000dc0| 2d 2d 2d 2d 2d 2d 2d 2f | 20 5c 2d 2d 2d 2d 2d 2d |-------/| \------|
|00000dd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000de0| 2d 2d 2f 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |--/\end{|verbatim|
|00000df0| 7d 0a 5c 65 6e 64 7b 66 | 69 67 75 72 65 7d 22 3e |}.\end{f|igure}">|
|00000e00| 3c 2f 54 44 3e 3c 2f 54 | 52 3e 0a 3c 2f 54 41 42 |</TD></T|R>.</TAB|
|00000e10| 4c 45 3e 0a 3c 2f 44 49 | 56 3e 0a 0a 3c 50 3e 0a |LE>.</DI|V>..<P>.|
|00000e20| 20 2a 20 2a 20 2a 0a 0a | 3c 50 3e 0a 53 69 6e 63 | * * *..|<P>.Sinc|
|00000e30| 65 20 77 65 20 63 61 6e | 20 6f 66 74 65 6e 20 75 |e we can| often u|
|00000e40| 6e 64 65 72 73 74 61 6e | 64 20 77 68 61 74 20 61 |nderstan|d what a|
|00000e50| 20 70 72 6f 67 72 61 6d | 20 64 6f 65 73 20 28 6f | program| does (o|
|00000e60| 72 20 63 61 6e 20 64 6f | 29 20 62 79 20 75 6e 64 |r can do|) by und|
|00000e70| 65 72 73 74 61 6e 64 69 | 6e 67 0d 0a 68 6f 77 20 |erstandi|ng..how |
|00000e80| 69 74 20 72 65 70 72 65 | 73 65 6e 74 73 20 69 74 |it repre|sents it|
|00000e90| 73 20 64 61 74 61 2c 20 | 49 20 77 69 6c 6c 20 63 |s data, |I will c|
|00000ea0| 6f 76 65 72 20 74 68 65 | 20 64 61 74 61 20 73 74 |over the| data st|
|00000eb0| 72 75 63 74 75 72 65 20 | 6f 66 20 74 68 65 20 74 |ructure |of the t|
|00000ec0| 68 72 65 61 64 0d 0a 63 | 6c 75 73 74 65 72 20 66 |hread..c|luster f|
|00000ed0| 69 72 73 74 2e 20 20 48 | 6f 77 65 76 65 72 2c 20 |irst. H|owever, |
|00000ee0| 49 20 77 69 6c 6c 20 61 | 6c 73 6f 20 63 6f 76 65 |I will a|lso cove|
|00000ef0| 72 20 69 74 73 20 63 6f | 64 65 20 73 74 72 75 63 |r its co|de struc|
|00000f00| 74 75 72 65 2c 20 64 65 | 66 69 6e 69 6e 67 0d 0a |ture, de|fining..|
|00000f10| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 73 20 61 76 |the func|tions av|
|00000f20| 61 69 6c 61 62 6c 65 20 | 74 6f 20 61 63 63 65 73 |ailable |to acces|
|00000f30| 73 20 74 68 69 73 20 64 | 61 74 61 20 61 6e 64 20 |s this d|ata and |
|00000f40| 68 6f 77 20 74 68 65 79 | 20 77 6f 72 6b 2e 0a 0a |how they| work...|
|00000f50| 3c 50 3e 0a 3c 42 52 3e | 3c 48 52 3e 0a 3c 21 2d |<P>.<BR>|<HR>.<!-|
|00000f60| 2d 54 61 62 6c 65 20 6f | 66 20 43 68 69 6c 64 2d |-Table o|f Child-|
|00000f70| 4c 69 6e 6b 73 2d 2d 3e | 0a 3c 41 20 49 44 3d 22 |Links-->|.<A ID="|
|00000f80| 43 48 49 4c 44 5f 4c 49 | 4e 4b 53 22 3e 3c 53 54 |CHILD_LI|NKS"><ST|
|00000f90| 52 4f 4e 47 3e 53 75 62 | 73 65 63 74 69 6f 6e 73 |RONG>Sub|sections|
|00000fa0| 3c 2f 53 54 52 4f 4e 47 | 3e 3c 2f 41 3e 0a 0a 3c |</STRONG|></A>..<|
|00000fb0| 55 4c 3e 0a 3c 4c 49 3e | 3c 41 20 4e 41 4d 45 3d |UL>.<LI>|<A NAME=|
|00000fc0| 22 74 65 78 32 68 74 6d | 6c 34 37 22 20 48 52 45 |"tex2htm|l47" HRE|
|00000fd0| 46 3d 22 6e 6f 64 65 36 | 5f 63 74 2e 68 74 6d 6c |F="node6|_ct.html|
|00000fe0| 22 20 54 41 52 47 45 54 | 3d 22 63 6f 6e 74 65 6e |" TARGET|="conten|
|00000ff0| 74 73 22 3e 3c 53 4d 41 | 4c 4c 3e 54 68 65 20 54 |ts"><SMA|LL>The T|
|00001000| 68 72 65 61 64 20 43 6c | 75 73 74 65 72 20 2d 20 |hread Cl|uster - |
|00001010| 44 61 74 61 20 53 74 72 | 75 63 74 75 72 65 3c 2f |Data Str|ucture</|
|00001020| 53 4d 41 4c 4c 3e 3c 2f | 41 3e 0a 3c 4c 49 3e 3c |SMALL></|A>.<LI><|
|00001030| 41 20 4e 41 4d 45 3d 22 | 74 65 78 32 68 74 6d 6c |A NAME="|tex2html|
|00001040| 34 38 22 20 48 52 45 46 | 3d 22 6e 6f 64 65 37 5f |48" HREF|="node7_|
|00001050| 6d 6e 2e 68 74 6d 6c 22 | 20 54 41 52 47 45 54 3d |mn.html"| TARGET=|
|00001060| 22 6d 61 69 6e 22 3e 3c | 53 4d 41 4c 4c 3e 54 68 |"main"><|SMALL>Th|
|00001070| 65 20 54 68 72 65 61 64 | 20 43 6c 75 73 74 65 72 |e Thread| Cluster|
|00001080| 20 2d 20 43 6f 64 65 20 | 53 74 72 75 63 74 75 72 | - Code |Structur|
|00001090| 65 3c 2f 53 4d 41 4c 4c | 3e 3c 2f 41 3e 0a 3c 55 |e</SMALL|></A>.<U|
|000010a0| 4c 3e 0a 3c 4c 49 3e 3c | 41 20 4e 41 4d 45 3d 22 |L>.<LI><|A NAME="|
|000010b0| 74 65 78 32 68 74 6d 6c | 34 39 22 20 48 52 45 46 |tex2html|49" HREF|
|000010c0| 3d 22 6e 6f 64 65 38 5f | 6d 6e 2e 68 74 6d 6c 22 |="node8_|mn.html"|
|000010d0| 20 54 41 52 47 45 54 3d | 22 6d 61 69 6e 22 3e 3c | TARGET=|"main"><|
|000010e0| 53 4d 41 4c 4c 3e 41 63 | 68 69 65 76 69 6e 67 20 |SMALL>Ac|hieving |
|000010f0| 41 74 6f 6d 69 63 69 74 | 79 20 77 69 74 68 20 53 |Atomicit|y with S|
|00001100| 69 67 6e 61 6c 73 20 61 | 6e 64 20 53 65 6d 61 70 |ignals a|nd Semap|
|00001110| 68 6f 72 65 73 3c 2f 53 | 4d 41 4c 4c 3e 3c 2f 41 |hores</S|MALL></A|
|00001120| 3e 0a 3c 4c 49 3e 3c 41 | 20 4e 41 4d 45 3d 22 74 |>.<LI><A| NAME="t|
|00001130| 65 78 32 68 74 6d 6c 35 | 30 22 20 48 52 45 46 3d |ex2html5|0" HREF=|
|00001140| 22 6e 6f 64 65 39 5f 6d | 6e 2e 68 74 6d 6c 22 20 |"node9_m|n.html" |
|00001150| 54 41 52 47 45 54 3d 22 | 6d 61 69 6e 22 3e 3c 53 |TARGET="|main"><S|
|00001160| 4d 41 4c 4c 3e 53 77 69 | 74 63 68 69 6e 67 20 42 |MALL>Swi|tching B|
|00001170| 65 74 77 65 65 6e 20 43 | 6f 6e 74 65 78 74 73 3a |etween C|ontexts:|
|00001180| 20 20 3c 21 2d 2d 20 4d | 41 54 48 0a 20 24 6d 70 | <!-- M|ATH. $mp|
|00001190| 74 68 64 5c 5f 73 77 69 | 74 63 68 24 0a 20 2d 2d |thd\_swi|tch$. --|
|000011a0| 3e 0a 3c 49 3e 6d 70 74 | 68 64 3c 2f 49 3e 3c 49 |>.<I>mpt|hd</I><I|
|000011b0| 4d 47 0a 20 53 54 59 4c | 45 3d 22 68 65 69 67 68 |MG. STYL|E="heigh|
|000011c0| 74 3a 20 33 37 2e 36 33 | 65 78 3b 20 76 65 72 74 |t: 37.63|ex; vert|
|000011d0| 69 63 61 6c 2d 61 6c 69 | 67 6e 3a 20 31 33 35 2e |ical-ali|gn: 135.|
|000011e0| 31 30 65 78 3b 20 22 20 | 53 52 43 3d 22 69 6d 67 |10ex; " |SRC="img|
|000011f0| 32 2e 70 6e 67 22 0a 20 | 41 4c 54 3d 22 24 5c 5f |2.png". |ALT="$\_|
|00001200| 73 77 69 74 63 68 24 22 | 3e 3c 2f 53 4d 41 4c 4c |switch$"|></SMALL|
|00001210| 3e 3c 2f 41 3e 0a 3c 2f | 55 4c 3e 0a 3c 42 52 3e |></A>.</|UL>.<BR>|
|00001220| 0a 3c 4c 49 3e 3c 41 20 | 4e 41 4d 45 3d 22 74 65 |.<LI><A |NAME="te|
|00001230| 78 32 68 74 6d 6c 35 31 | 22 20 48 52 45 46 3d 22 |x2html51|" HREF="|
|00001240| 6e 6f 64 65 31 30 5f 6d | 6e 2e 68 74 6d 6c 22 20 |node10_m|n.html" |
|00001250| 54 41 52 47 45 54 3d 22 | 6d 61 69 6e 22 3e 3c 53 |TARGET="|main"><S|
|00001260| 4d 41 4c 4c 3e 43 72 65 | 61 74 69 6e 67 20 61 6e |MALL>Cre|ating an|
|00001270| 64 20 44 65 73 74 72 6f | 79 69 6e 67 20 43 6f 6e |d Destro|ying Con|
|00001280| 74 65 78 74 73 3a 20 3c | 21 2d 2d 20 4d 41 54 48 |texts: <|!-- MATH|
|00001290| 0a 20 24 6d 70 74 68 64 | 5c 5f 69 6e 69 74 24 0a |. $mpthd|\_init$.|
|000012a0| 20 2d 2d 3e 0a 3c 49 3e | 6d 70 74 68 64 3c 2f 49 | -->.<I>|mpthd</I|
|000012b0| 3e 3c 49 4d 47 0a 20 53 | 54 59 4c 45 3d 22 68 65 |><IMG. S|TYLE="he|
|000012c0| 69 67 68 74 3a 20 31 2e | 36 31 65 78 3b 20 76 65 |ight: 1.|61ex; ve|
|000012d0| 72 74 69 63 61 6c 2d 61 | 6c 69 67 6e 3a 20 31 37 |rtical-a|lign: 17|
|000012e0| 37 2e 36 32 65 78 3b 20 | 22 20 53 52 43 3d 22 69 |7.62ex; |" SRC="i|
|000012f0| 6d 67 35 2e 70 6e 67 22 | 0a 20 41 4c 54 3d 22 24 |mg5.png"|. ALT="$|
|00001300| 5c 5f 69 6e 69 74 24 22 | 3e 20 61 6e 64 20 3c 21 |\_init$"|> and <!|
|00001310| 2d 2d 20 4d 41 54 48 0a | 20 24 6d 70 74 68 64 5c |-- MATH.| $mpthd\|
|00001320| 5f 64 69 6e 69 74 24 0a | 20 2d 2d 3e 0a 3c 49 3e |_dinit$.| -->.<I>|
|00001330| 6d 70 74 68 64 3c 2f 49 | 3e 3c 49 4d 47 0a 20 53 |mpthd</I|><IMG. S|
|00001340| 54 59 4c 45 3d 22 68 65 | 69 67 68 74 3a 20 31 2e |TYLE="he|ight: 1.|
|00001350| 36 31 65 78 3b 20 76 65 | 72 74 69 63 61 6c 2d 61 |61ex; ve|rtical-a|
|00001360| 6c 69 67 6e 3a 20 31 37 | 37 2e 36 32 65 78 3b 20 |lign: 17|7.62ex; |
|00001370| 22 20 53 52 43 3d 22 69 | 6d 67 36 2e 70 6e 67 22 |" SRC="i|mg6.png"|
|00001380| 0a 20 41 4c 54 3d 22 24 | 5c 5f 64 69 6e 69 74 24 |. ALT="$|\_dinit$|
|00001390| 22 3e 3c 2f 53 4d 41 4c | 4c 3e 3c 2f 41 3e 0a 3c |"></SMAL|L></A>.<|
|000013a0| 2f 55 4c 3e 0a 3c 21 2d | 2d 45 6e 64 20 6f 66 20 |/UL>.<!-|-End of |
|000013b0| 54 61 62 6c 65 20 6f 66 | 20 43 68 69 6c 64 2d 4c |Table of| Child-L|
|000013c0| 69 6e 6b 73 2d 2d 3e 0a | 0a 3c 48 52 3e 0a 0a 3c |inks-->.|.<HR>..<|
|000013d0| 2f 42 4f 44 59 3e 0a 3c | 2f 48 54 4d 4c 3e 0a |/BODY>.<|/HTML>. |
+--------+-------------------------+-------------------------+--------+--------+