Aa5Td   @P P@ @`P@PP  HH $ @d HHHHff@  d Footnote TableFootnote**.\t.\t/ - :;,.!?cZ6cZTOCHeading1Heading2   FEquationVariables@=?`???@@====== <$lastpagenum><$monthname> <$daynum>, <$year>"<$monthnum>/<$daynum>/<$shortyear>J<$hour>:<$minute00> <$ampm> on <$dayname>, <$monthname> <$daynum>, <$year>"<$monthnum>/<$daynum>/<$shortyear><$monthname> <$daynum>, <$year>"<$monthnum>/<$daynum>/<$shortyear> <$fullfilename> <$filename> <$paratext[Title]> <$paratext[Heading1]> <$curpagenum> <$marker1> <$marker2> (Continued)+ (Sheet <$tblsheetnum> of <$tblsheetcount>)Heading & Page <$paratext> on page<$pagenum>Pagepage<$pagenum>See Heading & Page%See <$paratext> on page<$pagenum>. Table All7Table<$paranumonly>, <$paratext>, on page<$pagenum>Table Number & Page'Table<$paranumonly> on page<$pagenum>Heading <$paratext>?HTML Headings++A88::33557BAHHA====>>>>> > > >>>>>>>>>>!>#>%>'>)>+>->/>1>3>5>7>9>;>=>?>A>B>C>E>G>I>K>M>O>Q>S>U>W>X>Y>[>]>_>a>c>e>g>i>k>m>o>q>s>u>w>y>{>}>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>????? ? ? ??????????!?#?%?'?)?+?-?/?1?3?5?7?9?;?=???A?C?E?G?I?K?M?O?Q?S?U?W?Y?[?]?_?b?d?f?h?j?l?n?p?r?t?v?x?z?|?~???????????????????????????????????????????????????@@!@#@%@'@)@+@-@/@1@3@5@7@9@;@=@?@A@B==???;#???;/;2;5:=??????@@@@@ @ @@@@@D.@H0@I@K0@L@M3@N3@O3@P3@Q3@R3@S3@T3@U3@V3@W3@X3@Y3@Z3@[3@\3@]3@^3@_3@`3@a3@b3@c3@d3@e3@f3@h@i3@j@k3@m0@n:@o:@p:@q:@r:dq5+d@uBB d=d=; HmR=HmRHRHRFootnote Hr@=Hr@HzHz Single LineH靕= Footnote =  HD= HDHH Double LineH=  Double Line= = H֝=  Single Line= d5p77HZ֝=; TableFootnoted=d?靕l d=d1QRUX[^adgjmpsvy| %).1W,܁܁@m }蝝d =蝝d WaHTML Mapping Table }H蝝d =H蝝d Wa }H蝝d =H蝝d Wa }H蝝d =H蝝d Wa }H蝝d >H蝝d Wa }H>H! FrameMaker PA Source Item }H >H Wa HTML Item }H >H Wa }H>H W aInclude Auto# } H>  H W a Comments }H> H W a }HH> HH W aElement }H>#H W a New Topic? }H>H Wa } H> H Wa }H > $H Wa P:Date Line }HH >#%HH WaP }H >$&H WaN }H >%'H WaN } H >&( H Wa }EH > ')EH Wa P:Reading }HEH >"(*HEH WaP }EH >$)+EH WaN }EH >&*,EH WaN } EH >(+- EH Wa }QH >*,.QH WaP:Title }HQH >,-/HQH WaH* }QH >..0QH WaN }QH >0/1QH WaN } QH >202 QH Wa }]H >413]H WaP:Body }H]H >624H]H W aP }]H >835]H W!aN }]H >:46]H W"aN } ]H ><57 ]H W#a }iH(>>68iH( W$a P:Numbered1 }HiH(>@79HiH((%aLI &a Parent = OL Q'a Depth = 0 }iH(>D8:iH( W(aN }iH(>F9;iH( W)aY } iH(>H:< iH( W*a }띝H >J;=띝H  W+a P:Heading1 }H띝H >L<>H띝H  W,aH* }띝H >N=?띝H  W-aN }띝H >P>@띝H  W.aN } 띝H >R?A 띝H  W/a }H(>T@BH(  W0a P:Numbered }HH(>VACHH(( 1aP 2a Parent = OL Q3a Depth = 0 }H(>ZBDH(  W4aN }H(>\CEH(  W5aY } H(>^DF H(  W6a }H >`EGH  W7a P:CellBody }HH >bFHHH  W8aP }H >dGIH  W9aN }H >fHJH  W:aN } H >hIK H  W;a }H >jJLH  W<aP:CellHeading }HH >lKMHH  W=aP }H >nLNH  W>aN }H >pMOH  W?aN } H >rNP H  W@a }H >tOQH  WAa P:Footnote }HH >vPRHH  WBaP }H >xQSH  WCaN }H >zRTH  WDaN } H >|SU H  WEa }ȝH(>~TVȝH( WFa P:Bulleted }HȝH(>UWHȝH((GaLI Ha Parent = UL QIa Depth = 0 }ȝH(>VXȝH( WJaN }ȝH(>WYȝH( WKaN } ȝH(>XZ ȝH( WLa }H >Y[H WMa P:Heading2 }HH >Z\HH WNaH* }H >[]H WOaN }H >\^H WPaN } H >]_ H WQa }H>^`HR! P:HeadingRuPAnIn }HH>_aHH WSaP }H>`bH WTaN }H>acH WUaN } H>bd H WVa }7H >ce7H WWa P:Indented }H7H >dfH7H WXaP }7H >eg7H WYaN }7H >fh7H WZaN } 7H >gi 7H W[a }CH>hjCH\! P:TableFootPAnote }HCH>ikHCH W]aP }CH>jlCH W^aN }CH>kmCH W_aN } CH>ln CH W`a }]H(>mo]H( Waa P:TableTitle }H]H(>npH]H((baLI ca Parent = OL Qda Depth = 0 }]H(>oq]H( WeaN }]H(>pr]H( WfaN } ]H(>qs ]H( Wga }֝H >rt֝H Wha P:BodySpaced }H֝H >suH֝H WiaP }֝H >tv֝H WjaN }֝H >uw֝H WkaN } ֝H >vx ֝H Wla }띝H >wy띝H WmaP:Date }H띝H >xzH띝H WnaP }띝H >y{띝H WoaN }띝H >z|띝H WpaN } 띝H >{} 띝H Wqa }H(>|~H(r! P:NumberedPASpaced }HH(>}HH((saP ta Parent = OL Qua Depth = 0 }H(>~H( WvaN }H(>H( WwaY } H(> H( Wxa }H >H WyaP:DateProject }HH >HH WzaP }H >H W{aN }H >H W|aN } H > H W}a }H >H W~a C:BoldItalic }HH > HH WaSTRONG }H > H WaN }H > H WaN } H > H Wa }H> H! C:EquationPA Variables }HH> HH WaEM }H> H WaN }H>H WaN } H> H Wa }H >H Wa C:Italic }HH >HH W aEM }H ?H W aN }H ?H W aN } H ? H W a }H ?H W aC:Bold }HH ?HH WaSTRONG }H ? H WaN }H ? H WaN } H ? H Wa }H?H! X:Heading & PAPage }HH?HH Wa See Also }H?H WaN }H?H WaN } H? H Wa })H ?!)H WaX:Page }H)H ? "H)H Wa See Also })H ?!#)H WaN })H ? "$)H WaN } )H ?"#% )H Wa }5H?$$&5H! X:See HeadPA ing & Page }H5H?&%'H5H Wa See Also }5H?(&(5H WaN }5H?*')5H WaN } 5H?,(* 5H W a }OH ?.)+OH W!a X:Table All }HOH ?0*,HOH W"a See Also }OH ?2+-OH W#aN }OH ?4,.OH W$aN } OH ?6-/ OH W%a }[H?8.0[H &! X:Table NumPA ber & Page }H[H?:/1H[H  W'a See Also }[H?<02[H  W(aN }[H?>13[H  W)aN } [H?@24 [H  W*a }uH?B35uH !W+a X:Heading }HuH?D46HuH!,! USE XREF PAFMT }uH?F57uH !W-aN }uH?H68uH !W.aN } uH?J79 uH !W/a }蝝H?L8:蝝H "W0a P:Header }H蝝H?N9;H蝝H"1!THROW PAAWAY }蝝H?P:<蝝H "W2aN }蝝H?R;=蝝H "W3aN } 蝝H?T<> 蝝H "W4a }H ?V=?H #W5a }HH ?X>@HH #W6a }H ?Z?AH #W7a }H ?\@BH #W8a } H ?^AC H #W9a }d ?aBFd $W:aHTML Options Table }Dd ?cDd $W;a }Dd ?eDd $W<a }D ?gCGD %W=a }DH ?iFHDH %W>a }H ?kGIH %W?a }םD ?mHJםD &W@a Image Format }DםH ?oIKDםH &WAaIMAGGIF }םH ?qJLםH &WBa }D ?sKMD 'WCaBanners }DH ?uLNDH 'WDaN }H ?wMOH 'WEa }ԝD?yNPԝD(F! Banner ReferPA ence Frame }DԝH?{OQDԝH (WGa }ԝH?}PԝH (WHa }D(?>SD((@)I! Copy Files  Imported by PA Rerefernce }DH(?>RTDH( @)WJa }H(?>SUH( @)WKa }DD ?>TVDD @*WLa }DDH ?>UWDDH @*WMa }DH ?>VXDH @*WNa }Vd ?>W[Vd @+WOaSystem Macros }?Vd ?>?Vd @+WPa }?Vd ?>?Vd @+WQa }f? ?>X\f? @,WRa Macro Name }?fH ?>[]?fH @,WSa Replace With }fH ?>\^fH @,WTa Comments }r? ?>]_r? @-WUa StartOfDoc }?rH ?>^`?rH @-WVa }rH ?>_arH @-WWa }~? ?>`b~? @.WXa EndOfDoc }?~H ?>ac?~H @.WYa }~H ?>bd~H @.WZa }??>ce?@/[! StartOfSubPADoc }?H?>df?H @/W\a }H?>egH @/W]a }??>fh?@0^! EndOfSubPADoc }?H?>gi?H @0W_a }H?>hjH @0W`a }??>ik?@1a! StartOfFirstPASubDoc }?H?>jl?H @1Wba }H?>kmH @1Wca }??>ln?@2d! EndOfFirstPASubDoc }?H?>mo?H @2Wea }H?>npH @2Wfa }??>oq?@3g! StartOfLastPASubDoc }?H?>pr?H @3Wha }H?>qsH @3Wia } ??>rt ?@4j! EndOfLastPASubDoc }? H?>su? H @4Wka } H?>tv H @4Wla }&? ?>uw&? @5Wma }?&H ?>vx?&H @5Wna }&H ?>wy&H @5Woa }8d ?>x|8d @6WpaCross-Reference Macros }?8d ?>?8d @6Wqa }?8d ?>?8d @6Wra }H? ?>y}H? @7Wsa Macro Name }?HH ?>|~?HH @7Wta Replace With }HH ?>}HH @7Wua Comments }T??>~T? @8Wva See Also }?TH?>?TH@8w! See Also: PA <$paratext> }TH?>TH @8Wxa }n? ?>n? @9Wya }?nH ?>?nH @9Wza }nH ?>nH @9W{a }d ?> d @:WaGeneral Macros }?d ?>?d @:Wa }?d ?>?d @:Wa }?d ?>?d @:Wa }? ?>"? @;Wa Macro Name d@ d@ d 靕l d@ do  W܁܁@m }蝝d @ 蝝d  <W|aHeadings Table }H蝝d @  H蝝d  <W}a }H蝝d @" H蝝d  <W~a }H@$ H =!Paragraph ForPAmat }HH@& HH  =WaHeading Level }H@( H  =Wa Comments }H@* H >W aTitle }HH@, HH  >Wa }H@. H  >Wa }KH @0 KH  ?Wa Heading1 }HKH @2 HKH  ?Wa }KH @4 KH  ?Wa }WH @6 WH  @Wa Heading2 }HWH @8 HWH  @W a }WH @: WH  @W a }cH @< cH  AW a }HcH @> HcH  AW a }cH @@ cH  AW a "d=8H}?H ?> #?H @;Wa Replace With }H ?>"$H @;WaHead }H ?>#%H @;Wa Comments }? ?>$&? @BWa }?H ?>%'?H @BW a }H ?>&(H @BW!a }H ?>')H @BW"a }d @>(.d @CW#aCharacter Macros HH;"HH❝+G܁e HH;$3HH**靕l}?d @>?d @CW$a }?d @>?d @CW%a }? @>)/? @DW&a Macro Name }?H @ >.0?H @DW'a Replace With }H @ >/1H @DW(a Comments }? @ >0<? @EW)a HUV ;.HUV ❝3G܁e HUV ;05+HUV 22靕l H$ ;1H$ 5G܁e H$ ;33H$ 44靕l HH;4HHǝ007- `Producer Consumer Problem 1,` Introduction 2܁`TThis algorithm uses ADA to solve the producer/consumer (or bounded-buffer) problem. 4V` Algorithm 5܁h`0This process (task, to ADA) manages the buffer. 6t`21 task   boundedbuffer   is 7`T2 entry   deposit ( data :  in   item ); 8`U3 entry   extract ( data :  out   item ); 9`4 end ; :`A5 task   body   boundedbuffer   is ;`U6 buffer :  array [0.. n -1]  of   item ; <`L7 count :  integer   range  0.. n  := 0; =`Z8 in ,  out :  integer   range  0.. n -1 := 0; >`9 begin ?`10 loop @`11 select A`712 when   count  <  n  => B``13 accept   deposit ( data :  in   item )  do C`;14 buffer [ in ] :=  data ; D`15 end ;  E`F16 in  := ( in  + 1)  mod   n ; F`017 count  :=  count  + 1; G`:18 or   when   count  > 0 => H`a19 accept   extract ( data :  out   item )  do I`<20 data  :=  buffer [ out ]; J`21 end ; K`H22 out  := ( out  + 1)  mod   n ; L`023 count  :=  count  - 1; M`24 end select ; N`25 end loop ; O`26 end . Q`3The producer deposits an item into the buffer with R`A27 boundedbuffer . deposit ( nextp ); S`7and the consumer extracts an item from the buffer with T`E28 boundedbuffer . extract ( nextc ); Vȝ` Comments W܁$ylines 1-4This indicates that the procedures  deposit  and  extract  may be called outside the task, and DXthat  extract  will return something in its parameter list (the  out ). X$lines 6-8As usual,  buffer  is the buffer, and  count  the number of items currently in the buffer;  in  and DWout  are the indices indicating where deposits go or where extractions come from. #Y$ lines 13-17If there is room in the buffer ( when   count  <  n ) this process will accept a request to deposit an DWitem in it ( accept   deposit   ); it then updates its variables. !Z$ lines 18-23If there is an item in the buffer ( when   count  > 0 ) this process will accept a request to extract an yitem from the buffer ( accept   extract   ); the item is returned via the parameter list. This proD#cedure then updates its variables. a[$tline 24If both of the above two  when  conditions are true, and both a producer and consumer has invoked a fprocedure named by an  accept  statement (called an open accept statement), the system will dselect one to be executed in some fair manner (such as first-come-first-serve). If only one of the HH;6HHB66 靕lH$ =!:H$ 99靕l H$ =!H$ 8W܁܁l@April 19, 1999ECS 150 Spring 1999Page 2 HUV =!8HHUV GG靕l EGxR=EGxREPwEPw TableFootnote}?H @>1=?H @EW*a }H @><H @EW+a d@??d@>d@@ 靕l d@>dR=?RUX[^adgjmpsvy| %).1 HH@vHHB[܁܁kconditions is true, and the procedure named in an  accept  statement in the body of the when state0큩qment is open, that one will be executed. If both of the  when  conditions are false, an error condition @.occurs (this usually terminates the process.) A` HH@xHH7AA 靕l HUV =!HUV ❝:W܁܁l?Last modified at 11:18 pm on Monday, April 19, 1999 HH=!:HHII 靕l HH=!HH❝HW܁܁e dLeftd!Rightd Referenced dHTMLd>HTMLd HeadingsdĿ@@ GMapping Table Title. Ŀ@@ GBody. f@ GBody. f@ G BodySpaced. Ŀ@@ GFooter. f@T G TableTitleT:Table : . f@ G Bulleted\t. f@ G...Date. mf@ Gl. DateProject. Ŀ@@ GHeader Double Line. f@T GHeading1Body. f@ G Numbered.\t. f@E G Numbered1.\tNumbered. f@ G NumberedSpaced.\t. f@ G.Reading. f@ GBody. Ŀ@@ GHeader Double Line. f@ G CellFooting. f@ G CellHeading. f@ G CellBody. Ŀ@@ GMapping Table Cell.  f@PGTitleBody. Ŀ@@Mapping Table Cell. f@$G.Line Single Line. Ŀ@@ Mapping Table Cell. Ŀ@@ GMapping Table Cell. f@ GCellBody. f@ G CellHeading. f@ G Footnote. f@T GHeading2Body. f@T G HeadingRunInBody. f@ G Indented. f@ G TableFootnote. f@T G TableTitleT:Table : .   f@PGTitleBody.  f@T GHeading1Body. f@ G .$.H.l..... .D.h.Code. f@ G .$.H.l..... .D.h.Code. Hf@ GH. LineComment. Hf@ GH. LineComment.  G GG蜜Emphasis G蜜  G GG蜜EquationVariables  蜜 BoldItalic ۸GItalic G      G G GBold    G G GZZThinMediumDoubleThick@ Very Thin HHHHHFormat A HHHHHFormat BH Mapping TableH Mapping Tableh*|#HHHHHf$*DHH+5?HH&69?HH :B?HHH CE?HH*6 ? @ h( A B C D E h  F G H I J h  K L M N O 𝝡h  P Q R S T ȝh( UVWXYh Z[\]^h_`abc7h defghChijklm]h(nopqr֝h stuvw띝h xyz{|h(}~h h    𝝡h  h h h)h  !"#$5h%&'()Oh  *+,-.[h!/ 0 1 2 3 uh "4!5!6!7!8!蝝h!#9":";"<"="h ">#?#@#A#B# %C$D$E$ $&F%G%H%ם %'I&J&K& &(L'M'N'ԝ')O(P(Q(((*@R)S)T)D )@U*V*W*V ,@X+Y+Z+f +-@[,\,],r ,.@^-_-`-~ -/@a.b.c..0@d/e/f//1@g0h0i002@j1k1l113@m2n2o224@p3q3r3 35@s4t4u4& 4@v5w5x58 7@y6z6{6H 68@|7}7~7T79@888n 8@999 ;@:::: :B@ ;";#;$;蝝 =  <<<<> ====? >>>K >@ ???W ?A @@@c @ AAA ;@%B&B'B(B D@)C,C-C CE@.D/D0D D@1E