Aatrd}   PP @p Ppp`P``PHH $ @d HHHHff@  d Footnote TableFootnote**.\t.\t/ - :;,.!?cZ+%cZTOCHeading1Heading2   PEquationVariables@>@@3@v@@@>>>>>> <$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++AJJLL33557 ANNA>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>?????? ? ? ??????????!?#?%?'?)?*?+?-?/?1?3?5?7?9?;?=???A?C?E?G?I?K?M?O?Q?S?U?W?Y?[?]?^?_?a?c?e?g?i?k?m?o?q?s?u?w?y?{?}?~?????????????????????????????????????????????????????????????????@@@@@ @ @@@@@@@@@@ @"@$@&@(@*@,@.@0@2@5@7@9@;@=@?@A@C@E@G@I@K@M@O@Q@S@U@W@Y@[@]@_@a@c@e@g@i@k@m@o@q@s@u@x@z@|@~@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@;#@@@;/;2>$@@@@@@@@@@@@@@@@>=>>>?>@>A>B>C>D>E>F>G>H>I>J>K>L>M>6>b>c>d>e>>>>N>O>P>Q>R>S>T>U>V>W>X>Y>Z>[>f>g>h>idq5+d= 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,܁܁Bm }蝝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 >/1QH WaN } QH >02 QH Wa }]H >13]H WaP:Body }H]H >24H]H W aP }]H >35]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(>8:iH( W(aN }iH(>9;iH( W)aY } iH(>:< iH( W*a }띝H >;=띝H  W+a P:Heading1 }H띝H ><>H띝H  W,aH* }띝H >=?띝H  W-aN }띝H >>@띝H  W.aN } 띝H >?A 띝H  W/a }H(>@BH(  W0a P:Numbered }HH(>ACHH(( 1aP 2a Parent = OL Q3a Depth = 0 }H(?BDH(  W4aN }H(?CEH(  W5aY } H(?DF H(  W6a }H ?EGH  W7a P:CellBody }HH ? FHHH  W8aP }H ? GIH  W9aN }H ?HJH  W:aN } H ?IK H  W;a }H ?JLH  W<aP:CellHeading }HH ?KMHH  W=aP }H ?LNH  W>aN }H ?MOH  W?aN } H ?NP H  W@a }H ?OQH  WAa P:Footnote }HH ?PRHH  WBaP }H ? QSH  WCaN }H ?"RTH  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(?0XZ ȝH( WLa }H ?2Y[H WMa P:Heading2 }HH ?4Z\HH WNaH* }H ?6[]H WOaN }H ?8\^H WPaN } H ?:]_ H WQa }H?<^`HR! P:HeadingRuPAnIn }HH?>_aHH WSaP }H?@`bH WTaN }H?BacH WUaN } H?Dbd H WVa }7H ?Fce7H WWa P:Indented }H7H ?HdfH7H WXaP }7H ?Jeg7H WYaN }7H ?Lfh7H WZaN } 7H ?Ngi 7H W[a }CH?PhjCH\! P:TableFootPAnote }HCH?RikHCH W]aP }CH?TjlCH W^aN }CH?VkmCH W_aN } CH?Xln CH W`a }]H(?Zmo]H( Waa P:TableTitle }H]H(?\npH]H((baLI ca Parent = OL Qda Depth = 0 }]H(?`oq]H( WeaN }]H(?bpr]H( WfaN } ]H(?dqs ]H( Wga }֝H ?frt֝H Wha P:BodySpaced }H֝H ?hsuH֝H WiaP }֝H ?jtv֝H WjaN }֝H ?luw֝H WkaN } ֝H ?nvx ֝H Wla }띝H ?pwy띝H WmaP:Date }H띝H ?rxzH띝H WnaP }띝H ?ty{띝H WoaN }띝H ?vz|띝H WpaN } 띝H ?x{} 띝H Wqa }H(?z|~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 ?*,HOH W"a See Also }OH ?+-OH W#aN }OH ?,.OH W$aN } OH ?-/ OH W%a }[H?.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?35uH !W+a X:Heading }HuH?46HuH!,! USE XREF PAFMT }uH?57uH !W-aN }uH?68uH !W.aN } uH?79 uH !W/a }蝝H?8:蝝H "W0a P:Header }H蝝H?9;H蝝H"1!THROW PAAWAY }蝝H?:<蝝H "W2aN }蝝H?;=蝝H "W3aN } 蝝H?<> 蝝H "W4a }H ?=?H #W5a }HH @>@HH #W6a }H @?AH #W7a }H @@BH #W8a } H @AC H #W9a }d @ BFd $W:aHTML Options Table }Dd @ Dd $W;a }Dd @ Dd $W<a }D @CGD %W=a }DH @FHDH %W>a }H @GIH %W?a }םD @HJםD &W@a Image Format }DםH @IKDםH &WAaIMAGGIF }םH @JLםH &WBa }D @KMD 'WCaBanners }DH @LNDH 'WDaN }H @MOH 'WEa }ԝD@!NPԝ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 @1>VXDH @*WNa }Vd @4>W[Vd @+WOaSystem Macros }?Vd @6>?Vd @+WPa }?Vd @8>?Vd @+WQa }f? @:>X\f? @,WRa Macro Name }?fH @<>[]?fH @,WSa Replace With }fH @>>\^fH @,WTa Comments }r? @@>]_r? @-WUa StartOfDoc }?rH @B>^`?rH @-WVa }rH @D>_arH @-WWa }~? @F>`b~? @.WXa EndOfDoc }?~H @H>ac?~H @.WYa }~H @J>bd~H @.WZa }?@L>ce?@/[! StartOfSubPADoc }?H@N>df?H @/W\a }H@P>egH @/W]a }?@R>fh?@0^! EndOfSubPADoc }?H@T>gi?H @0W_a }H@V>hjH @0W`a }?@X>ik?@1a! StartOfFirstPASubDoc }?H@Z>jl?H @1Wba }H@\>kmH @1Wca }?@^>ln?@2d! EndOfFirstPASubDoc }?H@`>mo?H @2Wea }H@b>npH @2Wfa }?@d>oq?@3g! StartOfLastPASubDoc }?H@f>pr?H @3Wha }H@h>qsH @3Wia } ?@j>rt ?@4j! EndOfLastPASubDoc }? H@l>su? H @4Wka } H@n>tv H @4Wla }&? @p>uw&? @5Wma }?&H @r>vx?&H @5Wna }&H @t>wy&H @5Woa }8d @w>x|8d @6WpaCross-Reference Macros }?8d @y>?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܁܁Bm }蝝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 @ KH  ?Wa Heading1 }HKH @ HKH  ?Wa }KH @ KH  ?Wa }WH @ WH  @Wa Heading2 }HWH @ HWH  @W a }WH @ WH  @W a }cH @ cH  AW a }HcH @ HcH  AW a }cH @ cH  AW a HH=HHŝ  E܁܁@L( down ( mutex ) ) and proceeds to read from the file. m큩 xlines 16-20Now the reader is done reading the file (for now.) It must update the value of  readcount  to indi0zcate this, so it waits until no-one else is accessing that variable ( down ( mutex ) ) and then decrexments  readcount . If no other readers are waiting to read ( readcount  = 0 ), it signals that any reader or writer who wishes to access the file may do so ( up ( wrt ) ). Finally, it indicates it is done @?with  readcount  ( up ( mutex ) ). n`_line 24Since the file is not accessed here, we don't need to put semaphores around this part. !o lines 25-26The writer process waits ( down ( wrt ) ) until no other process is accessing the file; it then proceeds @to write to the file. ap nline 27When the writer is done writing to the file, it signals that anyone who wishes to access the file may D*do so ( up ( wrt ) ). HH=HH7 靕l}?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 `First Readers Writers Problem ,` Introduction ܁`LThis algorithm uses semaphores to solve the first readers-writers problem. V` Algorithm 0܁h`71 var wrt ,  mutex : semaphore; 1t`6 2  readcount :  integer ; 2` 3 begin 3`( 4  readcount  := 0; 4`" 5  wrt  := 1; 5`$ 6  mutex  := 1; 6` 7 parbegin 7`6 8  repeat (* reader process *) 8`" 9 (* do something *) 9`1 10  down ( mutex ); :`@ 11  readcount  :=  readcount  + 1; ;`? 12  if   readcount  = 1  then <`0 13  down ( wrt ); =`/ 14  up ( mutex ); >`$ 15 (* read the file *) ? `, 16 down ( mutex ); @`@ 17  readcount  :=  readcount  - 1; _`? 18  if   readcount  = 0  then ``. 19  up ( wrt ); a`/ 20  up ( mutex ); b`+ 21  (* do something else *) c`& 22  until  false; d`7 23  repeat (* writer process *) e`# 24 (* do something *) f`/ 25  down ( wrt ); g`( 26 (* write to the file *) h`- 27  up ( wrt ); i`( 28 (* do something else *) j`& 29  until  false; k` 30 parend ; l` 31 end . Aȝ` Comments B܁ zlines 1-2Here,  readcount  contains the number of processes reading the file, and  mutex  is a semaphore 0cused to provide mutual exclusion when  readcount  is incremented or decremented. The semalphore  wrt  is common to both readers and writers and ensures that when one writer is accessing the @-file, no other readers or writers may do so. !C lines 4-6This just initializes all the semaphores. It is the only time anything other than a  down  or an  up  noperation may be done to them. As no readers are yet reading the file,  readcount  is initialized to @0 . D`^line 9Since the file is not accessed here, we don't need to put semaphores around this part. !E ulines 10-15Since the value of the shared variable  readcount  is going to be changed, the process must wait wuntil no-one else is accessing it ( down ( mutex ) ). Since this process will read from the file,  mreadcount  is incremented by 1; if this is the only reader that will access the file, it waits until any B~writers have finished ( down ( wrt ) ). It then indicates other processes may access  readcount  HH;6HH 66 靕l EGxR>EGxREPwEPw TableFootnote}?H @>1=?H @EW*a }H @><H @EW+a d@??d@>d@@ 靕l d@>dR=?RUX[^adgjmpsvy| %).1d>yJNH$ >zILH$ KK靕l H$ >{IH$ JWF܁܁h@April 22, 1999ECS 150 Spring 1999Page 1 HUV >|IJNHUV MM靕l HUV >}IHUV ❝LWG܁܁l?Last modified at 10:37 pm on Monday, April 19, 1999 HH>~ILHHOO 靕l HH>IHH❝NWH܁܁e dLeftdIRightd ReferenceddHTMLd>HTMLd HeadingsdĿ@@ QMapping Table Title. Ŀ@@ QBody.  f@PQTitleBody. f@T QHeading1Body. Ŀ@@ QFooter. f@T Q TableTitleT:Table : . f@ Q .$.H.l..... .D.h.Code. Hf@ QH. LineComment. f@ QBody. Ŀ@@ QHeader Double Line. f@ Q CellFooting. f@ Q CellHeading. f@ Q CellBody. Ŀ@@ QMapping Table Cell. f@ QBody. Ŀ@@/Mapping Table Cell. f@ Q BodySpaced. Ŀ@@ /Mapping Table Cell. Ŀ@@ QMapping Table Cell. f@ Q Bulleted\t. f@ Q...Date. mf@ Ql. DateProject. Ŀ@@ QHeader Double Line. f@T QHeading1Body. f@ Q Numbered.\t. f@E Q Numbered1.\tNumbered. f@ Q NumberedSpaced.\t. f@ Q.Reading.  f@PQTitleBody. f@$Q.Line Single Line. f@ QCellBody. f@ Q CellHeading. f@ Q Footnote. f@T QHeading2Body. f@T Q HeadingRunInBody. f@ Q Indented. f@ Q TableFootnote. f@T Q TableTitleT:Table : . f@ Q .$.H.l..... .D.h.Code. Hf@ QH. LineComment.  Q QQ Q蜜 / Q Q Q   Q Q/ Q   )  QQ蜜EmphasisQ蜜EquationVariables / 蜜 BoldItalic ۸QItalic QBoldZZThinMediumDoubleThick@ 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>>d BlackT!WhiteddARedddŝGreendd BluedCyandMagentad YellowHeader/Footer $1Header/Footer $1Header/Footer $2Header/Footer $2IndexIndexCommentCommentSubjectSubjectAuthorAuthorGlossaryGlossaryEquationEquation Hypertext Hypertext  Cross-Ref Cross-Ref Conditional TextConditional TextPositionFMPrivatePositionFMPrivateRangeEndFMPrivateRangeEndFMPrivate HTML Macro HTML Macro M.Times.P Times-Roman FrameRoman M.Times.B Times-Bold FrameRoman M.Helvetica.BHelvetica-Bold FrameRoman M.Times.I Times-Italic FrameRoman M.Courier.ICourier-Oblique FrameRoman M.Courier.PCourier FrameRoman M.Geneva.PGeneva FrameRomanM.Helvetica.BIHelvetica-BoldOblique FrameRomanbCourier(Geneva. HelveticaPTimes!Regular$Roman MediumBoldRegular ObliqueItalicfRO ۢw!cfC`Y~ިrH}2fQ?9J< z54VNn .1 SI`OѳIhorڴ&bq/w\urZbRӣZ vEz|