AaEr}  @   P ``PHH $ @d HHHH̀̀̀ff@  d Footnote TableFootnote**.\t.\t/ - :;,.!?* cN&+ dTOCHeading1Heading2   PEquationVariablesF ;`<<=7=P=i=;B;D;F;H <$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++A335577A<<>>@@A;b;d;f;h;j;l;n;p;r;t;v;x;z;|;~;;;;;;;;;;;;;;;;;;;;;BB;;;;;;;;;;CC ;;;;;;;;;;;;;;;;;;;;CKCM;;;;;;;;;;<<<<<< < <<<<<<<<CC< <"<$<&<(<*<,<.<0<2<4<6<8<:<<CC<@HH  W,eH* }H ;=?H  W-eN }H ;>@H  W.eN } H ;?A H  W/a }H(;@BH(  W0e P:Numbered }HH(;ACHH(( 3eP 1e Parent = OL Q2e Depth = 0 }H(;BDH(  W4eN }H(;CEH(  W5eY } H(;DF H(  W6a }H ;EGH  W7e P:CellBody }HH ;FHHH  W8eP }H ;GIH  W9eN }H ;HJH  W:eN } H ;IK H  W;a }H ;JLH  W<eP:CellHeading }HH ;KMHH  W=eP }H ;LNH  W>eN }H ;MOH  W?eN } H ;NP H  W@a }H ;OQH  WAe P:Footnote }HH ;PRHH  WBeP }H ;QSH  WCeN }H ;RTH  WDeN } H ;SU H  WEa }H(;TVH( WFe P:Bulleted }HH(;UWHH((IeLI Ge Parent = UL QHe Depth = 0 }H(;VXH( WJeN }H(;WYH( WKeN } H(;XZ H( WLa }H ;Y[H WMe P:Heading2 }HH ;Z\HH WNeH* }H ;[]H WOeN }H ;\^H WPeN } H ;]_ H WQa }H;^`HR% P:HeadingRuPEnIn }HH;_aHH WSeP }H<`bH WTeN }H<acH WUeN } H<bd H WVa }7H <ce7H WWe P:Indented }H7H < dfH7H WXeP }7H < eg7H WYeN }7H < fh7H WZeN } 7H <gi 7H W[a }CH<hjCH\% P:TableFootPEnote }HCH<ikHCH W]eP }CH<jlCH W^eN }CH<kmCH W_eN } CH<ln CH W`a }]H(<mo]H( Wae P:TableTitle }H]H(<npH]H((deLI be Parent = OL Qce Depth = 0 }]H( H "W4a }©H <=?©H #W5e P:BodyIndent }H©H <>@H©H #W6eP }©H <?A©H #W7eN }©H <@B©H #W8eN } ©H <A ©H #W9a }»d <DZF»d F$W:aHTML Options Table }D»d <DD»d F$W;a }D»d <DD»d F$W<a }D <DCGD F%W=eControl }DH <DFHDH F%W>eValue }H <DGIH F%W?e Comments }D6<DHJD6 F&W@e Image Format }DH6<DIKDH66F&A% 0001IMAGGIF p MACP0001GIEF }H6<DJLH6 F&WBa }D <DKMD F'WCeBanners }DH <DLNDH F'WDeN }H <DMOH F'WEa }D<DNPDF(F% Banner ReferPE ence Frame }DH<DOQDH F(WGe }H<DPRH F(WHa }D(<DQSD((F)I$% Copy Files  Imported by PE Rerefernce }DH(<DRTDH( F)WJe }H(<DSUH( F)WKa }DD(<DTVDD((F*L% Copy Files  Imported by PE Reference }DDH(<DUWDDH( F*WMeN }DH(<DVDH( F*WNa }Vd <D [Vd F+WOaSystem Macros }?Vd <D?Vd F+WPa }Vd <DVd F+WQa }f? <DX\f? F,WRe Macro Name }?fH <D[?fH F,WSe Replace With }fH <D^fH F,WTe Comments }r? =D]_r? F-WUe StartOfDoc }?rH =D^?rH F-WVa }rH =DarH F-WWa }~? =D`b~? F.WXe EndOfDoc }?~H = DaR?~H F.WYa }~H = DRd~H F.WZa }?= Dce?F/[% StartOfSubPEDoc }?H=DdS?H F/W\a }H=DSgH F/W]a }?=Dfh?F0^% EndOfSubPEDoc }?H=DgT?H F0W_a }H=DTjH F0W`a }?=Dik?F1a% StartOfFirstPESubDoc }?H=DjU?H F1Wba }H=DUmH F1Wca }?=Dln?F2d% EndOfFirstPESubDoc }?H=!DmV?H F2Wea }H=#DVpH F2Wfa }?=%Doq?F3g% StartOfLastPESubDoc }?H='DpW?H F3Wha }H=)DWsH F3Wia } ?=+Drt ?F4j% EndOfLastPESubDoc }? H=-DsX? H F4Wka } H=/DXy H F4Wla }H DD_wH F5Gme C:Emphasis }H DDvxH F5GneEM }H DDwYH F5GoeN },d =8Du|,d F6WpaCross-Reference Macros }?,d =:D?,d F6Wqa },d =<D,d F6Wra }<? =>Dy}<? F7Wse Macro Name }?<H =@D|~?<H F7Wte Replace With }<H =BD}<H F7Wue Comments }H?=DD~H? F8Wve See Also }?HH=FD?HHF8w% See Also: PE <$paratext> }HH=HDHH F8Wxa }Vd ADVd F+Wye }fH AD\]fH F,WzeHead }rH AD_`rH F-W{e }hd =QD hd F:WaGeneral Macros }?hd =SD?hd F:Wa }hd =UDhd F:Wa }hd =WDhd F:Wa }x? =YD"x? F;We Macro Name d= d= d l d= d  WBm }d = d  <W|aHeadings Table }Hd = Hd  <W}a }Hd = Hd  <W~a }H= H  =WeHeading Level }HH= HH =%Paragraph ForPEmat }H= H  =We Comments }H= H >W e2 }HH= HH  >We Heading1 }H= H  >Wa }KH = KH  ?We3 }HKH = HKH  ?We Heading2 }KH = KH  ?Wa }WH = WH  @We4 }HWH = HWH  @W e Lettered }WH = WH  @W a }cH = cH  AW e4 }HcH = HcH  AW e Lettereda }cH = cH  AW a }?H A ?H  BW;e... }H AH  BW<e }? AH8?  GW@e }?xH =[D #?xH F;We Replace With }xH =]D"$xH F;W eHead }xH =_D#%xH F;W!e Comments }? =aD$&? FCW"a }?H =cD%'?H FCW#a }H =eD&(H FCW$a }H =gD')H FCW%a }d =jD(.d FDW&aCharacter Macros HHˆ;"HHˆ+Ge HHˆ;$3HHˆ**l}?d =lD?d FDW'a }d =nDd FDW(a }? =pD)/? FEW)e Character }?H =rD.0?H FEW*e Replace With }H =tD/1H FEW+e Comments }? =vD0B? FFW,e HUV ;.HUV 3Ge HUV ;05+HUV 22l H$ ;1H$ 5Ge H$ ;33H$ 44l HHˆ;4HHˆ],,7  ` Homework #2  `3Due Date:  Friday, February 4, 2000 at 11:59PM >`)Points:  80 regular, 10 extra credit O`Short-Answer Questions a`\These can be answered in a sentence or two, and are intended to reinforce important points. ms`b( 6 points ) What are the three basic components of a system nucleus? What does each do? 1`l( 6 points ) What are the three conditions any solution to the critical section problem must meet? 2 ( 6 points ) Justify the statement if the semaphore operations  up  and  down  are not executed atomically, then @Ymutual exclusion may be violated when using them to solve the critical section problem. 0]`Long-Answer Questions 3 tThese questions require some thought and longer answers than the short-answer questions. They are intended to have ɑ@`you use the concepts discussed in class, to be sure you understand them and can work with them. 4*`l( 25 points ) Two processes  p 0  and  p 1  share the following variables: = UE`n1. var  flag : array [0..1]  of   boolean ; (* initially false *) AUE`2. turn :0..1; B*`/The algorithm below is for process  p i  ( i  = 0 or  i  = 1) with  p j  ( j  = 1 or  j  = 0) being the other process. C  *`3. repeat D*`*4. flag [ i ] := true; E`@5. while   turn   i  do  begin F`N6. while   flag [ j ]  do  (* nothing *); G`%7. turn  :=  i ; H`8. end ; I`9.(* critical section *) J`,10. flag [ i ] := false; K`11.(* remainder section *) L`12. until  false; 9{A rDoes this algorithm correctly implement critical sections? Either prove that it does, or prove that at least one @@condition is not met 5" t( 12 points ) Consider the implementation of monitors by semaphores (see the handout  Monitors and Sema" rphores ). Under each of the following assumptions the code implementing the monitor may be simplified. Show @the new code in each case: 6n`GThe monitor contains no  wait  or  signal  operations. 7n`yThe use of  signal  is restricted such that it may occur only as the  last  instruction of any monitor. :л x( 25 points ) (The Model Builders Problem) Consider a system with three model airplane building processes and 0ܻqone agent process. Each building process requires a tube of glue, a piece of newspaper, and a model kit to put a rmodel airplane together. One of the processes has tubes of glue, another pieces of newspaper, and the third model vkits. The agent has an infinite supply of all three. The agent places two of the ingredients for the model builders non the table. The process who has the remaining ingredient can then build one model airplane. It signals the sagent upon completion. The agent then puts out another two of the three ingredients and the cycle repeats. Write @Ta program to synchronize the agent and the model building processes using monitors. ?2` Extra Credit A n( 10 points ) Consider a computer that does not have a TEST AND SET LOCK instruction but does have an pMrinstruction to swap the contents of a register and a memory word in a single indivisible action. Can that be used @pto write a routine  enter_region  such as the one found in Fig. 2-10? (text, chapter 2, problem 9)  HHˆ;6HHˆ66 l}?H A!9?H  GWMe- }H A8H  GWNe }? AKG?  HWOe d;;<@H$ ;<;>H$ == l H$ ;=;H$ <Wl8January 25, 2000ECS 150 Winter 2000Page 1  HUV ;>;<@HUV ?? l HUV ;?;HUV >Wl@Last modified at  9:43 am on Monday, January 24, 2000  HHˆ;@;>HHˆAA l HHˆ;A;HHˆ@W` }?H =xD1C?H FFW-e¢ }H =zDBH FFW.a d=~EEd=Dd FF l d=Dd eCE e`[vCFILORU X[^adgjmpsy| %).1OLI:!}?H A:H?H  HWPe-- }H AG!H  HWQe }? ANJ?  IWRe }?H AIK?H  IWSe° }H AJ:H  IWTe }? AQM?  JWUe }?H ALN?H  JWVe® }H AMIH  JWWe }? AP?  KWXe }?H AOQ?H  KWYe© }H APLH  KWZe }~H ADbc~H F.W[e }HBDefH F/W\e }HBDhiH F0W]e }HBDklH F1W^e }HBDnoH F2W_e }HB DqrH F3W`e } HB Dtu H F4Wae }H DDxZH F5GbeN }H DDYCH F5Gce }H DDd\H F9Gde C:Computer }H DD[]H F9GeeEM }H DD\^H F9GfeN }H DD]_H F9GgeN }H DD^vH F9Ghe }H(DDiaH( FLGie P:Romani }H(DD`bH((FLjeLI e Parent = OL Ae Depth = 0 }H(DDacH( FLGkeN }H(DDbdH( FLGleN }H(DDc[H( FLGme }H(DDfH( FMGneP:Roman }H(DDegH((FMoeLI e Parent = OL Ae Depth = 0 }H(DDfhH( FMGpeN }H(DDgiH( FMGqeN }H(DDh`H( FMGre }H DskH NGseP:Line }H DjlH NGteP }H DkmH NGueN }H DlnH NGveN }H DmH NGwe }H DxpH OGxe P:Lettereda }H DoqH OGyeH* }H DprH OGzeN }H DqsH OG{eN }H DrjH OG|e }H D}uH PG}e P:Lettered }H DtvH PG~eH* }H DuwH PGeN }H DvxH PGeN }H DwoH PGe }HDzHQg% P:CodeComEment }HDy{H QGeP }HDz|H QGeN }HD{}H QGeN }HD|tH QGe }H DH RGeP:CodeC }H E~H RGeP }H EH RG eN }H EH RG eN }H EyH RG e }H E BH SG e P:CodeASM }H E H SGeP }H E H SGeN }H EH SGeN }H E~H SGe dE  dEddO OLI:!dEdE  l}DED DFTg% CSS Export E Encoding }HED H FTGe }HED XH FTGe }DEDWDFUg% Export EnEcoding }HEDH FUGe }HED H FUGe }HF H  VGe1 }HF H VG eTitle }HF H  VGe dLeftd;Rightd ReferenceddHTMLdDHTMLd HeadingsdHTML @@ QMapping Table Title. @@ QBody.  f@PQTitleBody. $f@L Q$. Lettereda L:.. @@ QFooter. f@T Q TableTitleT:Table : . $f@L Q$. LetteredL:.. @@ QMapping Table Cell. @@QMapping Table Cell. f@T QHeading1Body. L̀Lf@N Q Numbered N:.< =1>. f@ QBody. @@ QHeader Double Line. f@ Q CellFooting. f@ Q CellHeading. f@ Q CellBody. @@ QMapping Table Cell. @@/Mapping Table Cell. @@ /Mapping Table Cell. @@ QMapping Table Cell. f@   $.6.Z.~..CodeC. f@ QBody. f@T QHeading2Body. f@  $.6.Z.~..CodeC. f@ Q NumberedSpaced. f@ Q NumberedSpaced. f@ Q BodySpaced. f@ Q Bulleted\t. f@ Q...Date. mf@ Ql. DateProject. @@ QHeader Double Line. f@T QHeading1Body. 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@NE Q Numbered1 N:.Numbered. $f@L Q$. Lettereda L:.. $f@L Q$. LetteredL:.. L̀Lf@N Q Numbered N:.< =1>. 6$f@R Q6. Romani R:.. 6$f@R Q6. RomanR:.. %f@ Q BodyIndent. f@  $.6.Z.u..CodeASM. Hf@ QH.. CodeComment.  Q QQ Q / Q ڝQQEmphasis Q   QEquationVariables ڝQ /  BoldItalic QItalic QBold Q/ Q   Q Q QQ   ComputerZZThinMediumDoubleThick@ Very Thin HHHHHFormat AH Mapping Table HHHHHFormat BH Mapping Tableh6:5HHHHH$TDHH+4?HHH68?HH :C?HHHTDB?HH*H ? @ 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(nopqrh stuvwh 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 "S>#?#@#A#B#» %FC$D$E$ $&FF%G%H%6%'FI&J&K& &(FL'M'N'')FO(P(Q(((*FR)S)T)D()UFU*V*W*Vd ,FX+Y++Z+f +-F[,\,,],r ,.F^-_--`-~ -/Fa.b.R.c..0Fd/e/S/f//1Fg0h0T0i002Fj1k1U1l113Fm2n2V2o224Fp3q3W3r3 3Fs4t4X4u4h 9Fv5w5x5Y5Z5,d 7Fy6z6{6< 68F|7}7~7H7F888h L5F[9\9]9^9_9hd ;F::::x :CF ;";#;$; =  <<<<> ====? >>>K >@ ???W ?A @@@c @V AAA G BB B ;F%C&C'C(Cd EF)D,D-D DFF.E/E0E EKF1FBFCF HB !G8G9G IG :HGHHH JH IIJIKI KI LJMJNJ FJ OKPKQKh(M9F`LaLbLcLdLh(NLFeMfMgMhMiMh OMjNkNlNmNnNh PNoOpOqOrOsOh QOtPuPvPwPxPhRPyQzQ{Q|Q}Qh SQ~RRRRRh #RSSSSSUF T T T*TFUUUA VVVComment ;C ;Gd BlackT!WhiteddARedddGreendd 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.Courier.PCourier FrameRoman M.Courier.B Courier-Bold FrameRomanM.Helvetica.BIHelvetica-BoldOblique FrameRoman M.Times.I Times-Italic FrameRoman M.Courier.ICourier-Oblique FrameRoman FrameRomanbCourier. HelveticaPTimes!Regular$Roman MediumBoldRegular ObliqueItalic,#ՑF:o:{!u+ l7#bu$j~m>ccn%*S@v' jK1DZL%ݾC9o=S$s4G&$wج=͊;ٜEZNmS+u̗%GSV4Q)\0ч