new ddd algo for dds

Upload: pankaj-kumar-gautam

Post on 06-Apr-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 New DDD Algo for DDS

    1/5

    A New Distributed Deadlock Detection Algorithm ForDistributed Database Systems

    Chim-fi Yeung, Sheung-lun Hung ,Kam-yiu Lam and Chee-keung La wDepartment of Computer ScienceCity Polytechnic of Hong Kong83 Tat Chee Avenue, Kowloon Tong, Hong Kong

    AbstractIn this paper, a new distributed deadlock detectionalgorithm is proposed. Deadlock is detected throughpassing special messages, called probes, along theedges of the wait-fo r graph s in the system. Thealgorithm is an improved version of Chandy'salgorithm [4 ] which fai ls completely in certain cases.The new algorithm has been tested through extensivesimulation experiments. Besides being error p e e , it isshown to sufler very little performance degradationj h m the additional deadlock detection overhead incomparison to the original algorithm. The algorithmhas olso compared with time-out method. It is foundthat for large values of multiprogramming level, theprobe-based algorithm can outperform time-out. Theperformance results indicate that in the modifiedalgorithm, the rate of probe initiation is a dominantfactor in determining system performance.

    1 IntroductionThe objective of concurrency control is to allow

    concurrent execution of t"a&omwithout violatingthe consistency of the database [9]. Variousconcurrency control protocols have been proposed[1,2,3,12]. Among them two phase locking [l] is theone most commonly adopted in the design ofcommercial products. In two phase locking, thecontlicts resulting from sharing of data objects areresolved by setting lockson thedata objects. One of themajor problem of two phase locking is that thepossibility of deadlock resulting from cyclic-wait forlocks among different t"c%om. Deadlock isundesirable because the transactions involved indeadlock cycle are blocked permanently. The resultingsystem performanceis thus dramatically degraded.

    In distributed database systems, deadlock detectionbecome very complex as a result of lacking globalsystem state. Although different deadlock detectionalgorithms in distributed system have been proposed

    [4, 5, 6, 131, it has been found that some algorithmsfail to detect deadlock under certain cases and somedetect false deadlocks [6,7]. Different approaches havebeen adopted in distributed deadlock detection. Someof them try to construct a global system state [13] andthe other try to pass a special message through blockedtransactions in order to find out a deadlock cycle [4, 5,61. Such approach is called probe-based distributeddeadlock detection as proposed by Chandy, Misra andHaas 4,5]. The main feature of this approach is that noglobal system state is needed.

    Although many literatures refer and m m 2,4,6]Chandy's algorithm but most of them has neglect itsperformance issues and not its correctness. In ourstudy, it has been found that in cases where deadlockcycles are repeatly formed among differenttransactions, Chandy's alorithm fails completely. Inthis paper, a new probe-based distributed deadlockdetection algorithm is proposed to address theweakness of Chandy's algorithm. The performance ofthe algorithm has been examined and compared withtime-out method through extensive simulationexperiments. The remainder of this paper is organizedas followed. Section2 presents Chandy's algorithm andits deficiency. Section 3 is the modified deadlockdetection algorithm. Section 4 is the results and theirinterpretation. Lastly, the conclusions and futureresearch work arepresented in section 5.2 Chandy's Algorithm and Its Deficiency

    Chandy's deadlock detection algorithm [4,5] isbased on passing probes through different sites. In eachsite, there is a controller which maintains a Booleanarray Dependk, known as dependency table k, for eachconstituent process Pk,where Dependk(i) is true only ifws controller knows that Pi is dependent on pk. IfDependi(i) is true, then Pi is dependent on itself andhence is deadlocked. The probe computation will beinitiated periodically by the controller whenever theconstituent process is idle. The algorithm has been

  • 8/3/2019 New DDD Algo for DDS

    2/5

    found that for some cases when the degree of datacontention is high, some deadlocks may not bedetected.The following example illusrates the problem.Assume the nitial system state at To is definedasin figure (1). Initially, there is a deadlock cycle,involving procases Pi, P2, P3, P4, P5, Pg and p7 inthe system. The deadlock is detected when P6 receivesthe probe(6,4,6). Pg is selected as victim and isaborted. All data objects being held by Pg will beRl&. I " I

    Figure 1 - System state at ToSuppose at time Ti , P7 is granted the data object

    which is waiting by P4 and later it is depended on P5.The new system state can be represented by figure (2).Although there is a deadlock (with processes Pi, P2,P3, P4, p7 and P5) in the system as depicted in figure(2),thisdeadlockwill not be detected by the algorithm.Based on Cbandy's algorithm, only the processes thatsituating at the site boundary and receiving probes willbe declared deadlocked. Therefore, in this example,only processes Pi, P3 and P7 are the possible victim.However, all theprobes fromthesethreeprocesses willnot be able to detectthe deadlock.

    probe(l,2,3) will be initiated by controller C1 onbehalf of Pi . Controller C2 will eventually discardthisprobe when P3 is receiving it because P i is a positiveentry in the dependency table of P3 @epend3(l)==e).probe(3,4,7) and Probe(7,5,1) will also be discardedbycontroller C1 with the same reason. No probe can bepropagated along the wait-for path, and so thisdeadlock cycle exists permanently and wi l l not bedetected.

    I =3 I II I IFigure 2 - System state at Ti3 The New Algorithm

    The cause of the problem in Chandy's algorithm isthat when a deadlock is resolved the information in thedependency table is not cleared and such information isused for detecting another deadlock. Therefore, theproblem found in Chandy's algorithm can be rectifiedby clearing the dependency table periodically. So thatthe probes has to be re-transmitted and will not bediscarded. As in the last example, suppose thedependency table of processes Pi and P3 are cleared atsome time after time T i . Then the deadlock cycle infigure (2) can be detected subsequently. Suppose Piinitiates Probe(1,2,3). P3 receives the probe andpropagates to P7 by Probe(1,4,7). P7 will propagateProbe(l,S,l) to P i which will eventually be declareddeadlock.

    However, when the dependency tables should becleared. If the dependency tables are being clearedfrequently, the number of probe messages will be greatas many probes needed to be re-transmitted. If thedependency tables are being cleared sparsely, thesyskm may be frozen at the deadlock state for a longtime before the deadlock is detected. As the controllerinitiates probes periodically, the number of probeinitiations can then be use to estimate the blockingperiod of a process. Therefore, the problem ofdetermining when to clear the dependency table may bequantified to the number of probe initiations.4 Performance Results and Interpretation

    Four sets of simulation experiments are designed tostudy the impacts of following factors on the systemperformance:(1) Data contention on system throughput(2 ) Rate of probe computation(3) Timing on dependency table clearance(4) Compare the probe-based algorithm with time-out4.1 Effect of Data Contention on SystemPerformance

    As the parameter setting makes the lock coflictprobabilityhigh, it is expected that the performance isgetting worse as the MF'L increases. The degradationin system performance as shown in figures (3) can beexplained by high blocking time and communicationlink contention. Increasing MPL increases both theprobability of blocking and deadlock. Thus theblocking time of a transaction will be greater. Highblocking time decreases the concurrency of system andresults in poor system performance.The CPU overhead, which is the workload forsearching local dependency and forwarding probes, fordeadlock detection per committed transaction alsoincreases with MF'L as shown in figure (4). However,comparing this result with the number of aborted

    50 7~

  • 8/3/2019 New DDD Algo for DDS

    3/5

    transaction as shown in figure (3), it can be seen thatalthough the amount of overhead increases withMPL,thenumberofabortedt"a& 'onsor in other wordsthe number of deadlock detected, remains fairlyconstant. Table (1) depicts the amount of probeinitiations for each detected deadlock.

    92.8538.42

    Table 1 - Number of Initiations per deadlockdetectedIdeally, only one probe initiation is required todetecta deadlock cycle. However, from the table, it can

    be obsuved that very large portion of deadlockdetection overhead is unnecessary. The reason is thatthe deadlock detection algorithm does not know exactly(or approximately) when a t"ctIon is deadlocked.Deadlock detection should be initiated whenever thesite controllerssuspectthat there exists a deadlock.4.2 Rate of Probe Initiation

    The effect of the rate of probe initiation issigniscant when the probability of conflict is high.Figure (5) depicts the throughput under different rateof probe. initiation.The esult indicates that under highdegree of data contention (i.e. MPL=25), throughputdecreases gradually after reaching its maximum valueas the time to initiate a probe computation increases.This can be explained by large number of probemessages and long blocking time. For small value ofInitjrobe (Initqrobeco.5 sec), number of probeinitiated per committed transaction is high. This highvelum of probe messages causes communication linkcontentionand delays the propagation of messagesandresults in longer blocking time oft"a&ons At thesame time, CPU time is needed for probe initiation.High rate of probe initiaion will use up huge amount ofCPU time.Figures (6) shows the amount of CPUoverhead for deadlock detection. If the time for probeinitiation is large (Init~robe=1.5sec for MPL=20),deadlock cycle will exist for a longer period before it isdetected. This will increases the blocking time and tieup the system resources or a longer time.4.3 Timing on Dependency Table Clearance

    In the modified algorithm, timing on dependencytable clearance (Clear-depend) is a factor that aFectsthe system performance. Figures (7) shows thethroughput of the system under different Clear-d-ndvalues. The result indicates that the impact ofClear-depend is not signiscant when the degrce of

    data contention is low (i.e. MPL=5). However, for highdegree of data contention, if the dependency table iscleared frequently, the performance s degraded. ThisFor large Clear-depend, the detection algorithm isequivalent to Chandy's algorithm. Therefore, somedeadlocks may exist for a long time without beingdetected and those t"ctIOn s involved in thesedeadlocks will remain in idle state and tie up system

    canbe explainedby the defect ofc haodys algorithm.

    resourcles.

    4.4 Compare Probe-basedAlgorithm with Tme-out

    The performance of the modified probe-based andt i me a t algorithms 1141 in a distributed databasesystem are compared in figures (8). The probabilityofdeadlock is varied by changing thet"a&on size asthe probability of deadlock increases sharply withtransaction size. In figure (8), it can be seen that withsmall deadlock probability, the time-out algorithmperforms better than the probe-based algorithm forhigh MPL. t is due to the higher deadlock detectionoverhead in the probe-based algorithm which initiatesdeadlock detection whenever a deadlock cycle is seemsto be formed. However, as the deadlock probabilityincreases by increasing the t"ctIon size, themodified probe-based algorithm perform much betterthan he time-out algorithm. The cost of high deadlockdetection overhead in the probebased algorithm isjustified when the probability of deadlock is high. Onthe other hand, when there are large amoung ofdeadlocks, cyclic restarts will be resulted. Moretransactionswill be rest;utedby the time-out algorithmthan he probe-based algorithmas shown in figure (9).The cost of abortingthe false deadlocks by time-out farout-weight its benefit.5 Conclusions

    In this paper, a new probe-based distributeddeadlock detection algorithm is introduced to reaifysome of the shortfalls of the algorithm proposed byChandy, Misra, andHaas.The new algorithm has beensubjected to extensive simulation experiments and hasshown to be error free and suffer to very littleperformance degradation. From the performanceresults obtained, the following conclusions have beenreached :(1) The system performance s highly degraded as thenumber of probe initiations increase.(2 ) Very large portion of deadlock d e m o n overheadis wasted because the site controller does not knowexactly when a deadlock is formed. Rules should bedeveloped to determine the best time to initiatedeadlock detection.

  • 8/3/2019 New DDD Algo for DDS

    4/5

    (3) The rate of probe initiaitionshas significant effecton the system performance for those high datacontention systems. This parameter should be CareNlyselectedtoachieveopti"pelf0~.(4) System suffers w y little performancedegradationfrom the additional overhead for the clearance ofdependency able introduced n the modified algorithmrate of clearingdependency tables should be carefullychosen in order to achieveoptimum pedormance.

    It has shown that the rate of probe initiations hassignificant effect on the system performance.Differentinitiation procedures, other than the implementedperiodic method, should be further examined. Moreextensive study on enhancing the deadlock detectionefliciencyshould e carriedout.The simulation results also indicate that for largeMPL., probe-based approach such as the proposedalgorithm can outperform the simple time-outapproach. Another observation shows that largeportionof deadlock detection overhead is wasted due to theditrary initiation of deadlock detection. Deadlockdetection is initiated whenever the site controllerssuspectthat thereexists a deadlock. There is no rule to-day to determine the best time to initiate deadlockdetection and finding rule@)to minimize deadlockdetection overheads is important if system perfonnanceis tobe maximized.

    in comparison with the original algorithm. However,

    ReferencesVI A.Be"andN. Goodman, "ConcurrencyControlinDiSaibutedDatabaseSystems," AW Co m p Sur., Vol. 13,NO .2, pp. 185-221, Jun. 1981.[2] A. Banstein, V. Hadzilacos, and N. Goodman,Concurrency Control and Recovey in Dotobare Systenu,Reading,Massechusetts,Addi~on-WeSley, 987.[3] S. Ceri and G. Pelagatti, Disrributed DatabasesPrinciprcS and Systems, New York,McGraw-Hill Bookcompany, 1984.

    dete&ngresource deadlocksindistributedsystems",[4] M. Chandy and J. Misra, "Adistributed algorithm forPnxeedings ofthe A C M S p p i u m onPrincipres ofLXstributed Computing @t&mu,anada, Aug.), ACM,Ne wYork, p. 157-164,1982.[SI M. Chendy, J. Misra, and L. M.Haas, DistributedDeadlock Detection,"ACMTmns. Comput.Syst., Vol. 1, pp.143-156, May 1983.[6] N. Choudhary,W. . Kohler, I.A. Stankovic, andD.Towsley, "AModified PriorityBased ProbeAlgorithmforDistributedDeadlock Detectionand Resolution," IEEETmns. SopMreEn g., Vol. 15,No. 1,pp. 10-17, Jan. 1989.

    [7]A.K. lmagarmid, "Asurvey of distributeddeadlockdetectionalgorithms,"ACMSZGMODRec. Vol. 15, No. 3,Sep. 1986.[8] H. Enslow,"What sa "Distributed"Data ProcessingSystem?" Computer,Vol. 11, pp. 16-23, Jan. 1978.[9] P.Eswaran, . N . Gray,R.A.Lorie, andI.L. Traiger,"TheNotiomof Consistency and PredicateLocks n a633, Nov. 1976.[ lo] N. Gray, "Notes onDatabase Operating System," inOpaating Systems:An Advanced Course @&are NotesinComputer Science60), Berlin,Germany, Springer-Verlag,pp. 398481,1978.[ l 11 E. Knapp, "DeadlockDetestion in DistributedDatabase," ACM, Comp.Sur., Vol. 19, No. 4, pp. 302-328,Dec. 1987.[12] H. T. Kung andJ. T. Robinson, "Optimistic Methodsfor Concurrency Control,"ACMTmns. DoroboseSyst., Vol.

    h t a b a s e S y & m , " A C M C ~ .Vol. 19,No. 1 1 , ~ ~ .23-

    6, p ~ .12-226, Ju~ .981.[13]R.Obermarck, "DistributedDeadlockDetectionAlgorithm,"AC M Tmns. DafubuseSyst., Vol. 7, NO. , pp.202-223, Jun. 1982.[14]Y. Parker and J.P. Verjus,Distributed ComputingSystems (Synchronization. Control and Communication).Academic Press, 1983.

    +connnmed Tx+Abated Tx

    1 ------....---+

  • 8/3/2019 New DDD Algo for DDS

    5/5

    MultiprigntmningL m lFigure 4 - CP U overhead per committedtransaction vs M PL

    4I

    3 -

    2 -(1 - -.0 2 3 4 5 300

    1 . 5 0.6 0.7 0.8 0.8 1 1.1 1.3 1.lllasma =4Figure 5 - Throughput vs Tim e to initiate probeCPUovemad (om)m +MPL=ZO

    I0.5 0.6 0.7 0. 8 0.8 1 1.1 1.3

    Inilsrobe =)Figure 6 - CP U overhead per committedtransaction vs Tim e to initiate probe

    I Clepr_depad IFigure 7 - Throughput vs Time to cleardependency table

    +RobSbased(Ts=lO)*T-ut (TS=lO): Iprobe-based(Ts40)-Timc-oUt (TS=20)W7J

    1 5 10 15 20 251 Multiprogrumnhg Level IFigure 8 - Throughput vs MPL

    MultiprogrammingLevel JFigure 9 - Mean number of restart vs MP L

    510