Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 19 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
19
Dung lượng
132 KB
Nội dung
Phần A: C ! " !"#$%&'(&)* #+,-. )/,-01,-)213 45 1#678519 .: 1;.'9 6/5<+=> 6/#? 8 @ . A B A A A 6 C @ 6 @ A D @ 1B C 6 @ 1 A A 8 @ @ E1 F 8 @ 5 A G $H&I(&1&*?J8 @ B A A A 18 F G C . A 18 @ B A A G 8 @ 5 A G 8 @ )1. @ A ?% C 8 @ 6 @ A 88 F ) A G G @ 8 F 1 @ B A 6 @ A 5 A 58 A . A .: ) @ '8 @ . @ KLMB F F A F )18 @ E A F E A A G ). @ : ? NB A A A B F F F B A A @ 1 F &I&1&?H A ) @ 6 @ ,' @ ' @ 85 C @ K&$1B A ' @ OP&&Q &R* F A ) @ A ?8 @ . A G ' C 8 @ 5S&' A 8 G 6 @ . A 58 A 1 A A &1&K&68 G A 6 @ A .6. @ ?T C @ K& F 6 C ) G A ) A 8 @ A ?H A B F '8 @ K& A 5 A F 8 F F 58 A . A 1 A 8 @ . A K& G E) F 5. @ 5. A 8 A G A 5 F 8 @ 68 F F F 6 @ ) A G 5 A F # #! " $%&' ( ))! * +,-' * &.$/ ! " S H8 A B A A A .C @ @ A ' C 8 @ 6 @ G 8 F ? S M F 8 A G 8 F ' F B G F @ @ . @ C A 6 @ A . F A )B A G A , ? S 8 @ . A #5D A @ 6 @ A 8 G ) @ 6 @ ?JB F 8 A U 5. @ ' C 8 @ 6 @ @ 1 @ B A #EU A 8 G G G 5 A ? S % C 8 @ A 6 F G G 6 @ G 1 F 6. F . @ A . : A ). A 858 A ) @ E68 F # F )18 @ : G @ 1 F A ) A A HJV JDNW Trang 1 Phần A: C @ ?X. @ . A F : G @ D F E G 8 @ . A 8 A #& C 5 A 5D1 A 68 F G ) @ 1 F 68 F 58 G ? S 8 @ A 6 @ ,' @ 8 A NHVIPV1 F A 5 C @ K& F 1 A A A ' @ $)''&Y &* A 6 G 18 @ B A A A ?Z G @ 6 F ). @ 6. G ) B A A ) @ ?M8 @ )1 @ A )D A F F )8 A F 68 G 8 G 8 A 8 @ #). @ A 5 @ ? 0! " $123 4 5-67 * - ! " H A ). @ . A ).B F ,' @ A ' @ A E1 F A A 8 A C A &E A &1&1# A F F B F )O S [VH$&)&&'& *\ A 8 F .&8 C A ) A 6 @ 58 A . A C A ) @ ?[VH F 6 @ G ' @ A A F F @ E A 58 A . A ? S X& &1&% @ 1 @ .68 @ F @ F ' @ 1 @ X]X$)& &S &&')''&Y &*S A ). @ A 6. G . C A A ' @ 1 F A F F ' F F 6 @ 1 F A 8 G .68 @ & F A $&S 'S^Y '*?H A F 5. F @ 1 A 8 F . F @ ? S ][_$`&S&:&5&*X. @ A 58 G ) A 8 F .E & A A 6. A @ 6 @ & A 8 F .8) @ ?JB A ' @ ). @ 6. A @ 6 @ 8& F 6 A 8 A ). A G ). @ .68 @ ). @ 6. A @ 5 A 6 @ 8&1&E A 8 G G .68 @ F '8 @ ][_ G &68 A '8 @ ][_ G &1&? HJV JDNW Trang 2 Phần A: C #189:;<8=> M# E..a<=)2)b?Nc :+ !/55d)<6e:+5f6/! g=91/,-.?Mg.!<,=c /5 1#, ?J=6/60 ##)#U !<,-., ) =1#:W=h +E)#5.,W =11#,- .h +5"89? <W:1=6/#a1576! a+#=g1#67: )U= /?N4=1/)081#5i> 1=6/6! a#< 8W O jMaEa5<Wa,=ck'l 6)+1##819+71+=2 1#.'mm)U?Ne7## ?Ja1E #84> ,6h a)+1##8'm? jHa> m)k'l26&5<76< W:#60 1#5:W !=?/# dDD-'l31#:W26> a?Ja 17#84> 6n67ah a)dU ) 1##6? ( 1#7h a6opW! 6q. : 219 ?NE.g 6q. : 58+1;.? H!/6! a?%96b9) +6! a6<1,= )/D? HJV JDNW Trang 3 Phần A: C #:?-@AB!@C-/DE-/F/G&H) +!I7/&' #)W6/3 a? a#-'l turn $W8a#671#)/D*E675 6193r?Mturn = 0EaL671#)/D?Mturn = 1, aL61#)1o0e65turn30?TaL e5p)/DE!603turn 1/s6<da_61#)/ D? J!KH=UaL Y&$N[tu*v Y&$wxr*QIIY $+& &$!ILMN$ &,JKO xsO M S&$*Q y J@KH=Ua_ Y&$N[tu*v Y&$wxs*QIIY $+& &$!ILMN$ &,JKO xrO M S&$*Q y \W#' 815<) 8)067 a#671#)/D?%6!!!<D067a2 am1#)/DE2!<12)6/5k O )a!<3D01#)/D)a55. )/D?\W-a_ 5p)/D= !?HW a6/#)/DE1#xr?NaL1#)/D1# 5p !E6023> #sE2,-62# HJV JDNW Trang 4 Phần A: C )/Dgh ?( 6!EaL25U !62 #)/D> !1#)+1#)/D)gh ?N8U# _1zo){,-62#)/D> )aE1#2) 3s?M1EW#5.!35!591/+6 > a? ##:?-@AB!@C--&P&/F//Q$5- 2-R7!$S TJNM L !6LN L,$GK #)W6op7U> gk?M/) 4=)|360d5<) 1#') 1m9) 5.< E#|3 Test-and-Set Lock$N(}*1#6763~ O NM L!6LN I,$G$& &* v N&S 'S(&5x &Q &xN[tuQ y M! |3N(},-6e$8 ,-5 *EU b67,-g?H!<#60W,=6:/19N(} -'l8))5E675#•L}(u?Na W5<) 3> 5951#)/DE5x•L}(uE a!<1#)/D? Y&$N[tu*v Y&$N&S 'S(&5$5**Q $+& &$!ILMN$ &,JKO 5x•L}(uO M S&$*Q y HJV JDNW Trang 5 Phần A: C Hf+Wgk5E|3N(}W)€. 1a6<W:1=6/E25.';'#6<#60|3 N(} 67,-)5.< E=#8)19= a/,-? N=WW866/W)1o06<5<) !!67d1#)/DE6/5 dEa Wel1o05<) #?HWaW 8l5<) 6/56<e6<)47671#)/D 67W•busy waiting‚?}15<) 8l=/e -'lHVtE'1a6 e1z )'lHVt? #0:?-@AB!@C-/DE-/F/ +!,%U& 2-%&/ V#' 8 6q.619 )1&\ 1#M 6<6! O V7&J6NM &! &,W)NMM!-NK).66)a 1#? V!JM,7+$NW)NMM!-NKO).6c)a c =5ƒ)a#Eabe5.!.6#6< ? H!/k6<1,=6:/ 6q.6?#)).a6WO)a5<)1- 'l#81#/a58g#8#?Na! 8g#8b).66a5<)1# 6! < 25&'6567).6= ,=ca5<)#8?T-'l,# 8Ea).656a5<)6<5 U,=?J/ga5<)E567.68g #8E!be65#8„#6<=a). 66a6 35! 8#86!6<6ka#? HJV JDNW Trang 6 Phần A: C Y&$N[tu*v \$&&E&:&)& &*Q M $&&E &)& &*Q $+& &$!ILMN$ &,JKO \$&&E&')& &*Q M S&$*Q y Nh+)#)n,-…h)98 1#82.: )2E 6q.6p h1# 67'm/6<W:#6! ? HJV JDNW Trang 7 Phần A: C 0:;<8=><XYZ[ N).a6?H!† )# 60U: )1#8k5iU#O j! cg j! q:0b 0:?-@AB!@C-/DE-/F/ +\ ] ^-/Q N+1=6/6! 67W: .: 2cn?H#d,# #5?N;E!)++1=6/1/6! | 6opcg?H41a1! cgh 5)# a> !gW6#1=6/g: )W:? N+E16! |60 '=1=6/ )h 5?\h 2)5 E6!|< 67.: 1 6q.619 ? \W- !<,63)h 5> e1#: 675#1##‡có trướcˆ?Z #+< Wp ){67#<: O jML1#_# 5> m)2)1#L67 9_a&l> 2) !OL_? jML#.6)2)#6!1#_#> . 6#a !L_? HJV JDNW Trang 8 Phần A: C Ncg> 5 LsL†L‰LŠL‹ _s_†_‰_Š_‹ N 6q.6 L†_†1#_‰LŠ Œd).a:&g86/##eW ,=Se8lE6!5WD8l#842 +7#! W,= 6<!5.17:+78l)3 9M?MeW,=V1#e8lH# e)8 2) , ? \W-MV#+7W,= 1#MH#+78l2e 6<)5?H|8l67)W•)EW,=W•)6!6{ '; E!~ #EOMVŽMH•r NEV|W,=).EOMVŽMH•M : #<6/5> 16! 1#!<). Wa O HJV JDNW Trang 9 _#Z !9).aeW ,=Se8l t Ls L† L‰ LŠ L‹ _s _† _‰ _Š _‹ Ví dụ: Mô tả trậttự từng phần P i+N P i+N+1 P 1 C 1 P 2 C 2 P i C i C i+1 & O(W,=k & ON8lk _#Quan hệ có trước trong mô hình người sản xuất- người tiêu thụ Phần A: C N+Ee !<1'l7#& 5< O jN82)V)MV<+74,W,=6{!? jN82)H)MH<+74,8l6{ ? jN82)V)MH‘W> MH)#V D)n)g! 67.6cH!#8l)96{'; ? jN82)H)MV‘W> MV)#H D)n)g! .6cV!)W,=)96{'; ? N bk))6! 4,676W)W 1,8)n2)6/5 6O sIN82)W,=O MV‘ŽMH•r †IN82)8lO MVŽMH‘•M N !<1O MVxMV‘jnpE19•r 6!Enp+7.6{W,=V)#H5.E MHxMH‘jncE19nc•r 6!Enc+7.6{8lH)#V5.? N !<5:! #6/56! . kO ∑ H Œ •T$&* 6!EH 1#T#+?N ##!5WD1#6/5)2 =WŒ )#+> !#627' W> !Œ‘ E1#|Œ #5.m? Ja8, h eW,=1#e8l)# q:#5.g1#|g-'l6<6! W 2g6U#6>? HJV JDNW Trang 10 . !9).aeW ,=Se8l t Ls L† L‰ LŠ L‹ _s _† _‰ _Š _‹ Ví dụ: Mô tả trật tự từng phần P i+N P i+N+1 P 1 C 1 P 2 C 2 P i C i C i+1 & O(W,=k. – tăng lên 1 đơn vị cho công tơ đếm cho(E,i) – treo cho đến khi lớn hơn hay bằng i Phép toán thứ i: tang(E) → cho(E,i) Bài làm: N## ,d