system deadlocks dining philosophers
play

SYSTEM DEADLOCKS - DINING PHILOSOPHERS - PDF document

dependability engineering & Petri nets May 2005 SYSTEM DEADLOCKS - DINING PHILOSOPHERS D:\mh\docs\lv\nl\nl_skript\nl07_deadlock_phils.sld.fm 7 - 1 / 20 dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , ONE


  1. dependability engineering & Petri nets May 2005 SYSTEM DEADLOCKS - DINING PHILOSOPHERS D:\mh\docs\lv\nl\nl_skript\nl07_deadlock_phils.sld.fm 7 - 1 / 20

  2. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , ONE PHILOSOPHER PN COMPONENT thinking left_fork take_left waiting right_fork take_right eating put_right right_fork releasing put_left left_fork phil left_fork right_fork ORD HOM NBM PUR CSV SCF CON SC Ft0 tF0 Fp0 pF0 MG SM FC EFC ES Y Y Y Y N Y Y Y N N N N Y N Y Y Y DTP SMC SMD SMA CPI CTI B SB REV DSt BSt DTr DCF L LV L&S Y Y Y Y Y Y Y Y Y N ? N Y Y Y Y monika.heiner@informatik.tu-cottbus.de 2 / 20

  3. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , SYSTEM OF N PHILOSOPHERS phil1 phil1 fork1 fork2 fork2 fork1 phil2 phil3 phil4 phil4 phil3 phil2 fork3 fork4 fork3 phil3 phil1 fork1 phil5 fork2 phil5 fork5 phil2 fork3 phil4 fork4 phil3 ORD HOM NBM PUR CSV SCF CON SC Ft0 tF0 Fp0 pF0 MG SM FC EFC ES Y Y Y Y N N Y Y N N N N N N N N Y DTP SMC SMD SMA CPI CTI B SB REV DSt BSt DTr DCF L LV L&S N Y Y N Y Y Y Y N Y ? N N N N N monika.heiner@informatik.tu-cottbus.de 3 / 20

  4. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS (2 PHILS ), REACHABILITY GRAPH pl1 pl2 th1, th2, f1, f2 tl2 tl1 w1, th2, f2 th1, w2, f1 tl1 tl2 tr2 tr1 w1, w2 e1, th2 th1, e2 pr1 pr2 r1, th2, f2 th1, r2, f1 tl2 tl1 pl2 pl1 r1, w2 w1, r2 monika.heiner@informatik.tu-cottbus.de 4 / 20

  5. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS (2 PHILS ), STUBBORN SET REDUCED REACHABILITY GRAPH pl2 pl1 th1, th2, f1, f2 tl2 tl1 w1, th2, f2 th1, w2, f1 tl1 tl2 tr2 tr1 w1, w2 e1, th2 th1, e2 pr1 pr2 r1, th2, f2 th1, r2, f1 tl2 tl1 pl2 pl1 r1, w2 w1, r2 monika.heiner@informatik.tu-cottbus.de 5 / 20

  6. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS (2 PHILS ), CONCURRENT AUTOMATON pl2 pl1 th1, th2, f1, f2 tl2 tl1 {tl1 | tl2} w1, th2, f2 w1, w2 th1, w2, f1 {tr1; pr1} {tr2; pr2} {pl1 | {tl1 | r1, th2, f2 th1, r2, f1 tl2} pl2} ?? {tl2; tr2; pr2; pl2} {tl1; tr1; pr1; pl1} th1, th2, f1, f2 {tl1 | tl2} w1, w2 monika.heiner@informatik.tu-cottbus.de 6 / 20

  7. monika.heiner@informatik.tu-cottbus.de fork2 (B2) fork1 (B1) thinking1 (B3) thinking2 (B4) take_left2 (E2) take_left1 (E1) dependability engineering & Petri nets waiting2 (B6) waiting1 (B5) DINING PHILOSOPHERS (2 PHILS ), take_right1 (E3) take_right2 (E4) eating1 (B7) eating2 (B8) BRANCHING PROCESSES put_right1 (E5) put_right2 (E6) fork2 (B9) FINITE PREFIX OF fork1 (B11) releasing2 (B12) releasing1 (B10) take_left1 (E10) put_left2 (E8) put_left1 (E7) take_left2 (E9) thinking1 (B18) waiting1 (B14) fork1 (B17) waiting2 (B13) fork2 (B15) thinking2 (B16) May 2006 7 / 20

  8. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , ANALYSIS EFFORTS WITH INA / PROD PEP INA # phils P / T R stub R B / E time 1 6 / 4 4 4 9 / 4 2 10 / 8 8 10 18 / 10 3 15 / 12 20 35 45 / 27 4 20 / 16 38 118 84 / 52 5 25 / 20 62 392 135 / 85 6 30 / 24 92 1.297 198 / 126 7 35 / 28 128 4.286 273 / 175 8 40 / 32 170 14.158 360 / 232 9 45 / 36 218 46.763 459 / 297 10 50 / 40 272 154.450 570 / 370 11 55 / 44 332 510.116 693 / 451 (0 : 5) 12 60 / 48 398 828 / 540 (0 : 23) 13 65 / 52 470 (5.56 e+6) 975 / 637 (1 : 29) 14 70 / 56 548 1.134 / 742 (6 : 28) 15 75 / 60 632 (60.7 e+6) 1.305 / 855 (27 : 42) monika.heiner@informatik.tu-cottbus.de 8 / 20

  9. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , ANALYSIS EFFORTS WITH SMV ( BDD ) without computation of with reordering reordering reordering # states BDD BDD BDD time time time nodes nodes nodes 2 10 0.1” 3120 0.06” 1405 0.1” 3082 3 35 0.17” 7577 0.11” 3895 0.17” 7474 5 392 0.68” 10258 0.87” 5186 0.28” 10037 7 4247 3.09” 12635 5.36” 8800 2.82” 12674 9 46763 16.95” 60310 27.99” 12836 6.16” 16533 11 510116 88.17” 200803 5.99’ 49459 25.75” 67469 13 5.56e+6 35.99’ 720848 28.10’ 165055 1.69’ 222471 15 60.7e+6 1.76 h 1369156 41.12’ 125471 1.93’ 160109 Machine: Hypersparc, 32 MB (britten) Times: user time + system time Model checking of the formula AG(_fork1 | _fork2 | ... | forkn) Comp. of variable reordering perfomed without model checking smv options: -f -r inc monika.heiner@informatik.tu-cottbus.de 9 / 20

  10. dependability engineering & Petri nets May 2006 PHIL 1000, BDD - BASED BY JSP Number of states: 1137517608656205162806720354362767684058541876947800011092858232169918\\ 1599595881220313326411206909717907134074139603793701320514129462357710\\ 2442895227384242418853247239522943007188808619270527555972033293948691\\ 3344982712874090358789533181711372863591957907236895570937383074225421\\ 4932997350559348711208726085116502627818524644762991281238722816835426\\ 4390437022222227167126998740049615901200930144970216630268925118631696\\ 7921927977564308540767556777224220660450294623534355683154921949034887\\ 4138935108726115227535084646719457353408471086965332494805497753382942\\ 1717811011687720510211541690039211766279956422929032376885414750385275\\ 51248819240105363652551190474777411874 ca. 1.1 * 10^667 ❑ Number of places/marked places/transitions: 7000/2000/5000 ❑ Time to compute P-Invariants: 45885.66 sec ❑ Number of P-Invariants: 3000 ❑ Time to compute compact coding: 385.59 sec ❑ Number of Clusters: 3000 ❑ Number of Variables: 4000 ❑ Time: 3285.73 sec, ca. 54.75 min monika.heiner@informatik.tu-cottbus.de 10 / 20

  11. dependability engineering & Petri nets May 2006 D INING PHILOSOPHERS , VERSION 2 ONE PHILOSOPHER PN COMPONENT thinking begin_take waiting_right waiting_left take_left take_right having_left having_right end_take left_fork eating right_fork begin_put releasing_right releasing_left put_left put_right released_right released_left end_put phil left_fork right_fork ORD HOM NBM PUR CSV SCF CON SC Ft0 tF0 Fp0 pF0 MG SM FC EFC ES Y Y Y Y N Y Y Y N N N N Y N Y Y Y DTP SMC SMD SMA CPI CTI B SB REV DSt BSt DTr DCF L LV L&S Y Y Y Y Y Y Y Y Y N ? N Y Y Y Y monika.heiner@informatik.tu-cottbus.de 11 / 20

  12. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , VERSION 2 ANALYSIS EFFORTS WITH INA / PEP PEP INA # phils P / T R stub R B / E time 1 12 / 8 8 10 2 22 / 6 18 57 3 33 / 24 43 446 4 44 / 32 100 3429 5 6 7 8 9 10 11 12 13 14 15 monika.heiner@informatik.tu-cottbus.de 12 / 20

  13. dependability engineering & Petri nets May 2006 FOUR NECESSARY & SUFFICIENT DEADLOCK CONDITIONS [C OFFMAN ET AL ] ❑ mutually exclusive resources -> shared, serially reusable -> unsufficient supply, therefore competition ❑ incremental acquisition -> dynamic resource allocation (in opposite to static one) -> processes hold resources while waiting to acquire additonal ones ❑ no pre-emption -> resources cannot be pre-empted (withdrawn forcibly) -> resources are only released voluntarily ❑ waiting cycle -> cycle of processes such that each process holds a resource which its neighbour is waiting for -> may contain -> all (total deadlock) or -> only some of the processes (partial deadlock) ❑ ANY DEADLOCK AVOIDANCE POLICY HAS TO ERASE AT LEAST ONE OF THESE CONDITIONS monika.heiner@informatik.tu-cottbus.de 13 / 20

  14. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , DEADLOCK AVOIDANCE STRATEGIES ❑ limit number of phils trying to eat, so there will be enough resources for at least one -> limit number of chairs -> token ring protocol (only one phil can eat at any time) -> sequential eating (special token ring) =>> sufficient supply, no competition ❑ static allocation (all or nothing) =>> no incremental acquisition BUT: atomic operation to aquire multiple resources ❑ wait only finite time =>> pre-emption, voluntarily ❑ asymmetric behaviour -> only one behaves asymmetrically -> even/odd-numbered phils behave differently -> hierachical resource allocation =>> no waiting cycle BUT: contradiction to original task (identical pattern for all) monika.heiner@informatik.tu-cottbus.de 14 / 20

  15. dependability engineering & Petri nets May 2006 DINING PHILOSOPHERS , ONE PHILOSOPHER PN COMPONENT thinking left_fork take_left waiting right_fork take_right eating put_right right_fork releasing put_left left_fork phil left_fork right_fork ORD HOM NBM PUR CSV SCF CON SC Ft0 tF0 Fp0 pF0 MG SM FC EFC ES Y Y Y Y N Y Y Y N N N N Y N Y Y Y DTP SMC SMD SMA CPI CTI B SB REV DSt BSt DTr DCF L LV L&S Y Y Y Y Y Y Y Y Y N ? N Y Y Y Y monika.heiner@informatik.tu-cottbus.de 15 / 20

Recommend


More recommend