k-1-x - Webcourse
Transcription
k-1-x - Webcourse
נושאים מתקדמים באלגוריתמים מבוזרים שמואל זקס [email protected], www.cs.technion.ac.il/~zaks A. Distributed algorithms Example 1: synchony 9 8 7 6 5 4 3 2 1 84 days, days, 12 professor professor Exercise: find a trade-off between no. of days and no. of professors. Example 2: leader election x 4 x 5 x 8 ? x 6 9 Exercise: find a better algorithm to find the maximum, prove correctness and analyze performance. Example 3: faults Impossibility of consensus The Byzantine Generals Problem Example 4: snapshot B. Self Stabilization Example 5: self stabilization clock synchronization shared memory, synchronous xx 8x7x 6 8x 7x 6 8 76 x6x7 8 x6 x7 8 6 Program at each processor p : choose a neighbor x of p ; if t(p) = t(x) then t(p):= t(p)+1; Stabilizing if all start with the same time, however … 7 if t(p) = t(x) then t(p):= t(p)+1; 6 7 6 4 7 Is it stabilizing? no! (may even deadlock) 8 Program at each processor p : choose a neighbor x of p ; if t(p) = t(x) then t(p):= t(p)+1; if t(p) < t(x) then t(p):= t(x); Is it stabilizing? 9 if t(p) = t(x) then t(p):= t(p)+1; if t(p) < t(x) then t(p):= t(x); xx 8x7x 6 8 76 xx 8 7 4 x7 x7 8 xx 7 7 8 Is it stabilizing? yes! 10 if t(p) = t(x) then t(p):= t(p)+1; if t(p) < t(x) then t(p):= t(x); xx 8x7x 6 8 76 xx 8 7 4 x7 x8 9 xx 7 8 9 Is it stabilizing? no! 11 Program at each processor p : choose a fairly; neighbor x of p if t(p) = t(x) then t(p):= t(p)+1; if t(p) < t(x) then t(p):= t(x); Is it stabilizing? yes! Exercise: prove and analyze time until stabilization. 12 C. Networks (optical) p1 lightpaths Valid coloring w( p1 ) w( p2 ) p2 13 Saving a switch: 14 Example 7: min ADMs colors = 2 ADMs = 8 colors=3 ADMs = 7 Exercise: prove NP=hardness 15 Example 8: min ADMs w/grooming colors=3 switches=10 g=2 colors=2 switches=9 16 Example 9: approximation algorithms N: # of lightpaths ALG: #ADMs used by the algorithm OPT: #ADMs used by an optimal solution ALG 2N N OPT ALG 2 x OPT 17 Example 10: min regenerators 3. Regenerators d=2 18 set A = 3 set B = 1 d=2 g=1 19 set A and set B = 4 d=2 g=1 20 set A or set B = 3 d=2 g=1 21 Example 9: on-line algorithms Input arrives one at a time, and a decision is made (and cannot be changed). In the minADM problem: lightpaths arrive one at a time, and need to be colored. Competitive analysis An on-line algorithm A is c-competitive if A(I) c OPT(I) for any input sequence I. (A(I) and OPT(I) are #ADMs used by A and by an optimal offline algorithm OPT.) 22 Any algorithm ≥ 7/4 , even for a ring Case a: 7/4=1.75 23 Case b: Case b1: 6/3 = 2 Case b2: 5/3 = 1.67 any algorithm ≥ 1.67 Exercise: prove any algorithm ≥ 1.75 24 6.5 any algorithm for a path ≥ 3/2 k paths k=12 x=6 k-1 spaces: x between same color k-1-x between different colors 25 So far: any algorithm uses 2k ADMs now – a short path at each gap of diffferent colo (k-1-x such gaps k=12, x=6, 12-1-6=5 Any algorithm uses at least one more ADM for each (ALG uses exactly one) So: any algorithm ≥ 2k + (k-1-x) ADMs 26 So far: use ≥ 2k + (k-1-x) ADMs now – two long paths at each of the k gap of same color Any algorithm must use 2 ADMs for each So: any algorithm ≥ 2k + (k-1-x) + 4x = = 3k+3x-1 ADMs 27 We showed: any algorithm uses ≥ 3k+3x-1 ADMs 2k ADMsOPT: the short paths ≤ 2x ADMsfor the long paths OPT 2k + 2x any algorithm/OPT 3/2 – 1/(2k) 28 Traffic grooming low capacity requests can be groomed into high capacity wavelengths (colors). colors can be assigned such that at most g lightpaths with the same color can share an edge g is the grooming factor #ADMs=12 #ADMs=9 Example 6: min ADM, no grooming Example 7: min ADM, no grooming, online Example 8: min regenerators, no grooming Example 9: min locations for regenerators, no grooming Many parameters, many optimizatoin problems Many algorithmics issues: Algorithms, complexity, On-line, approximability, inapproximability, etc. Many open problems, of practical importance and theoretical interest