home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MAILBOX.ZIP / MPTSK.TEX / node13_ct.html < prev    next >
LaTeX Document  |  1988-06-27  |  9.7 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: node13_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, CR, 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 4d 50 | 54 53 4b 3a 20 54 68 65 |ts of MP|TSK: The|
|000000b0| 20 54 61 73 6b 20 4f 72 | 67 61 6e 69 7a 61 74 69 | Task Or|ganizati|
|000000c0| 6f 6e 20 4c 61 79 65 72 | 3c 2f 54 49 54 4c 45 3e |on Layer|</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 53 4b 2e 63 73 73 22 | 3e 0a 0a 3c 4c 49 4e 4b |TSK.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 34 | 5f 6d 6e 2e 68 74 6d 6c |="node14|_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 31 32 5f 6d 6e 2e | 68 74 6d 6c 22 3e 0a 3c |de12_mn.|html">.<|
|00000210| 4c 49 4e 4b 20 52 45 4c | 3d 22 75 70 22 20 48 52 |LINK REL|="up" HR|
|00000220| 45 46 3d 22 6e 6f 64 65 | 39 5f 6d 6e 2e 68 74 6d |EF="node|9_mn.htm|
|00000230| 6c 22 3e 0a 3c 4c 49 4e | 4b 20 52 45 4c 3d 22 6e |l">.<LIN|K REL="n|
|00000240| 65 78 74 22 20 48 52 45 | 46 3d 22 6e 6f 64 65 31 |ext" HRE|F="node1|
|00000250| 34 5f 6d 6e 2e 68 74 6d | 6c 22 3e 0a 3c 2f 48 45 |4_mn.htm|l">.</HE|
|00000260| 41 44 3e 0a 20 0a 3c 42 | 4f 44 59 20 62 67 63 6f |AD>. .<B|ODY bgco|
|00000270| 6c 6f 72 3d 22 23 66 66 | 66 66 66 66 22 20 74 65 |lor="#ff|ffff" te|
|00000280| 78 74 3d 22 23 30 30 30 | 30 30 30 22 20 6c 69 6e |xt="#000|000" lin|
|00000290| 6b 3d 22 23 39 39 34 34 | 45 45 22 20 76 6c 69 6e |k="#9944|EE" vlin|
|000002a0| 6b 3d 22 23 30 30 30 30 | 66 66 22 20 61 6c 69 6e |k="#0000|ff" alin|
|000002b0| 6b 3d 22 23 30 30 66 66 | 30 30 22 3e 0a 0a 3c 48 |k="#00ff|00">..<H|
|000002c0| 32 3e 3c 41 20 49 44 3d | 22 53 45 43 54 49 4f 4e |2><A ID=|"SECTION|
|000002d0| 30 30 30 34 34 30 30 30 | 30 30 30 30 30 30 30 30 |00044000|00000000|
|000002e0| 30 30 30 30 22 3e 0a 4d | 50 54 53 4b 3a 20 20 54 |0000">.M|PTSK: T|
|000002f0| 68 65 20 54 61 73 6b 20 | 4f 72 67 61 6e 69 7a 61 |he Task |Organiza|
|00000300| 74 69 6f 6e 20 4c 61 79 | 65 72 3c 2f 41 3e 0a 3c |tion Lay|er</A>.<|
|00000310| 2f 48 32 3e 0a 0a 3c 50 | 3e 0a 49 74 20 69 73 20 |/H2>..<P|>.It is |
|00000320| 6e 69 63 65 20 74 6f 20 | 62 65 20 61 62 6c 65 20 |nice to |be able |
|00000330| 74 6f 20 73 77 69 74 63 | 68 20 63 6f 6e 74 65 78 |to switc|h contex|
|00000340| 74 73 20 77 68 65 6e 65 | 76 65 72 20 77 65 20 63 |ts whene|ver we c|
|00000350| 68 6f 6f 73 65 2c 20 62 | 75 74 20 77 65 0d 0a 6d |hoose, b|ut we..m|
|00000360| 61 79 20 64 65 73 69 72 | 65 20 6d 6f 72 65 2e 20 |ay desir|e more. |
|00000370| 20 53 75 70 70 6f 73 65 | 2c 20 66 6f 72 20 69 6e | Suppose|, for in|
|00000380| 73 74 61 6e 63 65 2c 20 | 77 65 20 67 65 74 20 74 |stance, |we get t|
|00000390| 6f 20 61 20 70 6f 69 6e | 74 20 69 6e 20 6f 75 72 |o a poin|t in our|
|000003a0| 0d 0a 70 72 6f 67 72 61 | 6d 20 77 68 65 72 65 20 |..progra|m where |
|000003b0| 77 65 20 6d 75 73 74 20 | 77 61 69 74 20 66 6f 72 |we must |wait for|
|000003c0| 2c 20 73 61 79 2c 20 6b | 65 79 62 6f 61 72 64 20 |, say, k|eyboard |
|000003d0| 69 6e 70 75 74 2e 20 20 | 57 68 69 63 68 20 74 68 |input. |Which th|
|000003e0| 72 65 61 64 20 64 6f 0d | 0a 77 65 20 73 77 69 74 |read do.|.we swit|
|000003f0| 63 68 20 74 6f 3f 20 20 | 4f 72 20 73 75 70 70 6f |ch to? |Or suppo|
|00000400| 73 65 20 77 65 20 77 61 | 6e 74 20 74 6f 20 73 65 |se we wa|nt to se|
|00000410| 6e 64 20 61 20 6d 65 73 | 73 61 67 65 20 74 6f 20 |nd a mes|sage to |
|00000420| 61 6e 6f 74 68 65 72 0d | 0a 74 68 72 65 61 64 2c |another.|.thread,|
|00000430| 20 73 61 79 2c 20 74 65 | 6c 6c 69 6e 67 20 74 68 | say, te|lling th|
|00000440| 65 20 74 68 72 65 61 64 | 20 69 74 27 73 20 70 72 |e thread| it's pr|
|00000450| 69 6e 74 6f 75 74 20 68 | 61 73 20 66 69 6e 69 73 |intout h|as finis|
|00000460| 68 65 64 3f 20 20 48 6f | 77 20 64 6f 0d 0a 77 65 |hed? Ho|w do..we|
|00000470| 20 70 61 73 73 20 74 68 | 65 20 74 68 72 65 61 64 | pass th|e thread|
|00000480| 20 74 68 65 20 6d 65 73 | 73 61 67 65 3f 20 20 57 | the mes|sage? W|
|00000490| 68 61 74 20 69 66 20 74 | 68 65 20 74 68 72 65 61 |hat if t|he threa|
|000004a0| 64 20 69 73 20 62 75 73 | 79 3f 0a 0a 3c 50 3e 0a |d is bus|y?..<P>.|
|000004b0| 54 68 65 20 4d 50 54 53 | 4b 20 63 6c 75 73 74 65 |The MPTS|K cluste|
|000004c0| 72 20 61 6e 73 77 65 72 | 73 20 74 68 65 73 65 20 |r answer|s these |
|000004d0| 71 75 65 73 74 69 6f 6e | 73 20 62 79 20 70 72 6f |question|s by pro|
|000004e0| 76 69 64 69 6e 67 20 61 | 0d 0a 67 65 6e 65 72 61 |viding a|..genera|
|000004f0| 6c 2d 70 75 72 70 6f 73 | 65 2c 20 69 6e 74 65 67 |l-purpos|e, integ|
|00000500| 72 61 74 65 64 20 73 63 | 68 65 64 75 6c 65 72 20 |rated sc|heduler |
|00000510| 61 6e 64 20 6d 65 73 73 | 61 67 65 20 70 61 73 73 |and mess|age pass|
|00000520| 69 6e 67 20 73 79 73 74 | 65 6d 0d 0a 62 61 73 65 |ing syst|em..base|
|00000530| 64 20 6f 6e 20 6d 61 69 | 6c 62 6f 78 65 73 20 28 |d on mai|lboxes (|
|00000540| 66 72 6f 6d 20 77 68 69 | 63 68 20 74 68 65 20 70 |from whi|ch the p|
|00000550| 61 63 6b 61 67 65 20 67 | 65 74 73 20 69 74 73 20 |ackage g|ets its |
|00000560| 6e 61 6d 65 29 2e 0d 0a | 45 73 73 65 6e 74 69 61 |name)...|Essentia|
|00000570| 6c 6c 79 2c 20 4d 50 54 | 53 4b 20 6f 72 67 61 6e |lly, MPT|SK organ|
|00000580| 69 7a 65 73 20 74 68 72 | 65 61 64 73 20 69 6e 74 |izes thr|eads int|
|00000590| 6f 20 61 20 70 6f 77 65 | 72 66 75 6c 20 28 6d 75 |o a powe|rful (mu|
|000005a0| 6c 74 69 29 74 61 73 6b | 0d 0a 66 6f 72 63 65 21 |lti)task|..force!|
|000005b0| 0a 0a 3c 50 3e 0a 54 68 | 65 20 4d 50 54 53 4b 20 |..<P>.Th|e MPTSK |
|000005c0| 63 6c 75 73 74 65 72 20 | 69 6e 74 72 6f 64 75 63 |cluster |introduc|
|000005d0| 65 73 20 74 68 72 65 65 | 20 6e 65 77 20 64 61 74 |es three| new dat|
|000005e0| 61 74 79 70 65 73 3a 20 | 74 61 73 6b 73 20 28 4d |atypes: |tasks (M|
|000005f0| 50 54 53 4b 29 2c 0d 0a | 6d 65 73 73 61 67 65 73 |PTSK),..|messages|
|00000600| 20 28 4d 50 4d 53 47 29 | 2c 20 61 6e 64 20 6d 61 | (MPMSG)|, and ma|
|00000610| 69 6c 62 6f 78 65 73 20 | 20 28 4d 50 42 4f 58 29 |ilboxes | (MPBOX)|
|00000620| 2e 0a 0a 3c 50 3e 0a 54 | 61 73 6b 73 20 65 73 73 |...<P>.T|asks ess|
|00000630| 65 6e 74 69 61 6c 6c 79 | 20 65 6e 68 61 6e 63 65 |entially| enhance|
|00000640| 64 20 74 68 72 65 61 64 | 73 2e 20 20 54 68 65 79 |d thread|s. They|
|00000650| 20 61 72 65 20 61 75 74 | 6f 6d 61 74 69 63 61 6c | are aut|omatical|
|00000660| 6c 79 20 73 63 68 65 64 | 75 6c 65 64 0d 0a 61 6e |ly sched|uled..an|
|00000670| 64 20 6e 65 65 64 20 6e | 6f 74 20 62 65 20 65 78 |d need n|ot be ex|
|00000680| 70 6c 69 63 69 74 6c 79 | 20 73 77 69 74 63 68 65 |plicitly| switche|
|00000690| 64 20 62 65 74 77 65 65 | 6e 2e 20 20 54 68 65 79 |d betwee|n. They|
|000006a0| 20 63 61 6e 20 61 6c 73 | 6f 20 73 65 6e 64 20 61 | can als|o send a|
|000006b0| 6e 64 0d 0a 72 65 63 65 | 69 76 65 20 6d 65 73 73 |nd..rece|ive mess|
|000006c0| 61 67 65 73 2e 2e 2e 0a | 0a 3c 50 3e 0a 4d 65 73 |ages....|.<P>.Mes|
|000006d0| 73 61 67 65 73 20 63 61 | 6e 20 62 65 20 61 6e 79 |sages ca|n be any|
|000006e0| 20 72 65 63 6f 72 64 74 | 79 70 65 20 66 6f 72 20 | recordt|ype for |
|000006f0| 6d 61 78 69 6d 75 6d 20 | 66 6c 65 78 69 62 69 6c |maximum |flexibil|
|00000700| 69 74 79 2e 20 20 54 68 | 65 0d 0a 73 74 72 75 63 |ity. Th|e..struc|
|00000710| 74 75 72 65 20 6e 65 65 | 64 20 6f 6e 6c 79 20 62 |ture nee|d only b|
|00000720| 65 67 69 6e 20 77 69 74 | 68 20 61 6e 20 4d 50 4d |egin wit|h an MPM|
|00000730| 53 47 20 66 69 65 6c 64 | 20 28 66 6f 72 20 69 6e |SG field| (for in|
|00000740| 74 65 72 6e 61 6c 20 6d | 65 73 73 61 67 65 0d 0a |ternal m|essage..|
|00000750| 6d 61 6e 61 67 65 6d 65 | 6e 74 20 70 75 72 70 6f |manageme|nt purpo|
|00000760| 73 65 73 29 2e 20 20 49 | 6e 64 65 65 64 2c 20 65 |ses). I|ndeed, e|
|00000770| 76 65 6e 20 74 61 73 6b | 73 20 61 6e 64 20 6d 61 |ven task|s and ma|
|00000780| 69 6c 62 6f 78 65 73 20 | 61 72 65 20 74 72 65 61 |ilboxes |are trea|
|00000790| 74 65 64 0d 0a 61 73 20 | 6d 65 73 73 61 67 65 73 |ted..as |messages|
|000007a0| 2e 2e 2e 0a 0a 3c 50 3e | 0a 4d 61 69 6c 62 6f 78 |.....<P>|.Mailbox|
|000007b0| 65 73 20 61 72 65 20 74 | 68 65 20 74 68 69 6e 67 |es are t|he thing|
|000007c0| 20 77 68 69 63 68 20 74 | 69 65 73 20 74 61 73 6b | which t|ies task|
|000007d0| 73 20 61 6e 64 20 6d 65 | 73 73 61 67 65 73 20 74 |s and me|ssages t|
|000007e0| 6f 67 65 74 68 65 72 2c | 20 61 6e 64 0d 0a 6d 61 |ogether,| and..ma|
|000007f0| 6b 65 73 20 4d 61 69 6c | 62 6f 78 20 4d 75 6c 74 |kes Mail|box Mult|
|00000800| 69 74 61 73 6b 69 6e 67 | 20 77 6f 72 6b 2e 20 20 |itasking| work. |
|00000810| 41 20 68 79 62 72 69 64 | 20 6f 66 20 74 68 65 20 |A hybrid| of the |
|00000820| 71 75 65 75 65 20 64 61 | 74 61 0d 0a 73 74 72 75 |queue da|ta..stru|
|00000830| 63 74 75 72 65 2c 20 61 | 20 6d 61 69 6c 62 6f 78 |cture, a| mailbox|
|00000840| 20 3c 45 4d 3e 65 69 74 | 68 65 72 3c 2f 45 4d 3e | <EM>eit|her</EM>|
|00000850| 20 63 6f 6e 74 61 69 6e | 73 20 61 20 6c 69 73 74 | contain|s a list|
|00000860| 20 6f 66 20 6d 65 73 73 | 61 67 65 73 20 3c 45 4d | of mess|ages <EM|
|00000870| 3e 0d 0a 6f 72 3c 2f 45 | 4d 3e 20 61 20 6c 69 73 |>..or</E|M> a lis|
|00000880| 74 20 6f 66 20 74 61 73 | 6b 73 20 28 77 61 69 74 |t of tas|ks (wait|
|00000890| 69 6e 67 20 66 6f 72 20 | 6d 65 73 73 61 67 65 73 |ing for |messages|
|000008a0| 29 2e 20 20 28 53 65 65 | 20 66 69 67 75 72 65 29 |). (See| figure)|
|000008b0| 0a 0a 3c 50 3e 0a 0a 3c | 44 49 56 20 63 6c 61 73 |..<P>..<|DIV clas|
|000008c0| 73 3d 22 43 45 4e 54 45 | 52 22 3e 3c 41 20 49 44 |s="CENTE|R"><A ID|
|000008d0| 3d 22 31 32 30 22 3e 3c | 2f 41 3e 0a 3c 54 41 42 |="120"><|/A>.<TAB|
|000008e0| 4c 45 3e 0a 3c 43 41 50 | 54 49 4f 4e 20 63 6c 61 |LE>.<CAP|TION cla|
|000008f0| 73 73 3d 22 42 4f 54 54 | 4f 4d 22 3e 3c 53 54 52 |ss="BOTT|OM"><STR|
|00000900| 4f 4e 47 3e 46 69 67 75 | 72 65 3a 3c 2f 53 54 52 |ONG>Figu|re:</STR|
|00000910| 4f 4e 47 3e 0a 4d 50 54 | 53 4b 3a 20 20 4d 61 69 |ONG>.MPT|SK: Mai|
|00000920| 6c 62 6f 78 20 60 60 4d | 65 73 73 61 67 65 20 42 |lbox ``M|essage B|
|00000930| 61 6e 6b 27 27 20 49 6c | 6c 75 73 74 72 61 74 69 |ank'' Il|lustrati|
|00000940| 6f 6e 3c 2f 43 41 50 54 | 49 4f 4e 3e 0a 3c 54 52 |on</CAPT|ION>.<TR|
|00000950| 3e 3c 54 44 3e 3c 49 4d | 47 0a 20 53 54 59 4c 45 |><TD><IM|G. STYLE|
|00000960| 3d 22 68 65 69 67 68 74 | 3a 20 33 31 34 2e 30 30 |="height|: 314.00|
|00000970| 65 78 3b 20 22 20 53 52 | 43 3d 22 69 6d 67 37 2e |ex; " SR|C="img7.|
|00000980| 70 6e 67 22 0a 20 41 4c | 54 3d 22 5c 62 65 67 69 |png". AL|T="\begi|
|00000990| 6e 7b 66 69 67 75 72 65 | 7d 0a 5c 62 65 67 69 6e |n{figure|}.\begin|
|000009a0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 4d 65 73 73 61 |{verbati|m}.Messa|
|000009b0| 67 65 73 20 4d 61 69 6c | 62 6f 78 20 54 61 73 6b |ges Mail|box Task|
|000009c0| 73 0a 2d 2d 2d 2d 2d 2d | 2d 2d 20 2d 2d 2d 2d 2d |s.------|-- -----|
|000009d0| 2d 2e 2e 2e 0a 2e 2e 2e | 61 20 74 61 73 6b 20 72 |-.......|a task r|
|000009e0| 65 63 65 69 76 65 73 20 | 69 74 2e 20 41 20 74 61 |eceives |it. A ta|
|000009f0| 73 6b 20 69 73 20 71 75 | 65 75 65 64 20 75 6e 74 |sk is qu|eued unt|
|00000a00| 69 6c 20 61 20 6d 65 73 | 73 61 67 65 20 72 65 61 |il a mes|sage rea|
|00000a10| 63 68 65 73 0a 69 74 2e | 7d 0a 5c 65 6e 64 7b 66 |ches.it.|}.\end{f|
|00000a20| 69 67 75 72 65 7d 22 3e | 3c 2f 54 44 3e 3c 2f 54 |igure}">|</TD></T|
|00000a30| 52 3e 0a 3c 2f 54 41 42 | 4c 45 3e 0a 3c 2f 44 49 |R>.</TAB|LE>.</DI|
|00000a40| 56 3e 0a 0a 3c 50 3e 0a | 54 61 73 6b 73 20 6d 61 |V>..<P>.|Tasks ma|
|00000a50| 79 20 65 69 74 68 65 72 | 20 73 65 6e 64 20 6f 72 |y either| send or|
|00000a60| 20 72 65 63 65 69 76 65 | 20 6d 65 73 73 61 67 65 | receive| message|
|00000a70| 73 20 6f 6e 20 61 20 6d | 61 69 6c 62 6f 78 2e 20 |s on a m|ailbox. |
|00000a80| 20 49 66 20 61 20 74 61 | 73 6b 0d 0a 73 65 6e 64 | If a ta|sk..send|
|00000a90| 73 20 61 20 6d 65 73 73 | 61 67 65 20 61 6e 64 20 |s a mess|age and |
|00000aa0| 74 68 65 72 65 20 61 72 | 65 20 6e 6f 20 74 61 73 |there ar|e no tas|
|00000ab0| 6b 73 20 77 61 69 74 69 | 6e 67 20 66 6f 72 20 69 |ks waiti|ng for i|
|00000ac0| 74 2c 20 74 68 65 6e 20 | 74 68 65 20 74 61 73 6b |t, then |the task|
|00000ad0| 73 0d 0a 61 64 64 73 20 | 74 68 65 20 6d 65 73 73 |s..adds |the mess|
|00000ae0| 61 67 65 20 74 6f 20 74 | 68 65 20 65 6e 64 20 6f |age to t|he end o|
|00000af0| 66 20 77 61 69 74 69 6e | 67 20 6d 65 73 73 61 67 |f waitin|g messag|
|00000b00| 65 73 3b 20 69 66 20 74 | 68 65 72 65 20 61 72 65 |es; if t|here are|
|00000b10| 20 74 61 73 6b 73 0d 0a | 77 61 69 74 69 6e 67 2c | tasks..|waiting,|
|00000b20| 20 74 68 65 6e 20 74 68 | 65 20 74 61 73 6b 20 67 | then th|e task g|
|00000b30| 69 76 65 73 20 74 68 65 | 20 6d 65 73 73 61 67 65 |ives the| message|
|00000b40| 20 74 6f 20 74 68 65 20 | 66 69 72 73 74 20 74 61 | to the |first ta|
|00000b50| 73 6b 20 69 6e 20 6c 69 | 6e 65 2e 0d 0a 4f 6e 20 |sk in li|ne...On |
|00000b60| 74 68 65 20 6f 74 68 65 | 72 20 68 61 6e 64 2c 20 |the othe|r hand, |
|00000b70| 69 66 20 61 20 74 61 73 | 6b 20 61 74 74 65 6d 70 |if a tas|k attemp|
|00000b80| 74 73 20 74 6f 20 72 65 | 63 65 69 76 65 20 61 20 |ts to re|ceive a |
|00000b90| 6d 65 73 73 61 67 65 20 | 66 72 6f 6d 20 61 0d 0a |message |from a..|
|00000ba0| 6d 61 69 6c 62 6f 78 2c | 20 61 6e 64 20 74 68 65 |mailbox,| and the|
|00000bb0| 72 65 20 61 72 65 20 6e | 6f 20 6d 65 73 73 61 67 |re are n|o messag|
|00000bc0| 65 73 20 77 61 69 74 69 | 6e 67 2c 20 74 68 65 6e |es waiti|ng, then|
|00000bd0| 20 74 68 65 20 74 61 73 | 6b 20 61 64 64 73 20 69 | the tas|k adds i|
|00000be0| 74 73 65 6c 66 0d 0a 74 | 6f 20 74 68 65 20 65 6e |tself..t|o the en|
|00000bf0| 64 20 6f 66 20 77 61 69 | 74 69 6e 67 20 74 61 73 |d of wai|ting tas|
|00000c00| 6b 73 3b 20 20 69 66 20 | 74 68 65 72 65 20 61 72 |ks; if |there ar|
|00000c10| 65 20 6d 65 73 73 61 67 | 65 73 20 77 61 69 74 69 |e messag|es waiti|
|00000c20| 6e 67 2c 20 74 68 65 6e | 0d 0a 74 68 65 20 74 61 |ng, then|..the ta|
|00000c30| 73 6b 20 74 61 6b 65 73 | 20 74 68 65 20 6d 65 73 |sk takes| the mes|
|00000c40| 73 61 67 65 20 61 6e 64 | 20 70 72 6f 63 65 65 64 |sage and| proceed|
|00000c50| 73 2e 0a 0a 3c 50 3e 0a | 54 68 69 6e 6b 20 6f 66 |s...<P>.|Think of|
|00000c60| 20 61 20 6d 61 69 6c 62 | 6f 78 20 6c 69 6b 65 20 | a mailb|ox like |
|00000c70| 61 20 62 61 6e 6b 20 61 | 63 63 6f 75 6e 74 20 61 |a bank a|ccount a|
|00000c80| 6e 64 20 6d 65 73 73 61 | 67 65 73 20 6c 69 6b 65 |nd messa|ges like|
|00000c90| 20 6d 6f 6e 65 79 2e 20 | 20 4c 69 6b 65 0d 0a 61 | money. | Like..a|
|00000ca0| 20 62 61 6e 6b 20 61 63 | 63 6f 75 6e 74 2c 20 61 | bank ac|count, a|
|00000cb0| 20 6d 61 69 6c 62 6f 78 | 20 68 61 73 20 65 69 74 | mailbox| has eit|
|00000cc0| 68 65 72 20 61 20 63 72 | 65 64 69 74 20 6f 72 20 |her a cr|edit or |
|00000cd0| 64 65 66 69 63 69 74 20 | 6f 66 0d 0a 6d 65 73 73 |deficit |of..mess|
|00000ce0| 61 67 65 73 2e 20 20 41 | 6e 64 20 6c 69 6b 65 20 |ages. A|nd like |
|00000cf0| 61 20 62 61 6e 6b 20 61 | 63 63 6f 75 6e 74 2c 20 |a bank a|ccount, |
|00000d00| 6d 65 73 73 61 67 65 73 | 20 63 61 6e 20 62 65 20 |messages| can be |
|00000d10| 64 65 70 6f 73 69 74 65 | 64 20 6f 72 0d 0a 77 69 |deposite|d or..wi|
|00000d20| 74 68 64 72 61 77 6e 2e | 20 20 54 68 69 73 20 69 |thdrawn.| This i|
|00000d30| 73 20 61 20 6d 61 69 6c | 62 6f 78 2e 0a 0a 3c 50 |s a mail|box...<P|
|00000d40| 3e 0a 4f 66 20 63 6f 75 | 72 73 65 2c 20 77 68 65 |>.Of cou|rse, whe|
|00000d50| 6e 20 70 65 6f 70 6c 65 | 20 28 74 61 73 6b 73 29 |n people| (tasks)|
|00000d60| 20 63 6f 6d 65 20 74 6f | 20 74 68 65 20 62 61 6e | come to| the ban|
|00000d70| 6b 2c 20 74 68 65 79 20 | 6d 75 73 74 20 77 61 69 |k, they |must wai|
|00000d80| 74 20 69 6e 0d 0a 6c 69 | 6e 65 2e 20 20 4c 69 6b |t in..li|ne. Lik|
|00000d90| 65 77 69 73 65 20 61 20 | 6d 61 69 6c 62 6f 78 20 |ewise a |mailbox |
|00000da0| 73 65 72 76 69 63 65 73 | 20 69 74 73 20 74 61 73 |services| its tas|
|00000db0| 6b 73 20 61 6e 64 20 6d | 65 73 73 61 67 65 73 20 |ks and m|essages |
|00000dc0| 69 6e 20 61 0d 0a 66 69 | 72 73 74 2d 63 6f 6d 65 |in a..fi|rst-come|
|00000dd0| 2c 20 66 69 72 73 74 2d | 73 65 72 76 65 20 6f 72 |, first-|serve or|
|00000de0| 64 65 72 2e 20 20 54 68 | 69 73 20 69 73 20 61 20 |der. Th|is is a |
|00000df0| 6d 61 69 6c 62 6f 78 2e | 0a 0a 3c 50 3e 0a 54 68 |mailbox.|..<P>.Th|
|00000e00| 6f 75 67 68 20 61 20 73 | 69 6d 70 6c 65 20 63 6f |ough a s|imple co|
|00000e10| 6e 63 65 70 74 2c 20 74 | 68 65 20 4d 50 42 4f 58 |ncept, t|he MPBOX|
|00000e20| 27 73 20 6d 61 69 6c 62 | 6f 78 20 74 75 72 6e 73 |'s mailb|ox turns|
|00000e30| 20 6f 75 74 20 74 6f 20 | 62 65 20 61 0d 0a 72 65 | out to |be a..re|
|00000e40| 6d 61 72 6b 61 62 6c 79 | 20 76 65 72 73 61 74 69 |markably| versati|
|00000e50| 6c 65 20 73 74 72 75 63 | 74 75 72 65 2e 20 20 49 |le struc|ture. I|
|00000e60| 74 20 69 73 20 75 73 65 | 64 20 6e 6f 74 20 6f 6e |t is use|d not on|
|00000e70| 6c 79 20 66 6f 72 20 69 | 6e 74 65 72 2d 74 61 73 |ly for i|nter-tas|
|00000e80| 6b 0d 0a 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |k..commu|nication|
|00000e90| 2c 20 62 75 74 20 61 6c | 73 6f 20 66 6f 72 20 73 |, but al|so for s|
|00000ea0| 63 68 65 64 75 6c 69 6e | 67 2c 20 72 65 73 6f 75 |chedulin|g, resou|
|00000eb0| 72 63 65 2d 6d 61 6e 61 | 67 65 6d 65 6e 74 2c 20 |rce-mana|gement, |
|00000ec0| 65 76 65 6e 0d 0a 6d 65 | 73 73 61 67 65 2d 70 61 |even..me|ssage-pa|
|00000ed0| 73 73 69 6e 67 20 73 75 | 70 65 72 2d 64 75 70 65 |ssing su|per-dupe|
|00000ee0| 72 20 73 65 6d 61 70 68 | 6f 72 65 73 2e 20 20 46 |r semaph|ores. F|
|00000ef0| 6f 72 20 69 6e 73 74 61 | 6e 63 65 2c 20 73 75 70 |or insta|nce, sup|
|00000f00| 70 6f 73 65 20 77 65 0d | 0a 76 69 65 77 20 74 68 |pose we.|.view th|
|00000f10| 72 65 65 20 6d 65 73 73 | 61 67 65 73 20 77 61 69 |ree mess|ages wai|
|00000f20| 74 69 6e 67 20 6f 6e 20 | 74 68 65 20 3c 49 3e 70 |ting on |the <I>p|
|00000f30| 72 69 6e 74 65 72 73 3c | 2f 49 3e 20 6d 61 69 6c |rinters<|/I> mail|
|00000f40| 62 6f 78 20 61 73 20 72 | 65 70 72 65 73 65 6e 74 |box as r|epresent|
|00000f50| 69 6e 67 0d 0a 74 68 65 | 20 63 6f 6d 70 75 74 65 |ing..the| compute|
|00000f60| 72 27 73 20 74 68 72 65 | 65 20 70 72 69 6e 74 65 |r's thre|e printe|
|00000f70| 72 73 2e 20 20 57 68 65 | 6e 20 61 20 74 61 73 6b |rs. Whe|n a task|
|00000f80| 20 77 61 6e 74 73 20 61 | 20 70 72 69 6e 74 65 72 | wants a| printer|
|00000f90| 2c 20 69 74 0d 0a 73 69 | 6d 70 6c 79 20 72 65 63 |, it..si|mply rec|
|00000fa0| 65 69 76 65 73 20 66 72 | 6f 6d 20 74 68 65 20 3c |eives fr|om the <|
|00000fb0| 49 3e 70 72 69 6e 74 65 | 72 73 3c 2f 49 3e 20 6d |I>printe|rs</I> m|
|00000fc0| 61 69 6c 62 6f 78 2e 20 | 20 54 68 65 20 6d 65 73 |ailbox. | The mes|
|00000fd0| 73 61 67 65 20 69 74 20 | 67 65 74 73 0d 0a 74 65 |sage it |gets..te|
|00000fe0| 6c 6c 73 20 69 74 20 77 | 68 69 63 68 20 70 72 69 |lls it w|hich pri|
|00000ff0| 6e 74 65 72 20 69 74 20 | 67 6f 74 2e 20 20 41 6e |nter it |got. An|
|00001000| 64 20 69 66 20 74 68 65 | 72 65 20 61 72 65 20 6e |d if the|re are n|
|00001010| 6f 20 70 72 69 6e 74 65 | 72 73 0d 0a 61 76 61 69 |o printe|rs..avai|
|00001020| 6c 61 62 6c 65 2c 20 74 | 68 65 20 74 61 73 6b 20 |lable, t|he task |
|00001030| 69 73 20 71 75 65 75 65 | 64 20 77 61 69 74 69 6e |is queue|d waitin|
|00001040| 67 20 66 6f 72 20 74 68 | 65 20 70 72 69 6e 74 65 |g for th|e printe|
|00001050| 72 20 69 6e 20 6c 6f 67 | 69 63 61 6c 0d 0a 66 69 |r in log|ical..fi|
|00001060| 72 73 74 2d 63 6f 6d 65 | 2c 20 66 69 72 73 74 2d |rst-come|, first-|
|00001070| 73 65 72 76 65 20 6f 72 | 64 65 72 3b 20 77 68 65 |serve or|der; whe|
|00001080| 6e 20 61 20 70 72 69 6e | 74 65 72 20 69 73 20 61 |n a prin|ter is a|
|00001090| 76 61 69 6c 61 62 6c 65 | 2c 20 74 68 65 20 74 61 |vailable|, the ta|
|000010a0| 73 6b 0d 0a 77 69 6c 6c | 20 61 75 74 6f 6d 61 74 |sk..will| automat|
|000010b0| 69 63 61 6c 6c 79 20 62 | 65 20 72 65 73 74 61 72 |ically b|e restar|
|000010c0| 74 65 64 2e 20 20 41 6e | 64 20 73 69 6e 63 65 20 |ted. An|d since |
|000010d0| 74 68 69 73 20 46 49 46 | 4f 20 6f 72 64 65 72 69 |this FIF|O orderi|
|000010e0| 6e 67 20 69 73 0d 0a 68 | 6f 6c 64 73 20 66 6f 72 |ng is..h|olds for|
|000010f0| 20 6d 65 73 73 61 67 65 | 73 20 61 73 20 77 65 6c | message|s as wel|
|00001100| 6c 2c 20 74 68 65 20 6c | 65 61 73 74 2d 72 65 63 |l, the l|east-rec|
|00001110| 65 6e 74 6c 79 2d 75 73 | 65 64 20 70 72 69 6e 74 |ently-us|ed print|
|00001120| 65 72 20 77 69 6c 6c 0d | 0a 61 6c 77 61 79 73 20 |er will.|.always |
|00001130| 62 65 20 63 68 6f 73 65 | 6e 2c 20 69 6e 73 75 72 |be chose|n, insur|
|00001140| 69 6e 67 20 74 68 65 20 | 74 68 72 65 65 20 70 72 |ing the |three pr|
|00001150| 69 6e 74 65 72 73 20 61 | 72 65 20 65 76 65 6e 6c |inters a|re evenl|
|00001160| 79 20 75 73 65 64 2e 0a | 0a 3c 50 3e 0a 49 66 20 |y used..|.<P>.If |
|00001170| 61 20 70 72 6f 63 65 73 | 73 6f 72 20 69 73 20 61 |a proces|sor is a|
|00001180| 6c 73 6f 20 74 68 6f 75 | 67 68 74 20 6f 66 20 61 |lso thou|ght of a|
|00001190| 73 20 61 20 72 65 73 6f | 75 72 63 65 20 28 77 68 |s a reso|urce (wh|
|000011a0| 69 63 68 20 69 74 20 69 | 73 29 2c 20 74 68 65 0d |ich it i|s), the.|
|000011b0| 0a 6d 61 69 6c 62 6f 78 | 20 61 62 73 74 72 61 63 |.mailbox| abstrac|
|000011c0| 74 69 6f 6e 20 6d 61 6b | 65 73 20 61 20 67 6f 6f |tion mak|es a goo|
|000011d0| 64 20 73 63 68 65 64 75 | 6c 65 72 2e 20 20 57 65 |d schedu|ler. We|
|000011e0| 20 69 6d 61 67 69 6e 65 | 20 61 20 3c 49 3e 73 63 | imagine| a <I>sc|
|000011f0| 68 65 64 75 6c 65 3c 2f | 49 3e 0d 0a 6d 61 69 6c |hedule</|I>..mail|
|00001200| 62 6f 78 2c 20 77 69 74 | 68 20 74 61 73 6b 73 20 |box, wit|h tasks |
|00001210| 77 61 69 74 69 6e 67 20 | 74 6f 20 60 60 72 65 63 |waiting |to ``rec|
|00001220| 65 69 76 65 27 27 20 61 | 20 70 72 6f 63 65 73 73 |eive'' a| process|
|00001230| 6f 72 20 74 6f 20 72 75 | 6e 0d 0a 74 68 65 6d 2e |or to ru|n..them.|
|00001240| 3c 41 20 4e 41 4d 45 3d | 22 74 65 78 32 68 74 6d |<A NAME=|"tex2htm|
|00001250| 6c 31 32 22 20 48 52 45 | 46 3d 22 66 6f 6f 74 6e |l12" HRE|F="footn|
|00001260| 6f 64 65 5f 6d 6e 2e 68 | 74 6d 6c 23 66 6f 6f 74 |ode_mn.h|tml#foot|
|00001270| 31 38 33 22 20 54 41 52 | 47 45 54 3d 22 66 6f 6f |183" TAR|GET="foo|
|00001280| 74 65 72 22 3e 3c 53 55 | 50 3e 36 3c 2f 53 55 50 |ter"><SU|P>6</SUP|
|00001290| 3e 3c 2f 41 3e 20 20 41 | 67 61 69 6e 2c 20 64 75 |></A> A|gain, du|
|000012a0| 65 20 74 6f 20 74 68 65 | 20 46 49 46 4f 0d 0a 6f |e to the| FIFO..o|
|000012b0| 72 64 65 72 69 6e 67 2c | 20 74 61 73 6b 73 20 61 |rdering,| tasks a|
|000012c0| 72 65 20 61 75 74 6f 6d | 61 74 69 63 61 6c 6c 79 |re autom|atically|
|000012d0| 20 70 72 6f 63 65 73 73 | 65 64 20 69 6e 20 61 20 | process|ed in a |
|000012e0| 72 6f 75 6e 64 2d 72 6f | 62 69 6e 20 66 61 73 68 |round-ro|bin fash|
|000012f0| 69 6f 6e 2e 0d 0a 46 6f | 72 20 6d 6f 72 65 20 61 |ion...Fo|r more a|
|00001300| 64 76 61 6e 63 65 64 2c | 20 3c 42 3e 70 72 69 6f |dvanced,| <B>prio|
|00001310| 72 69 74 69 7a 65 64 3c | 2f 42 3e 20 73 63 68 65 |ritized<|/B> sche|
|00001320| 64 75 6c 69 6e 67 2c 20 | 77 65 20 61 73 73 69 67 |duling, |we assig|
|00001330| 6e 20 61 20 70 72 69 6f | 72 69 74 79 0d 0a 74 6f |n a prio|rity..to|
|00001340| 20 61 20 74 61 73 6b 20 | 62 79 20 61 73 73 69 67 | a task |by assig|
|00001350| 6e 69 6e 67 20 61 20 6d | 61 69 6c 62 6f 78 20 6f |ning a m|ailbox o|
|00001360| 6e 20 77 68 69 63 68 20 | 74 6f 20 73 63 68 65 64 |n which |to sched|
|00001370| 75 6c 65 20 69 74 20 77 | 68 65 6e 65 76 65 72 20 |ule it w|henever |
|00001380| 69 74 0d 0a 63 61 6e 20 | 62 65 20 72 75 6e 2e 20 |it..can |be run. |
|00001390| 20 57 65 20 6c 69 73 74 | 20 74 68 65 73 65 20 73 | We list| these s|
|000013a0| 63 68 65 64 75 6c 65 20 | 6d 61 69 6c 62 6f 78 65 |chedule |mailboxe|
|000013b0| 73 20 69 6e 20 6f 72 64 | 65 72 20 6f 66 20 70 72 |s in ord|er of pr|
|000013c0| 69 6f 72 69 74 79 2e 0d | 0a 57 68 65 6e 65 76 65 |iority..|.Wheneve|
|000013d0| 72 20 77 65 20 6e 65 65 | 64 20 74 6f 20 72 75 6e |r we nee|d to run|
|000013e0| 20 61 20 74 61 73 6b 2c | 20 77 65 20 73 65 61 72 | a task,| we sear|
|000013f0| 63 68 20 74 68 69 73 20 | 28 73 68 6f 72 74 29 20 |ch this |(short) |
|00001400| 6c 69 73 74 0d 0a 73 65 | 71 75 65 6e 74 69 61 6c |list..se|quential|
|00001410| 6c 79 20 75 6e 74 69 6c | 20 74 68 65 20 66 69 72 |ly until| the fir|
|00001420| 73 74 20 28 68 69 67 68 | 65 73 74 20 70 72 69 6f |st (high|est prio|
|00001430| 72 69 74 79 29 20 74 61 | 73 6b 20 69 73 20 66 6f |rity) ta|sk is fo|
|00001440| 75 6e 64 0d 0a 28 73 65 | 65 20 66 69 67 75 72 65 |und..(se|e figure|
|00001450| 29 2e 0a 0a 3c 50 3e 0a | 0a 3c 44 49 56 20 63 6c |)...<P>.|.<DIV cl|
|00001460| 61 73 73 3d 22 43 45 4e | 54 45 52 22 3e 3c 41 20 |ass="CEN|TER"><A |
|00001470| 49 44 3d 22 31 32 39 22 | 3e 3c 2f 41 3e 0a 3c 54 |ID="129"|></A>.<T|
|00001480| 41 42 4c 45 3e 0a 3c 43 | 41 50 54 49 4f 4e 20 63 |ABLE>.<C|APTION c|
|00001490| 6c 61 73 73 3d 22 42 4f | 54 54 4f 4d 22 3e 3c 53 |lass="BO|TTOM"><S|
|000014a0| 54 52 4f 4e 47 3e 46 69 | 67 75 72 65 3a 3c 2f 53 |TRONG>Fi|gure:</S|
|000014b0| 54 52 4f 4e 47 3e 0a 4d | 50 54 53 4b 3a 20 20 41 |TRONG>.M|PTSK: A|
|000014c0| 20 4d 61 69 6c 62 6f 78 | 20 53 63 68 65 64 75 6c | Mailbox| Schedul|
|000014d0| 65 72 20 45 78 61 6d 70 | 6c 65 3c 2f 43 41 50 54 |er Examp|le</CAPT|
|000014e0| 49 4f 4e 3e 0a 3c 54 52 | 3e 3c 54 44 3e 3c 49 4d |ION>.<TR|><TD><IM|
|000014f0| 47 0a 20 53 54 59 4c 45 | 3d 22 68 65 69 67 68 74 |G. STYLE|="height|
|00001500| 3a 20 33 31 34 2e 30 30 | 65 78 3b 20 22 20 53 52 |: 314.00|ex; " SR|
|00001510| 43 3d 22 69 6d 67 38 2e | 70 6e 67 22 0a 20 41 4c |C="img8.|png". AL|
|00001520| 54 3d 22 5c 62 65 67 69 | 6e 7b 66 69 67 75 72 65 |T="\begi|n{figure|
|00001530| 7d 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |}.\begin|{verbati|
|00001540| 6d 7d 0a 50 72 69 6f 72 | 69 74 79 0a 50 72 69 6f |m}.Prior|ity.Prio|
|00001550| 72 69 74 79 20 4c 65 76 | 65 6c 20 53 63 68 65 64 |rity Lev|el Sched|
|00001560| 75 6c 65 20 54 61 73 6b | 73 2e 2e 2e 0a 2e 2e 2e |ule Task|s.......|
|00001570| 69 6d 70 6c 79 20 73 65 | 61 72 63 68 65 73 20 64 |imply se|arches d|
|00001580| 6f 77 6e 20 74 68 65 20 | 73 63 68 65 64 75 6c 65 |own the |schedule|
|00001590| 0a 6c 69 73 74 20 75 6e | 74 69 6c 20 69 74 20 66 |.list un|til it f|
|000015a0| 69 6e 64 73 20 61 20 74 | 61 73 6b 2e 7d 0a 5c 70 |inds a t|ask.}.\p|
|000015b0| 61 72 0a 5c 65 6e 64 7b | 66 69 67 75 72 65 7d 22 |ar.\end{|figure}"|
|000015c0| 3e 3c 2f 54 44 3e 3c 2f | 54 52 3e 0a 3c 2f 54 41 |></TD></|TR>.</TA|
|000015d0| 42 4c 45 3e 0a 3c 2f 44 | 49 56 3e 0a 0a 3c 50 3e |BLE>.</D|IV>..<P>|
|000015e0| 0a 41 20 6b 65 79 20 61 | 64 76 61 6e 74 61 67 65 |.A key a|dvantage|
|000015f0| 20 74 6f 20 6d 61 69 6c | 62 6f 78 20 6d 75 6c 74 | to mail|box mult|
|00001600| 69 74 61 73 6b 69 6e 67 | 20 69 73 20 73 70 65 65 |itasking| is spee|
|00001610| 64 2e 20 20 4d 61 6e 79 | 20 6d 75 6c 74 69 74 61 |d. Many| multita|
|00001620| 73 6b 69 6e 67 0d 0a 73 | 79 73 74 65 6d 73 20 68 |sking..s|ystems h|
|00001630| 61 76 65 20 61 20 73 69 | 6e 67 6c 65 20 6b 65 72 |ave a si|ngle ker|
|00001640| 6e 65 6c 20 74 61 73 6b | 20 77 68 69 63 68 20 73 |nel task| which s|
|00001650| 63 68 65 64 75 6c 65 73 | 20 61 6c 6c 20 70 72 6f |chedules| all pro|
|00001660| 63 65 73 73 65 73 20 61 | 6e 64 0d 0a 6d 61 6e 61 |cesses a|nd..mana|
|00001670| 67 65 73 20 61 6c 6c 20 | 72 65 73 6f 75 72 63 65 |ges all |resource|
|00001680| 73 2e 20 20 54 68 65 72 | 65 66 6f 72 65 2c 20 74 |s. Ther|efore, t|
|00001690| 6f 20 73 77 69 74 63 68 | 20 62 65 74 77 65 65 6e |o switch| between|
|000016a0| 20 74 61 73 6b 73 2c 20 | 61 6e 64 20 65 76 65 6e | tasks, |and even|
|000016b0| 0d 0a 74 6f 20 73 65 6e | 64 20 61 20 6d 65 73 73 |..to sen|d a mess|
|000016c0| 61 67 65 2c 20 72 65 71 | 75 69 72 65 73 20 61 74 |age, req|uires at|
|000016d0| 20 6c 65 61 73 74 20 74 | 77 6f 20 63 6f 6e 74 65 | least t|wo conte|
|000016e0| 78 74 20 73 77 69 74 63 | 68 65 73 20 28 69 6e 74 |xt switc|hes (int|
|000016f0| 6f 20 61 6e 64 0d 0a 6f | 75 74 20 6f 66 20 74 68 |o and..o|ut of th|
|00001700| 65 20 6b 65 72 6e 65 6c | 29 2e 20 20 4d 61 69 6c |e kernel|). Mail|
|00001710| 62 6f 78 20 72 65 71 75 | 69 72 65 73 20 6e 6f 20 |box requ|ires no |
|00001720| 6f 72 20 61 74 20 6d 6f | 73 74 20 6f 6e 65 20 63 |or at mo|st one c|
|00001730| 6f 6e 74 65 78 74 0d 0a | 73 77 69 74 63 68 20 74 |ontext..|switch t|
|00001740| 6f 20 73 65 6e 64 20 61 | 20 6d 65 73 73 61 67 65 |o send a| message|
|00001750| 2c 20 61 6e 64 20 6f 6e | 6c 79 20 6f 6e 65 20 74 |, and on|ly one t|
|00001760| 6f 20 73 77 69 74 63 68 | 20 62 65 74 77 65 65 6e |o switch| between|
|00001770| 20 74 61 73 6b 73 2e 20 | 20 54 68 69 73 0d 0a 69 | tasks. | This..i|
|00001780| 73 20 62 65 63 61 75 73 | 65 20 69 74 20 64 6f 65 |s becaus|e it doe|
|00001790| 73 20 74 68 65 73 65 20 | 6b 65 72 6e 65 6c 20 66 |s these |kernel f|
|000017a0| 75 6e 63 74 69 6f 6e 73 | 20 73 69 6d 70 6c 79 20 |unctions| simply |
|000017b0| 61 6e 64 20 77 69 74 68 | 69 6e 20 74 68 65 0d 0a |and with|in the..|
|000017c0| 63 75 72 72 65 6e 74 20 | 74 61 73 6b 2e 20 20 49 |current |task. I|
|000017d0| 74 20 61 63 68 69 65 76 | 65 73 20 65 66 66 69 63 |t achiev|es effic|
|000017e0| 69 65 6e 63 79 20 61 74 | 20 74 68 65 20 63 6f 73 |iency at| the cos|
|000017f0| 74 20 6f 66 20 73 6f 6d | 65 20 69 6e 74 65 72 2d |t of som|e inter-|
|00001800| 74 61 73 6b 0d 0a 70 72 | 6f 74 65 63 74 69 6f 6e |task..pr|otection|
|00001810| 20 28 77 68 69 63 68 20 | 69 73 20 61 63 63 65 70 | (which |is accep|
|00001820| 74 61 62 6c 65 20 73 69 | 6e 63 65 20 61 6c 6c 20 |table si|nce all |
|00001830| 74 68 65 20 6d 65 6d 6f | 72 79 20 69 73 20 73 68 |the memo|ry is sh|
|00001840| 61 72 65 64 0d 0a 61 6e | 79 77 61 79 29 2e 0a 0a |ared..an|yway)...|
|00001850| 3c 50 3e 0a 41 6c 73 6f | 2c 20 75 73 75 61 6c 6c |<P>.Also|, usuall|
|00001860| 79 20 6f 6e 6c 79 20 6f | 6e 65 20 70 72 6f 63 65 |y only o|ne proce|
|00001870| 73 73 6f 72 20 69 73 20 | 61 6c 6c 6f 77 65 64 20 |ssor is |allowed |
|00001880| 74 6f 20 65 78 65 63 75 | 74 65 20 69 6e 73 69 64 |to execu|te insid|
|00001890| 65 20 74 68 65 0d 0a 6b | 65 72 6e 65 6c 20 61 74 |e the..k|ernel at|
|000018a0| 20 6f 6e 63 65 2e 20 20 | 54 68 75 73 20 74 68 65 | once. |Thus the|
|000018b0| 20 6b 65 72 6e 65 6c 20 | 73 63 68 65 64 75 6c 65 | kernel |schedule|
|000018c0| 72 20 69 74 73 65 6c 66 | 20 62 65 63 6f 6d 65 73 |r itself| becomes|
|000018d0| 20 74 68 65 0d 0a 62 6f | 74 74 6c 65 6e 65 63 6b | the..bo|ttleneck|
|000018e0| 20 61 73 20 6d 6f 72 65 | 20 70 72 6f 63 65 73 73 | as more| process|
|000018f0| 6f 72 73 20 61 72 65 20 | 61 64 64 65 64 2c 20 61 |ors are |added, a|
|00001900| 6e 64 20 66 6f 72 20 74 | 68 69 73 20 72 65 61 73 |nd for t|his reas|
|00001910| 6f 6e 20 69 74 20 69 73 | 0d 0a 75 6e 75 73 75 61 |on it is|..unusua|
|00001920| 6c 20 74 6f 20 66 69 6e | 64 20 61 20 73 68 61 72 |l to fin|d a shar|
|00001930| 65 64 2d 6d 65 6d 6f 72 | 79 20 6d 61 63 68 69 6e |ed-memor|y machin|
|00001940| 65 20 77 69 74 68 20 6d | 6f 72 65 20 74 68 61 6e |e with m|ore than|
|00001950| 20 68 61 6c 66 2d 61 2d | 64 6f 7a 65 6e 0d 0a 70 | half-a-|dozen..p|
|00001960| 72 6f 63 65 73 73 6f 72 | 73 2e 20 20 4c 69 6b 65 |rocessor|s. Like|
|00001970| 77 69 73 65 2c 20 61 20 | 6d 61 69 6c 62 6f 78 20 |wise, a |mailbox |
|00001980| 63 61 6e 20 6f 6e 6c 79 | 20 62 65 20 6f 70 65 6e |can only| be open|
|00001990| 65 64 20 62 79 20 6f 6e | 65 20 70 72 6f 63 65 73 |ed by on|e proces|
|000019a0| 73 6f 72 2e 0d 0a 42 75 | 74 20 4d 61 69 6c 62 6f |sor...Bu|t Mailbo|
|000019b0| 78 20 4d 75 6c 74 69 74 | 61 73 6b 69 6e 67 20 64 |x Multit|asking d|
|000019c0| 69 73 74 72 69 62 75 74 | 65 73 20 6d 65 73 73 61 |istribut|es messa|
|000019d0| 67 65 20 70 61 73 73 69 | 6e 67 20 61 6e 64 20 73 |ge passi|ng and s|
|000019e0| 63 68 65 64 75 6c 69 6e | 67 0d 0a 62 65 74 77 65 |chedulin|g..betwe|
|000019f0| 65 6e 20 6d 75 6c 74 69 | 70 6c 65 20 6d 61 69 6c |en multi|ple mail|
|00001a00| 62 6f 78 65 73 3b 20 61 | 6e 64 20 61 20 70 72 6f |boxes; a|nd a pro|
|00001a10| 63 65 73 73 6f 72 20 63 | 61 6e 20 6f 6e 6c 79 20 |cessor c|an only |
|00001a20| 6f 70 65 6e 20 6f 6e 65 | 20 6d 61 69 6c 62 6f 78 |open one| mailbox|
|00001a30| 0d 0a 61 74 20 61 20 74 | 69 6d 65 2c 20 61 6e 64 |..at a t|ime, and|
|00001a40| 20 6f 6e 6c 79 20 6d 6f | 6d 65 6e 74 61 72 69 6c | only mo|mentaril|
|00001a50| 79 2e 20 20 54 68 6f 75 | 67 68 20 69 74 73 20 73 |y. Thou|gh its s|
|00001a60| 63 68 65 64 75 6c 69 6e | 67 20 61 6c 67 6f 72 69 |chedulin|g algori|
|00001a70| 74 68 6d 20 69 73 0d 0a | 73 69 6d 70 6c 65 2c 20 |thm is..|simple, |
|00001a80| 69 74 20 69 73 20 3c 45 | 4d 3e 66 61 73 74 3c 2f |it is <E|M>fast</|
|00001a90| 45 4d 3e 20 61 6e 64 20 | 70 6f 74 65 6e 74 69 61 |EM> and |potentia|
|00001aa0| 6c 6c 79 20 3c 45 4d 3e | 69 6e 64 65 70 65 6e 64 |lly <EM>|independ|
|00001ab0| 65 6e 74 3c 2f 45 4d 3e | 20 6f 66 20 74 68 65 0d |ent</EM>| of the.|
|00001ac0| 0a 6e 75 6d 62 65 72 20 | 6f 66 20 70 72 6f 63 65 |.number |of proce|
|00001ad0| 73 73 6f 72 73 2e 20 20 | 46 6f 72 20 74 68 69 73 |ssors. |For this|
|00001ae0| 20 72 65 61 73 6f 6e 2c | 20 4d 61 69 6c 62 6f 78 | reason,| Mailbox|
|00001af0| 20 73 68 6f 75 6c 64 20 | 62 65 20 61 62 6c 65 20 | should |be able |
|00001b00| 74 6f 0d 0a 74 61 6b 65 | 20 67 72 65 61 74 20 61 |to..take| great a|
|00001b10| 64 76 61 6e 74 61 67 65 | 20 6f 66 20 6d 75 6c 74 |dvantage| of mult|
|00001b20| 69 70 72 6f 63 65 73 73 | 69 6e 67 20 6d 61 63 68 |iprocess|ing mach|
|00001b30| 69 6e 65 73 2e 0a 0a 3c | 50 3e 0a 0a 3c 44 49 56 |ines...<|P>..<DIV|
|00001b40| 20 63 6c 61 73 73 3d 22 | 43 45 4e 54 45 52 22 3e | class="|CENTER">|
|00001b50| 3c 41 20 49 44 3d 22 31 | 33 37 22 3e 3c 2f 41 3e |<A ID="1|37"></A>|
|00001b60| 0a 3c 54 41 42 4c 45 3e | 0a 3c 43 41 50 54 49 4f |.<TABLE>|.<CAPTIO|
|00001b70| 4e 20 63 6c 61 73 73 3d | 22 42 4f 54 54 4f 4d 22 |N class=|"BOTTOM"|
|00001b80| 3e 3c 53 54 52 4f 4e 47 | 3e 46 69 67 75 72 65 3a |><STRONG|>Figure:|
|00001b90| 3c 2f 53 54 52 4f 4e 47 | 3e 0a 4d 50 54 53 4b 3a |</STRONG|>.MPTSK:|
|00001ba0| 20 4d 65 73 73 61 67 65 | 2c 20 54 61 73 6b 2c 20 | Message|, Task, |
|00001bb0| 61 6e 64 20 4d 61 69 6c | 62 6f 78 20 44 61 74 61 |and Mail|box Data|
|00001bc0| 74 79 70 65 20 49 6e 74 | 65 72 6e 61 6c 73 3c 2f |type Int|ernals</|
|00001bd0| 43 41 50 54 49 4f 4e 3e | 0a 3c 54 52 3e 3c 54 44 |CAPTION>|.<TR><TD|
|00001be0| 3e 3c 49 4d 47 0a 20 53 | 54 59 4c 45 3d 22 68 65 |><IMG. S|TYLE="he|
|00001bf0| 69 67 68 74 3a 20 33 31 | 34 2e 30 30 65 78 3b 20 |ight: 31|4.00ex; |
|00001c00| 22 20 53 52 43 3d 22 69 | 6d 67 39 2e 70 6e 67 22 |" SRC="i|mg9.png"|
|00001c10| 0a 20 41 4c 54 3d 22 5c | 62 65 67 69 6e 7b 66 69 |. ALT="\|begin{fi|
|00001c20| 67 75 72 65 7d 0a 5c 62 | 65 67 69 6e 7b 76 65 72 |gure}.\b|egin{ver|
|00001c30| 62 61 74 69 6d 7d 0a 4d | 65 73 73 61 67 65 20 48 |batim}.M|essage H|
|00001c40| 65 61 64 65 72 20 28 66 | 6f 72 20 6d 65 73 73 61 |eader (f|or messa|
|00001c50| 67 65 20 6d 61 6e 61 67 | 65 6d 65 6e 74 29 0d 2e |ge manag|ement)..|
|00001c60| 2e 2e 0a 2e 2e 2e 72 65 | 20 28 74 6f 20 63 6f 6e |......re| (to con|
|00001c70| 74 72 6f 6c 20 6d 75 6c | 74 69 70 72 6f 63 65 73 |trol mul|tiproces|
|00001c80| 73 6f 72 20 61 63 63 65 | 73 73 20 74 6f 20 74 68 |sor acce|ss to th|
|00001c90| 65 20 6d 61 69 6c 62 6f | 78 29 5c 65 6e 64 7b 76 |e mailbo|x)\end{v|
|00001ca0| 65 72 62 61 74 69 6d 7d | 0a 5c 65 6e 64 7b 66 69 |erbatim}|.\end{fi|
|00001cb0| 67 75 72 65 7d 22 3e 3c | 2f 54 44 3e 3c 2f 54 52 |gure}"><|/TD></TR|
|00001cc0| 3e 0a 3c 2f 54 41 42 4c | 45 3e 0a 3c 2f 44 49 56 |>.</TABL|E>.</DIV|
|00001cd0| 3e 0a 0a 3c 50 3e 0a 41 | 6e 20 61 70 70 61 72 65 |>..<P>.A|n appare|
|00001ce0| 6e 74 20 64 69 73 61 64 | 76 61 6e 74 61 67 65 20 |nt disad|vantage |
|00001cf0| 6f 66 20 4d 61 69 6c 62 | 6f 78 20 4d 75 6c 74 69 |of Mailb|ox Multi|
|00001d00| 74 61 73 6b 69 6e 67 20 | 69 73 20 74 68 61 74 20 |tasking |is that |
|00001d10| 69 74 20 64 6f 65 73 20 | 6e 6f 74 0d 0a 63 6f 6d |it does |not..com|
|00001d20| 65 20 77 69 74 68 20 66 | 75 6e 63 74 69 6f 6e 73 |e with f|unctions|
|00001d30| 20 74 6f 20 61 6c 6c 6f | 77 20 6f 6e 65 20 74 61 | to allo|w one ta|
|00001d40| 73 6b 20 74 6f 20 66 6f | 72 63 65 20 61 6e 6f 74 |sk to fo|rce anot|
|00001d50| 68 65 72 20 74 6f 20 73 | 74 6f 70 20 6f 72 0d 0a |her to s|top or..|
|00001d60| 73 75 73 70 65 6e 64 2c | 20 61 20 66 65 61 74 75 |suspend,| a featu|
|00001d70| 72 65 20 63 6f 6d 6d 6f | 6e 20 69 6e 20 6f 74 68 |re commo|n in oth|
|00001d80| 65 72 20 6d 75 6c 74 69 | 74 61 73 6b 65 72 73 2e |er multi|taskers.|
|00001d90| 20 20 42 75 74 20 74 68 | 69 73 20 69 73 20 20 62 | But th|is is b|
|00001da0| 65 63 61 75 73 65 0d 0a | 4d 61 69 6c 62 6f 78 20 |ecause..|Mailbox |
|00001db0| 68 61 73 20 62 65 65 6e | 20 64 65 73 69 67 6e 65 |has been| designe|
|00001dc0| 64 20 74 6f 20 61 6c 73 | 6f 20 77 6f 72 6b 20 69 |d to als|o work i|
|00001dd0| 6e 20 6d 75 6c 74 69 70 | 72 6f 63 65 73 73 6f 72 |n multip|rocessor|
|00001de0| 0d 0a 65 6e 76 69 72 6f | 6e 6d 65 6e 74 73 2c 20 |..enviro|nments, |
|00001df0| 77 68 65 72 65 20 74 68 | 65 20 73 63 68 65 64 75 |where th|e schedu|
|00001e00| 6c 65 72 20 63 61 6e 6e | 6f 74 20 61 75 74 6f 6d |ler cann|ot autom|
|00001e10| 61 74 69 63 61 6c 6c 79 | 20 61 73 73 75 6d 65 20 |atically| assume |
|00001e20| 74 68 65 20 6f 74 68 65 | 72 0d 0a 74 61 73 6b 73 |the othe|r..tasks|
|00001e30| 20 61 72 65 20 73 75 73 | 70 65 6e 64 65 64 20 77 | are sus|pended w|
|00001e40| 68 69 6c 65 20 69 74 20 | 65 78 65 63 75 74 65 73 |hile it |executes|
|00001e50| 20 61 20 74 61 73 6b 2e | 20 20 54 68 6f 75 67 68 | a task.| Though|
|00001e60| 20 49 20 64 6f 20 6e 6f | 74 20 68 61 76 65 0d 0a | I do no|t have..|
|00001e70| 61 20 6d 75 6c 74 69 70 | 72 6f 63 65 73 73 6f 72 |a multip|rocessor|
|00001e80| 20 6d 61 63 68 69 6e 65 | 20 61 74 20 6d 79 20 64 | machine| at my d|
|00001e90| 69 73 70 6f 73 61 6c 2c | 20 49 20 64 65 73 69 67 |isposal,| I desig|
|00001ea0| 6e 65 64 20 4d 61 69 6c | 62 6f 78 20 74 6f 20 74 |ned Mail|box to t|
|00001eb0| 61 6b 65 0d 0a 61 64 76 | 61 6e 74 61 67 65 20 6f |ake..adv|antage o|
|00001ec0| 66 20 6d 75 6c 74 69 70 | 72 6f 63 65 73 73 69 6e |f multip|rocessin|
|00001ed0| 67 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 73 20 73 |g enviro|nments s|
|00001ee0| 68 6f 75 6c 64 20 74 68 | 65 79 20 62 65 63 6f 6d |hould th|ey becom|
|00001ef0| 65 0d 0a 61 76 61 69 6c | 61 62 6c 65 2c 20 61 6e |e..avail|able, an|
|00001f00| 64 20 74 6f 20 62 65 74 | 74 65 72 20 75 6e 64 65 |d to bet|ter unde|
|00001f10| 72 73 74 61 6e 64 20 69 | 73 73 75 65 73 20 69 6e |rstand i|ssues in|
|00001f20| 76 6f 6c 76 65 64 20 69 | 6e 20 72 65 61 6c 0d 0a |volved i|n real..|
|00001f30| 63 6f 6e 63 75 72 72 65 | 6e 74 20 65 6e 76 69 72 |concurre|nt envir|
|00001f40| 6f 6e 6d 65 6e 74 73 2e | 0a 0a 3c 50 3e 0a 41 63 |onments.|..<P>.Ac|
|00001f50| 74 75 61 6c 6c 79 2c 20 | 4d 61 69 6c 62 6f 78 20 |tually, |Mailbox |
|00001f60| 69 73 20 65 61 73 69 6c | 79 20 65 78 74 65 6e 64 |is easil|y extend|
|00001f70| 65 64 20 74 6f 20 73 75 | 70 70 6f 72 74 20 73 6f |ed to su|pport so|
|00001f80| 70 68 69 73 74 69 63 61 | 74 65 64 20 74 61 73 6b |phistica|ted task|
|00001f90| 0d 0a 63 6f 6e 74 72 6f | 6c 20 6f 70 65 72 61 74 |..contro|l operat|
|00001fa0| 69 6f 6e 73 20 64 75 65 | 20 74 6f 20 61 6e 6f 74 |ions due| to anot|
|00001fb0| 68 65 72 20 66 65 61 74 | 75 72 65 2c 20 69 74 73 |her feat|ure, its|
|00001fc0| 20 75 6e 69 66 6f 72 6d | 69 74 79 2e 0d 0a 45 76 | uniform|ity...Ev|
|00001fd0| 65 72 79 74 68 69 6e 67 | 2c 20 65 76 65 6e 20 73 |erything|, even s|
|00001fe0| 63 68 65 64 75 6c 69 6e | 67 2c 20 77 6f 72 6b 73 |chedulin|g, works|
|00001ff0| 20 62 79 20 73 65 6e 64 | 69 6e 67 20 61 6e 64 20 | by send|ing and |
|00002000| 72 65 63 65 69 76 69 6e | 67 20 6d 65 73 73 61 67 |receivin|g messag|
|00002010| 65 73 2e 0d 0a 4d 6f 72 | 65 20 73 6f 70 68 69 73 |es...Mor|e sophis|
|00002020| 74 69 63 61 74 65 64 20 | 6f 70 65 72 61 74 69 6f |ticated |operatio|
|00002030| 6e 73 20 66 6f 6c 6c 6f | 77 20 6c 6f 67 69 63 61 |ns follo|w logica|
|00002040| 6c 6c 79 20 61 6e 64 20 | 64 6f 20 6e 6f 74 20 6e |lly and |do not n|
|00002050| 65 65 64 20 74 6f 20 62 | 65 0d 0a 74 61 69 6c 6f |eed to b|e..tailo|
|00002060| 72 65 64 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |red. Fo|r exampl|
|00002070| 65 2c 20 74 6f 20 3c 42 | 3e 79 69 65 6c 64 3c 2f |e, to <B|>yield</|
|00002080| 42 3e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 74 |B> the c|urrent t|
|00002090| 61 73 6b 20 73 6f 20 6f | 74 68 65 72 0d 0a 74 61 |ask so o|ther..ta|
|000020a0| 73 6b 73 20 63 61 6e 20 | 72 75 6e 20 28 75 73 65 |sks can |run (use|
|000020b0| 66 75 6c 20 77 68 65 6e | 20 70 6f 6c 6c 69 6e 67 |ful when| polling|
|000020c0| 20 73 6f 6d 65 20 63 6f | 6e 64 69 74 69 6f 6e 29 | some co|ndition)|
|000020d0| 2c 20 74 68 65 20 74 61 | 73 6b 20 6d 65 72 65 6c |, the ta|sk merel|
|000020e0| 79 0d 0a 61 74 74 65 6d | 70 74 73 20 74 6f 20 60 |y..attem|pts to `|
|000020f0| 60 72 65 63 65 69 76 65 | 27 27 20 61 20 70 72 6f |`receive|'' a pro|
|00002100| 63 65 73 73 6f 72 20 60 | 60 72 65 73 6f 75 72 63 |cessor `|`resourc|
|00002110| 65 27 27 20 66 72 6f 6d | 20 69 74 73 20 73 63 68 |e'' from| its sch|
|00002120| 65 64 75 6c 65 0d 0a 6d | 61 69 6c 62 6f 78 2e 20 |edule..m|ailbox. |
|00002130| 20 49 74 20 69 73 20 61 | 6c 73 6f 20 70 6f 73 73 | It is a|lso poss|
|00002140| 69 62 6c 65 20 66 6f 72 | 20 61 20 74 61 73 6b 20 |ible for| a task |
|00002150| 74 6f 20 73 70 65 63 69 | 66 79 20 77 68 69 63 68 |to speci|fy which|
|00002160| 20 74 61 73 6b 73 0d 0a | 28 77 68 69 63 68 20 73 | tasks..|(which s|
|00002170| 63 68 65 64 75 6c 65 20 | 6c 69 73 74 29 20 69 74 |chedule |list) it|
|00002180| 20 77 61 6e 74 73 20 74 | 6f 20 79 69 65 6c 64 20 | wants t|o yield |
|00002190| 74 6f 2e 20 20 54 68 75 | 73 2c 20 77 68 65 6e 20 |to. Thu|s, when |
|000021a0| 6f 70 74 69 6d 69 7a 69 | 6e 67 0d 0a 70 65 72 66 |optimizi|ng..perf|
|000021b0| 6f 72 6d 61 6e 63 65 2c | 20 61 20 74 61 73 6b 20 |ormance,| a task |
|000021c0| 63 61 6e 20 69 6d 70 6c | 65 6d 65 6e 74 20 69 74 |can impl|ement it|
|000021d0| 73 20 6f 77 6e 20 73 63 | 68 65 64 75 6c 65 72 20 |s own sc|heduler |
|000021e0| 61 6e 64 20 60 60 62 72 | 65 61 6b 27 27 20 74 68 |and ``br|eak'' th|
|000021f0| 65 0d 0a 73 74 72 69 63 | 74 20 70 72 69 6f 72 69 |e..stric|t priori|
|00002200| 74 79 20 73 63 68 65 64 | 75 6c 69 6e 67 2e 20 20 |ty sched|uling. |
|00002210| 4f 72 2c 20 66 6f 72 20 | 6d 6f 64 75 6c 61 72 20 |Or, for |modular |
|00002220| 70 72 6f 67 72 61 6d 6d | 69 6e 67 2c 20 61 20 74 |programm|ing, a t|
|00002230| 61 73 6b 20 63 61 6e 0d | 0a 64 75 70 6c 69 63 61 |ask can.|.duplica|
|00002240| 74 65 20 69 74 3a 20 20 | 61 20 74 61 73 6b 20 63 |te it: |a task c|
|00002250| 61 6e 20 6d 75 6c 74 69 | 74 61 73 6b 20 69 74 73 |an multi|task its|
|00002260| 65 6c 66 21 0a 0a 3c 50 | 3e 0a 45 76 65 6e 20 74 |elf!..<P|>.Even t|
|00002270| 68 65 20 73 65 6e 64 20 | 61 6e 64 20 72 65 63 65 |he send |and rece|
|00002280| 69 76 65 20 60 60 70 72 | 69 6d 69 74 69 76 65 73 |ive ``pr|imitives|
|00002290| 27 27 20 61 72 65 20 73 | 70 65 63 69 61 6c 20 69 |'' are s|pecial i|
|000022a0| 6e 73 74 61 6e 63 65 73 | 20 6f 66 20 61 0d 0a 67 |nstances| of a..g|
|000022b0| 65 6e 65 72 61 6c 20 3c | 21 2d 2d 20 4d 41 54 48 |eneral <|!-- MATH|
|000022c0| 0a 20 24 6d 70 74 73 6b | 5c 5f 78 66 65 72 28 29 |. $mptsk|\_xfer()|
|000022d0| 24 0a 20 2d 2d 3e 0a 3c | 49 3e 6d 70 74 73 6b 3c |$. -->.<|I>mptsk<|
|000022e0| 2f 49 3e 3c 49 4d 47 0a | 20 53 54 59 4c 45 3d 22 |/I><IMG.| STYLE="|
|000022f0| 68 65 69 67 68 74 3a 20 | 31 33 33 2e 31 36 65 78 |height: |133.16ex|
|00002300| 3b 20 76 65 72 74 69 63 | 61 6c 2d 61 6c 69 67 6e |; vertic|al-align|
|00002310| 3a 20 33 39 2e 31 31 65 | 78 3b 20 22 20 53 52 43 |: 39.11e|x; " SRC|
|00002320| 3d 22 69 6d 67 31 30 2e | 70 6e 67 22 0a 20 41 4c |="img10.|png". AL|
|00002330| 54 3d 22 24 5c 5f 78 66 | 65 72 24 22 3e 28 29 20 |T="$\_xf|er$">() |
|00002340| 66 75 6e 63 74 69 6f 6e | 2c 20 77 69 74 68 20 66 |function|, with f|
|00002350| 6c 65 78 69 62 69 6c 69 | 74 79 20 61 6b 69 6e 20 |lexibili|ty akin |
|00002360| 74 6f 20 74 68 65 0d 0a | 3c 21 2d 2d 20 4d 41 54 |to the..|<!-- MAT|
|00002370| 48 0a 20 24 6d 70 74 68 | 64 5c 5f 73 77 69 74 63 |H. $mpth|d\_switc|
|00002380| 68 28 29 24 0a 20 2d 2d | 3e 0a 3c 49 3e 6d 70 74 |h()$. --|>.<I>mpt|
|00002390| 68 64 3c 2f 49 3e 3c 49 | 4d 47 0a 20 53 54 59 4c |hd</I><I|MG. STYL|
|000023a0| 45 3d 22 68 65 69 67 68 | 74 3a 20 32 35 2e 33 39 |E="heigh|t: 25.39|
|000023b0| 65 78 3b 20 76 65 72 74 | 69 63 61 6c 2d 61 6c 69 |ex; vert|ical-ali|
|000023c0| 67 6e 3a 20 31 35 31 2e | 34 30 65 78 3b 20 22 20 |gn: 151.|40ex; " |
|000023d0| 53 52 43 3d 22 69 6d 67 | 34 2e 70 6e 67 22 0a 20 |SRC="img|4.png". |
|000023e0| 41 4c 54 3d 22 24 5c 5f | 73 77 69 74 63 68 24 22 |ALT="$\_|switch$"|
|000023f0| 3e 28 29 2e 20 20 42 65 | 63 61 75 73 65 20 61 6c |>(). Be|cause al|
|00002400| 6c 20 74 61 73 6b 20 73 | 77 69 74 63 68 69 6e 67 |l task s|witching|
|00002410| 20 61 6e 64 20 6d 65 73 | 73 61 67 65 20 70 61 73 | and mes|sage pas|
|00002420| 73 69 6e 67 20 69 73 0d | 0a 74 68 72 6f 75 67 68 |sing is.|.through|
|00002430| 20 61 20 73 69 6e 67 6c | 65 20 66 75 6e 63 74 69 | a singl|e functi|
|00002440| 6f 6e 20 69 6e 74 65 72 | 66 61 63 65 2c 20 61 6e |on inter|face, an|
|00002450| 79 20 73 6f 72 74 20 6f | 66 20 6d 65 73 73 61 67 |y sort o|f messag|
|00002460| 65 20 6d 6f 6e 69 74 6f | 72 69 6e 67 2c 0d 0a 70 |e monito|ring,..p|
|00002470| 65 72 66 6f 72 6d 61 6e | 63 65 20 6d 6f 6e 69 74 |erforman|ce monit|
|00002480| 6f 72 69 6e 67 2c 20 6f | 72 20 74 61 73 6b 20 63 |oring, o|r task c|
|00002490| 6f 6e 74 72 6f 6c 20 69 | 73 20 70 6f 73 73 69 62 |ontrol i|s possib|
|000024a0| 6c 65 2c 20 73 69 6d 70 | 6c 79 20 62 79 0d 0a 70 |le, simp|ly by..p|
|000024b0| 61 74 63 68 69 6e 67 20 | 74 68 65 20 64 65 73 69 |atching |the desi|
|000024c0| 72 65 64 20 63 6f 64 65 | 20 69 6e 74 6f 20 74 68 |red code| into th|
|000024d0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 2e 20 20 41 73 |is funct|ion. As|
|000024e0| 20 77 65 20 77 69 6c 6c | 20 73 65 65 20 6d 6f 72 | we will| see mor|
|000024f0| 65 20 6f 66 0d 0a 69 6e | 20 74 68 65 20 6e 65 78 |e of..in| the nex|
|00002500| 74 20 73 75 62 73 65 63 | 74 69 6f 6e 2c 20 69 6e |t subsec|tion, in|
|00002510| 73 74 65 61 64 20 6f 66 | 20 62 65 69 6e 67 20 62 |stead of| being b|
|00002520| 69 67 20 61 6e 64 20 63 | 6f 6d 70 6c 69 63 61 74 |ig and c|omplicat|
|00002530| 65 64 20 77 69 74 68 20 | 65 76 65 72 79 0d 0a 70 |ed with |every..p|
|00002540| 6f 73 73 69 62 6c 65 20 | 66 65 61 74 75 72 65 2c |ossible |feature,|
|00002550| 20 4d 61 69 6c 62 6f 78 | 20 69 73 20 73 69 6d 70 | Mailbox| is simp|
|00002560| 6c 65 2c 20 73 6f 20 74 | 68 65 20 70 72 6f 67 72 |le, so t|he progr|
|00002570| 61 6d 6d 65 72 20 63 61 | 6e 20 71 75 69 63 6b 6c |ammer ca|n quickl|
|00002580| 79 0d 0a 74 61 69 6c 6f | 72 20 68 65 72 20 6f 77 |y..tailo|r her ow|
|00002590| 6e 2e 0a 0a 3c 50 3e 0a | 49 6e 20 73 68 6f 72 74 |n...<P>.|In short|
|000025a0| 2c 20 74 68 65 20 4d 50 | 54 53 4b 20 69 6d 70 6c |, the MP|TSK impl|
|000025b0| 65 6d 65 6e 74 73 20 70 | 72 69 6f 72 69 74 69 7a |ements p|rioritiz|
|000025c0| 65 64 20 6d 75 6c 74 69 | 70 72 6f 63 65 73 73 6f |ed multi|processo|
|000025d0| 72 20 73 63 68 65 64 75 | 6c 69 6e 67 0d 0a 61 6e |r schedu|ling..an|
|000025e0| 64 20 73 69 6d 70 6c 65 | 20 60 60 6d 61 69 6c 62 |d simple| ``mailb|
|000025f0| 6f 78 27 27 20 6d 65 73 | 73 61 67 65 2d 70 61 73 |ox'' mes|sage-pas|
|00002600| 73 69 6e 67 2c 20 62 61 | 73 65 64 20 6f 6e 20 74 |sing, ba|sed on t|
|00002610| 68 72 65 61 64 73 2e 20 | 20 49 74 0d 0a 69 6e 74 |hreads. | It..int|
|00002620| 72 6f 64 75 63 65 73 20 | 74 68 65 20 6d 65 73 73 |roduces |the mess|
|00002630| 61 67 65 2c 20 74 61 73 | 6b 2c 20 61 6e 64 20 6d |age, tas|k, and m|
|00002640| 61 69 6c 62 6f 78 20 64 | 61 74 61 74 79 70 65 73 |ailbox d|atatypes|
|00002650| 20 61 6e 64 20 61 20 73 | 69 6d 70 6c 65 20 73 65 | and a s|imple se|
|00002660| 74 20 6f 66 0d 0a 6f 70 | 65 72 61 74 69 6f 6e 73 |t of..op|erations|
|00002670| 2c 20 77 69 74 68 20 77 | 68 69 63 68 20 6d 61 6e |, with w|hich man|
|00002680| 79 20 73 6f 70 68 69 73 | 74 69 63 61 74 65 64 20 |y sophis|ticated |
|00002690| 73 63 68 65 64 75 6c 69 | 6e 67 2c 20 63 6f 6d 6d |scheduli|ng, comm|
|000026a0| 75 6e 69 63 61 74 69 6f | 6e 2c 0d 0a 61 6e 64 20 |unicatio|n,..and |
|000026b0| 6d 6f 6e 69 74 6f 72 69 | 6e 67 20 65 6e 76 69 72 |monitori|ng envir|
|000026c0| 6f 6e 6d 65 6e 74 73 20 | 63 61 6e 20 62 65 20 65 |onments |can be e|
|000026d0| 61 73 69 6c 79 20 62 75 | 69 6c 74 2e 0a 0a 3c 50 |asily bu|ilt...<P|
|000026e0| 3e 0a 0a 3c 48 52 3e 0a | 0a 3c 2f 42 4f 44 59 3e |>..<HR>.|.</BODY>|
|000026f0| 0a 3c 2f 48 54 4d 4c 3e | 0a |.</HTML>|. |
+--------+-------------------------+-------------------------+--------+--------+