WordProLWP7.a YƤ1yWord Pro Text File/DFBAB@PPPPP-PPP@Jeffab?G<4c<I@@@ @ SmartMasterH@ASMH@EJeffabH@@JXP p@@UNIVERSAL_SMARTMASTER_EDITOR@ESMX@@@q pcPP`@@q pcPP` @UNIVERSAL_ALL_OTHERS_EDITOR@FOTRX@@@q pcPP`@@q pcPP` @FJeffab@DJX@@@q pcPP`@@q pcPP`B@QCB PP p  q@Tp= yqp~ qPHPHPHPH(x qQdIZ+!!xBz$Bp= A!@B?Bp= APHBPHBgf ( xAQdHHAQdHHq ~APHBgf PHB(e AAk qAy}-?@En8xP@P@@@ P@@@P @@@PpP@@@Pps>LH @@@d*plC|@@@"q!@@ @@P@c xpp  @@@PppP @@@ fqcP`R@d H@dZZ Z Z Z pH@PZ  pH@P pH@P pH@P pH@PZZZZ(( /!("(# ($(%(&('Z(3Z)Z*Z,Z-fZ.cZ/dZ0eZ17Z2$Z3Z4?Z5Z6nZ7*Z8 #Z9 %Z:Z;Z Z Z >H@@ ??X@P`@@P`@@Pp@P`@@Hx``@@Hx``PC q@@P@ xA yx@Hx@Hx@Hx@Hx` % x@@@Q $$ %yy'ABBBBRBBB A&PHPH q %@@@@Q  A]Ay- }Ex$ ?}pExP:An@P@P@@@ P@@@P @@@ X@@@Pp>!A*@EH@ Default Textlq@@@@P |C@@@P !"AO@@ @@P@3 &tB?7@-@<@Pc@P c@P c@P |p@@@P *>pEH @ Heading 1 #Ox@@@P@A@Aj& $ p`@x@%]A$Az ABff4&A3Bz$Bz*&  p`@x@]A%AHHPHA s-ExP:A@P@P@@@ P@@@P @@@ P@@@PpO!A #@@ @@P@ A%@p@ q@AJBABffbff,7q@P@P@@@ P@@@P @@@PpP@@@  Aff, ABffbff€BBBH$@P@P P P  DADxQE @QDs%D@@EBodytBPP@EBody@p F V uAuxpA@P#AyU@@Default FooterXA@BQJA +AP@EFooter %A@@@Default Footer Styleh$@aAAAyA@ @YAfAdAe@ XQ$@c .Y +u@pA@B PRA =A +P@EFooterI /A#A %Iyy@ @Y XQ@c /* BA ,yd@Q . $@FStory BA ,Y 0A 0AmU AxpA@Pq#yU@@Default HeaderXA@BQJPA#AP@EHeader A@@@Default Header Styleh$@aAAAyA@ @YAfAdAe@ XQ@c +Xq .yu@pA@B PRPA .A#P@EHeaderI ,AA Iyy@ @Y XQ@c ,, /Bqd@Q + $@FStory /BQ -A -Amu .A +AV@@ Default PageQA@JIXA @CPageH@@Default Page Styleh$@@ Default TextIxAA~AyAc@ iAfAdAe@ @Printer Folder SettingH$@@ &d@Q ,@FStory D ; mT AxpA@P CU =@pH@B PRy =P@EFooterI HA#A %Iyy@ @Y XQ@c H*8A Byd@Q C @@FStory8A BY IA IAm =Wq Cy@pH@B PRPA CA .P@EHeaderI BAA Iyy@ @Y XQ@c B* HA /yd@Q = @@FStory HA /Y KA KAm@ CA =AT@iH@IAAuP@CPageIAu+ A p@t q@@PE  mTffA@DR@ @ @ 1)ExX 4.5 p 89SSEnd KPAmT(A B@ASSEnd/d B wp @mzqk@ Default TextP@@@i@@Default Text Style@@@pE A@x`aAnD}AA"x@@@PP@@@  r H@@a  IPAmT(A H@ASSEnd { AHZmT(A@BWThe idea is to modify the bakery algorithm to serve exactly 2 customers simultaneously.SSEnd  B @0ZmT(A@ASSEnd  A I0KmT(A@BInitiallFy @ @ @ Number[i] = 0 and @ @ @ choosing[i] = false for I, 0<= I <= n-1SSEnd  A IRmT(A@ASSEnd 7 A IKmT(A@D@ @ @ SSEnd G A IKmT(A@D@ @ @ Choosing[i] := trueSSEnd  A I KmT(A@D@ @ @ Number[i] := @ @ @ max(Number[0],...,E @ @ @ Number[n-1])E + 1SSEnd H A I(KmT(A@D@ @ @ Choosing[i] := falseSSEnd F A I,RmT(A@B"For j :=1 to n (except j = I ) doSSEnd Y A I.KmT(A@AJ Wait until @ @ @ choosing[j] = falseSSEnd   I/KmTffA@AJ Wait until @ @ @ number[j] = 0 or @ @ @ E(@ @ @ number[j]@ @ @ E,j)E XE+ 1G > @ @ @ (number[i],E @ @ @ Fi)XC SSEnd a  I/RmT(A@AJ://the previous line could be >= instead of adding 1, but ISSEnd k  A/RmT(A@AJD//believe if you do the +1 you could have more than 2 A MbakersC SSEnd   A/KmT(A@AJ//note that this is @ @ @ dependan on the @ @ @ Ealg adding exactly 1 to the @ @ @ DmaxSSEnd Q B A/KmT(A@AJ//when choosing @ @ @ Number[i]SSEnd 5 B A/KmT(A@D@ @ @ ESSEnd E A I/KmT(A@D@ @ @ SSEnd B A I/KmT(A@D@ @ @ Number[i]F := 0SSEnd ; A I/KmT(A@D@ @ @ SSEnd  A I/RmT(A@ASSEnd   I0KmT(A@DR@ @ @ 2)ExXW 4.6 P 89 Do a rigorous proof by contradiction using the formal definition of deadlock.sSEnd   I0RmT(A@ASSEnd   A0KmTQA@BNo Deadlock is defined @ @ @ Gas:if at least one @ @ @ FprocB tries to enter CS then one will eventually succeed as long as no @ @ @ Fproc stays in CS forever.SSEnd ! ) A0RmT(A@ASSEnd )I 3 A0RmT(A@B$Assume that deadlock has occurred...SSEnd 3O 7 )A0RmT(A@B*Then Either p0 or p1 cannot enter the CS..SSEnd 7E ; 3A0RmTffA@DXCase p0 cannot enter the CS:SSEnd ;u ? 7A0 KmT(A@AJ%That means that we are waiting until @ @ @ Want[1] = 0 forever.SSEnd ? C ;A0 KmT(A@AJFor @ @ @ Want[1]: to stay 0 forever, you must be within steps 3 and 5 of p1SSEnd Cd G ?A0 RmT(A@AJSSEnd   AKmT(A@BG2: @ @ @ GNum@ @ @ ber[i] := @ @ @ max(Number[0],...@ @ @ ,Number[n - 1]) + 1SSEnd S  A/KmT(A@B4: for j := 1 to @ @ @ n(!=i)D doSSEnd   A/KmT(A@BC6:J wait until @ @ @ Number[j] = 0 or @ @ @ (Number[j], j) > @ @ @ (Number[i],E I )SSEnd 5  A/ KmT(A@D@ @ @ ESSEnd 7 $ A/!KmT(A@D@ @ @ GSSEnd $J * A/"KmT(A@BG7: @ @ @ Number[i]F := 0SSEnd *! 4 $A/#RmT(A@ASSEnd 4  *A#KmT(A@B Assume 3 @ @ @ GprocsE @ @ @ Dpx and @ @ @ Dpy and @ @ @ Dpz.SSEnd W _ 4AT$KmT(A@D@ @ @ Number[n] for all n is initially 0SSEnd _!  A$RmT(A@ASSEnd   _Av%KmT(A@D@ @ @ Dpy; runs to line 2 and blocks but only after it has read that @ @ @ number[x]F = 0.SSEnd   A%KmT(A@D@ @ @ Ep@ @ @ Cx run to line 2 and chooses @ @ @ number[x]E = 1SSEnd o  A'KmT(A@D@ @ @ DPx continues @ @ @ Fthru line 6 and enters CS.SSEnd r  A(KmT(A@D@ @ @ DPx completes CS and resets @ @ @ number[x]G to 0.SSEnd   A=)KmT(A@D@ @ @ EP@ @ @ Cz starts and sets @ @ @ number[z] to 1 and continues @ @ @ Fthru line 6 and enters its CSSSEnd   Ay)KmT(A@D@ @ @ DPx retries entry into @ @ @ Ecs, it goes @ @ @ Fthru line 2 and assigns @ @ @ number[x]E :=2SSEnd m  )I mT(A@D@ @ @ DPz completes, sets @ @ @ number[z]F to 0SSEnd   A)KmT(A@D@ @ @ DPx& continues to line 6 and enters CS as @ @ @ number[x] is still 0.SSEnd   A)KmT(A@D@ @ @ EP@ @ @ Cy' resumes, completing its assignment of @ @ @ number[y]F := 1SSEnd u  A)KmT(A@BSince @ @ @ number[x] = 2, @ @ @ Dpy will enter the CSSSEnd !  A)RmT(A@ASSEnd ) C A6*KmT(A@BD4) SSEnd >  A*YmTR A@CHHShared variables:HcSEndj / ~  @ Anchor (A)P@@@@Y@x`A i  @A*YmTR A@CHHHcSEnd N  A*HAmTR A@CHH 1. x := HB@ @ @ DiHcSEnd g  A*HAmTR A@CHH2. if y != 0 then HB@ @ @ GgotoHHF 1.HcSEnd 8  A*YmTR A@CHH 3. y := 1HcSEnd   A*HAmTR A@CHH 4. if x != HB@ @ @ DiHH then HB@ @ @ GgotoHHF 1.HcSEnd $  A*YmTR A@CHcSEnd D  A*HAmTR A@CHB@ @ @ HcSEnd $  A*YmTR A@CHcSEnd @  A*HAmTR A@CHB@ @ @ HcSEnd 8  A*YmTR A@CHH 5. y := 0HcSEnd $  A*YmTR A@CHcSEnd A  A*HAmTףA@CHB@ @ @ SSEnd '  A*RmT(A@BCa)SSEnd  # A6+KmTffA@DX Does the R@ @ @ GalgX satisfy R@ @ @ mutexX property?SSEnd # < A+KmT(A@BYes - unless 2 @ @ @ Gprocs= started out in the CS initially which is not the case above.SSEnd <i ^ #A+KmT(A@BAssume @ @ @ Gprocs$ p1 and p2 are in CS simultaneously,SSEnd ^} c <A,RmT(A@BWtherefore immediately before entering the CS, x must have been 1 for p1 and 2 for p2..SSEnd c! h ^A-RmT(A@ASSEnd h m cA.KmTQA@B0If it was 1 for p1, then p2 must have executed @ @ @ Gline13 after p1 executed line 4 to change the value of x.SSEnd m  hA/KmTFA@B'But then p2 would have had to continue @ @ @ Fthru line 2 before it could enter its CS and it would have found that y != 0 because line 3 of p1 had to execute before line 4 of p1 did, and the only way to reset y to 0 is if line 5 of a @ @ @ Fproc1 is executed, but line 5 cannot execute unless a @ @ @ Fproc is leaving its CS. Therefore @ @ @ Gproc2R would not have continued to line 3 and instead would have looped to line 1 again.SSEnd !  mA0RmT(A@ASSEnd }  A1KmTffA@BGb) X does the R@ @ @ GalgX" satisfy the no deadlock property.sSEnd (  A2RmT(A@BDNo.SSEnd @  AV3KmT(A@D@ @ @ FInit y = 0;SSEnd N  A3RmT(A@B)P1 completes line 1 & 2 &3 (x = 1, y = 1)SSEnd K  A4RmT(A@B&P2 completes line 1 & 2 (x = 2, y = 1)SSEnd W  A5RmT(A@B2P1 Completes line 4 and 1 ( x = 2...x = 1, y = 1)SSEnd M  AV6RmT(A@B(P2 completes line 1 and 2 (x = 1, y = 1)SSEnd @  A6RmT(A@BP1 completes line 2 (y =1)SSEnd M  A6RmT(A@B(P2 completes line 1 and 2 (x = 2, y = 1)SSEnd Q  6I mT(A@B(P1 completes line 1 and 2 (x = 1, y = 1)SSEnd k  A6KmT(A@B....cycle last 2 lines @ @ @ forever.....deadly embrace!SSEnd q  A6RmT(A@BKBoth wanting to enter CS, but nothing exists to force eventuality of entry.SSEnd !  A6RmT(A@ASSEnd !  A6RmT(A@ASSEnd  B A6KmTQA@D@ @ @ 5)Modify the @ @ @ RightLeftDPe algorithm for the Dining Philosophers problem covered in class to handle an odd number of processes.SSEnd   )I7KmTQA@D@ @ @ 6)ExerciseJ 5.5 page 124. Algorithm 5.4 has few errors: replace by "r" the first two @ @ @ G"k"'sB in line starting with "round", and replace "k" by "r" and "f" by @ @ @ G"f/k" in line 4.SSEnd  ! # AV8RmT(A@ASSEndt t ZLZP:ZN Z ~W AxpA@PX AxpA@P\[u^_`abZKZQb(Ru(S CM v(e(f wc(g(h(i(j]##AyU@@ Default FrameQ A@IQXAAP@DFrameH@@Default Frame Styleh$@@ Default TextIAAAAc@ @YAfAdAe@ A]@ 0PAm /@ASSEndU@@Default Drop CapQ A@IQXAAP @FDropCapIAxH@@Default Drop Cap Styleh$@@ Default TextI&AAAyA@!AfAdAe@ X@Dzb%@@ ) ,Bqd@d@FStory ,BWm -PAm ,@ASSEnd 'Ayd@d@FStoryAYAAm 8' w Hyd@d@Story w HY9A9Am w"q8yd@h@DStoryq8_ x xmk0mAo@ Note Initials`P@Y@x`al2 7 ! ; ^ A8RmT(A@ASSEnd y\ @CURLO@Mhttp://nob.cs.ucdavis.edu/~bishop/classes/ecs150-1999-spring/sync-bakery.html  s sj ~.B  @ ClickHereP@@@@Y@x`A)\j 3 @Viewed Anchor (A)P@@@@Y@x`Aff #  *  A8KmTz*A@BDefine the K-set consensus @ @ @ Gprob: Each @ @ @ Fproc starts with arbitrary @ @ @ Eint value @ @ @ Dxi and should output an @ @ @ Eint value @ @ @ Dyi such that y is member of @ @ @ {x0...x@ @ @ Fn-1}$ and the number of different output @ @ @ Fvals is at most k.SSEndZ :1@Engineering NumberingI8@ OXmqW@@ Default TableQH@@RB0PAAP @ SuperTableH@@Default Table StyleAy@. A@_X@@Default Right ColumnQ@H@@@QH0@AAP@CCellX$@@ Default Texty@!qyX@@ Default CellQAA@@@R@0@AAP@CCellH@@Default Table Cell Styleh$@ @ Table TextI3AAAA@7Ay[AyX@@Default ColumnQ@H@@@QH0@AAP@CCellX$@@ Default Texty@!`AyX@@Default Left ColumnQ@H@@@QH0@AAP@CCellX$@@ Default Texty@!1b@Default Headingsa v;z sqAu *yd@Q $@StoryYAAm 'yd@d@Story_m SmCHHBvSSEnd 'Ayd@d@FStoryAYAAmaSm@D@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE)@@ap@PT@@apE)@@ap@PT@@apE)@@apE(@@ap@P T@@apB)SSEnd9RSm8@D@@ap@PT@@apF.0@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@PT@@a?pE.@@a?p@PT@@apE.@@ap@PT@@apE.@@ap@PT@@apE.@@ap@P QSSEnd xhPAm wBMhttp://nob.cs.ucdavis.edu/~bishop/classes/ecs150-1999-spring/sync-bakery.htmlSSEndo,kA @ Note Date`P@Y@x`al2 ^  7 Z 8I mTQA@BThe way I understand this, the processor can only send correct values. But it may not send correct values to all of its connected processors...SSEnd  v  s+B ~ @Outline (Not Indented)P@ @@i@"@ Left Justified Outline Numbering@@@pE A@A+@D  O @@@QP * ! . # A8RmT(A@ASSEnd.A:@Legal NumberingI@ OXZa; ' v: PAm@ASSEnd SmCHHBSSEndTSm@D@@@Px@PT@@@PxE.@@@Px@PT@@@PxE.@@@Px@PT@@@PxE.@@@Px@PT@@@PxE.@@@Px@PT@@@P?xE.@@@P?x@PT@@@PxE.@@@Px@PT@@@PxE.@@@Px@PT@@@QpE.@@@Qp@P QSSEndGoA @ Body Singlep@i@P@@@pE A@Am@D= Z ! ^ 2 A8RmT(A@ASSEnd+@Outline (Indented)P@ @@i@(@&Traditional Indented Outline Numbering@@@pE A@CfD?" @@@QP ,q@Default OutlineI@ OP .  2 * A8KmT(A@B Show that @ @ @ Ealg 5.4 solves k-set consensus @ @ @ Fprob) in presence of f crash failures for any @ @ @ Df # @@@    c' ZB( @GBullet 2p@i@P@@@pE A@Am@D  " @@@RH c PwOf @ Table Textp@i@P@@@pE A@Am@Db|r}#  qC2D[2U @ Heading 2P@ @@i@P@@@pEAm@D B}t> # @@@  c  b (S2 @First Line Indentp@i@P@@@pE A@Am@D-# c P2[(D @ Heading 1P@@@i@P@@@pEAm@D B}t> # @@@   c     } 1B AV7RmT(A@BWWell, the real problem here is that it will bias the 0th processor, but this will work:SSEnd )  @I7RmT(A@ASSEnd 1 _A Iv7RmT(A@ASSEnd <X [A pI7RmT(A@B4If (!n) Bias := (round mod 1) else bias := (n mod 1)SSEnd @ )A NI7RmT(A@ASSEnd N @A VI7RmT(A@ASSEnd R pA _I~7RmT(A@ASSEnd V NA I7RmT(A@ASSEnd [u hA A?AAAB@@Jeffab1020020543A DYƤ1:.P@@CHH@sh PIHBJN   JGQv1XA<AgpID III*IIIIIIEII!II II3IrI`IIINIWIIItIIIIIIGI&I5I>IPIYIbIkItIIIIIIIIIIIIIIII)I5IAIMIIIHLQIImIY I I'I$I$I)ILIJLI"MI_LI$ISLILI MIMII I IwLILI(IlLILILIsMILILILILILIFMI!I0MI;MIOMIXMIaMIjMIOI~I9IjYIIk II<IIIIIIITIII9InUIVIImI- IhIIQOI5VIC^I[IVI[I/[IU_IMII I IqI IsaISI I I IbIqTIcITI IcI~SIdISIIa In IcIPNIIIcI}UI[IIIZI=I'I6]If_IUI[IaI IaIOIUIDcIbIIZcIUIdbI`Ie[II>I>I/?I[?I?I?I@IAIAIBIBIBImCI}EIEI+FIFI[FIFILGI4JIGPHIHHIHIHI JIiIIIIKILI!QI[Iw^I_IPI$I]IYIdIdIdIdIGeIoeIeIeIeIdfIfIfIlgIgIgIchIohIhIQiIyiIiIiICjIjI:kIbkIkI lIHlI_lI{lIlIlIlIlIlImI7mIFmIbmImImImImLDQv1eAIrIuHYƤ1]1Qv1&/20/22{2c1E72e1KM5BR  N# ;!  ;,    D2t#A!  A#>)=P#H!  H$   H<B"B!B!B=z"o!o!s|wwy# # `   [ [ `# Y  F  F  P4 ('     %      &  (  MiscellaneousMiscellaneousFileProtectionHeaderLWPStreamTypePreviewWordProData   zz "0ha~ vRCMHdr