-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-course.tex
More file actions
1544 lines (1243 loc) · 69 KB
/
Copy pathtemplate-course.tex
File metadata and controls
1544 lines (1243 loc) · 69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[a4paper,10pt,openany, oneside]{book}
% set your chapter number and title
\setcounter{chapter}{4}
\newcommand{\chaptertitle}{Self-Stabilizing Algorithms for Overlay Networks}
\usepackage{fancyhdr} % For custom headers and footers
\pagestyle{fancy} % Enable custom headers and footers
\fancyhf{} % Clear all header and footer fields
\fancyfoot[C]{\thepage} % Center the page number in the footer
\fancyhead[C]{Chapter \arabic{chapter} : \chaptertitle} % Center the page number in the footer
\newcommand{\mode}{script}
\RequirePackage{ifthen} % for \mode case distinction
\usepackage[normalem]{ulem}
\usepackage{hyperref}
\usepackage[T1]{fontenc}
\usepackage{comment}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{mathabx}
\usepackage{booktabs}
\usepackage{csquotes}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{subcaption}
\usepackage{tabls}
%\usepackage{2in1}
\usepackage{needspace}
%\usepackage{url}
\usepackage[usenames]{color}
\usepackage{fancybox}
\usepackage{pifont}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{tikz}
\usepackage{todonotes}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{facts}[theorem]{Facts}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{example}[theorem]{Example}
\newtheorem{model}[theorem]{Model}
\newtheorem{protocol}[theorem]{Protocol}
\newtheorem{customAlgo}[theorem]{Algorithm}
\newtheorem{condition}{Condition}[chapter]
\newcounter{common} % Create counter ``common''
\makeatletter
\let\c@theorem\relax % drop existing counter ``theorem'' (you might not need this)
\let\c@algorithm\relax % drop existing counter ``theorem'' (you might not need this)
\let\c@figure\relax % drop existing counter ``figure'' (you might not need this)
\let\c@table\relax % drop existing counter ``figure'' (you might not need this)
\makeatother
\usepackage{aliascnt}
\newaliascnt{theorem}{common} % let ``theorem'' be an alias for ``common''
\newaliascnt{algorithm}{common} % let ``algorithm'' be an alias for ``common''
\newaliascnt{figure}{common} % let ``figure'' be an alias for ``common''
\newaliascnt{table}{common} % let ``figure'' be an alias for ``common''
\renewcommand{\thealgorithm}{\arabic{chapter}.\arabic{algorithm}}
\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{theorem}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\newcommand*{\among}[2]{\left(#1 \atop #2\right)}
%% Counter equalizing ends
%%locality lower bounds commands
%args: node label, neighbor 1 label, neighbor 2 label
\newcommand\Twoneighbors[3]{
\begin{tikzpicture}
\node[draw, inner sep=2pt, circle, minimum size=2mm] at (0,0) (A) {$#1$};
\node[inner sep=1pt, minimum size=2mm] at (1,0) (B) {$#2$};
\node[inner sep=1pt, minimum size=2mm] at (0,-1) (C) {$#3$};
\path[-]
(A) edge (B)
(A) edge (C);
\end{tikzpicture}
}
%args: node label, neighbor 1 label, neighbor 2 label, neighbor 3 label
\newcommand\Threeneighbors[4]{
\begin{tikzpicture}
\node[draw, inner sep=2pt, circle, minimum size=2mm] at (0,0) (A) {$#1$};
\node[inner sep=1pt, minimum size=2mm] at (1,0) (B) {$#2$};
\node[inner sep=1pt, minimum size=2mm] at (0,-1) (C) {$#3$};
\node[inner sep=1pt, minimum size=2mm] at (1,-1) (D) {$#4$};
\path[-]
(A) edge (B)
(A) edge (C)
(A) edge (D);
\end{tikzpicture}
}
\tikzset{
bicolorbordered/.style n args={4}{
postaction={draw,double distance=0.1mm,#2,dashed,dash pattern=on 8pt
off 10pt,dash phase=0pt},
postaction={draw,line width=0.3mm,dashed,dash pattern=on 8pt off 10pt,-,#1,dash phase=0pt},
postaction={draw,double distance=0.1mm,#4,dashed,dash pattern=on 8pt
off 10pt,dash phase=9pt},
postaction={draw,line width=0.3mm,dashed,dash pattern=on 8pt off 10pt,-,#3,dash phase=9pt},
}
}
\tikzset{
borderedline/.style n args={2}{
postaction={draw,double distance=0.1mm,#2},
postaction={draw,line width=0.3mm,-,#1},
}
}
\tikzset{pkt/.style={draw,rectangle,fill=gray!15,minimum height=25pt,align=center,font=\footnotesize}}
\tikzset{pktlen/.style={above=-2pt,font=\scriptsize}}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{er}
\usetikzlibrary{shapes}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{arrows}
\usetikzlibrary{automata,positioning}
\usetikzlibrary{shapes.geometric, arrows.meta}
\usepackage[outline]{contour}
% \tikzset{
% tricolor/.style n args={3}{
% postaction={draw,line width=0.4mm,dashed,dash pattern=on 8pt off 19pt,-,#1,dash phase=0pt},
% postaction={draw,line width=0.4mm,dashed,dash pattern=on 8pt off 19pt,-,#2,dash phase=9pt},
% postaction={draw,line width=0.4mm,dashed,dash pattern=on 8pt off 19pt,-,#3,dash phase=18pt}
% }
% }
%%locality lower bounds ends
\newcommand{\N}{\mathbb{N}}
\newcommand{\E}{\mathbb{E}}
%\newcommand{\bigO}{\mathcal{O}}
\newcommand{\hide}[1]{}
% New commands:
\newcommand{\fancyschmancy}[3]{\noindent\shadowbox{\color{Gray}\begin{minipage}{0.95\textwidth}\color{black}\begin{#1}[#2] #3\end{#1}
\end{minipage}}}
\newcommand{\rmk}[1]{\noindent\colorbox{Gray}{
\begin{minipage}{\textwidth}
\begin{remarks}#1\end{remarks}
\end{minipage}}
}
%\renewcommand{\vec}[1]{\#1}
\renewcommand{\algorithmicloop}{\textbf{do atomically}}
\renewcommand{\algorithmicendloop}{\textbf{end do}}
\newcommand{\comments}[2]{\marginpar{\tiny{\textbf{#1: }\textit{#2}}}}
\newcommand{\notesmargin}[1]{\comments{Notes}{#1}}
\newcommand{\sidenote}[1]{\ifthenelse{\boolean{shownotes}}
{\notesmargin {#1}}{}}
%\newcommand{\yes}{yes}
%\newcommand{\no}{no}
\newcommand{\yes}{\hspace{1pt}\ding{52}}
\newcommand{\no}{\hspace{1pt}\ding{55}}
\usepackage{ifthen}
\newboolean{shownotes}
% Hier kann man mit true oder false angeben, ob die
% Notes gedruckt werden sollen oder nicht:
\setboolean{shownotes}{false}
\newcommand{\notes}[1]{\ifthenelse{\boolean{shownotes}}
{\noindent\textbf{\textsf{Notes:}} #1}{}}
% Definiert max. und min. Platz vor remarks
\usepackage{enumitem}
\newlength{\remarkskip}
\setlength{\remarkskip}{1ex plus0.3ex minus0.3ex}
% Definiert remarks-environment; optionales Argument erlaubt den Defaulttext
% ''Remarks:'' zu aendern; verhaelt sich im Moment wie eine itemize-Umgebung,
% wobei \needspace einen Seitenumbruch unmittelbar nach ''Remarks:'' verhindert.
\newenvironment{remarks}[1][Remarks]{\vspace{\remarkskip}
\needspace{3\baselineskip}
\noindent\textbf{#1:}\begin{itemize}[leftmargin=1.5cm]}{\end{itemize}}
\hyphenation{dis-trib-ut-ed dro-soph-i-la drop-ped asyn-chro-nous
log-a-rith-mic Dijkstra}
% Definitions used in dynnetworks.tex
\usepackage[algo2e,boxed]{algorithm2e}
\newcommand{\msg}[2]{{\normalfont \texttt{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}}
\newcommand{\stage}[1]{\item[] \vspace{0.6em} \emph{#1} \vspace{0.6em}}
\newcommand{\algonote}[1]{\hspace{#1}$\triangleleft$}
\DeclareMathOperator{\tdist}{tdist}
\DeclareMathOperator{\shift}{shift}
\newcommand{\powerset}[1]{\mathcal{P}\left( #1 \right)}
\renewcommand{\vec}[1]{\underline{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\norm}[1]{\lVert #1 \rVert}
\newcommand{\st}{\medspace | \medspace}
% \newcommand{\coloneq}{:=}
\newcommand{\nat}{\mathbb{N}}
%\newcommand{\Vv}{V^{(2)}}
\newcommand{\Vv}{{V\choose 2}}
\newcommand{\MSG}{\mathit{MSG}}
\newcommand{\self}{\mathit{self}}
\newcommand{\var}[1]{\mathit{#1}}
\newcommand{\leader}{\mathit{leader}}
\newcommand{\committee}{\mathit{committee}}
\newcommand{\cost}{\mathit{cost}}
\newcommand{\acost}{\mathit{acost}}
\def\R{{\sf I\hspace*{-1pt}R}}
\def\OPT{{\rm OPT}}
\providecommand\given{}
\newcommand\SetSymbol[1][]{%
\nonscript\:#1\vert
\allowbreak
\nonscript
\:\mathopen{}}
\DeclarePairedDelimiterX\set[1]\{\}{%
\renewcommand\given{\SetSymbol[\delimsize]}
#1
}
%%%%% for failover chapter %%%%%
\usepackage{xcolor}
\usepackage{cancel}
\usepackage{pifont}
%%%%% end failover chapter %%%%%
%Here come definitions from Jukka's part. Some of them we should keep, and some we should adjust to our format
\newcommand{\PN}{PN}
\newcommand{\tPN}{PN}
\newcommand{\mydash}{\allowbreak\textemdash\allowbreak}
\newcommand{\Set}[1]{\{\, #1 \,\}}
\newcommand{\bigSet}[1]{\bigl\{\, #1 \,\bigr\}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\calF}{\mathcal{F}}
\newcommand{\NNpos}{\mathbb{Z}^+}
\newcommand{\func}[2]{{#1}\!\left(#2\right)}
\newcommand{\funcrm}[2]{\mathrm{#1}\!\left(#2\right)}
%\newcommand{\dist}[1]{\func{c_d}{#1}}
\newcommand{\energy}[1]{\func{c_E}{#1}}
\newcommand{\link}[1]{\func{c_\ell}{#1}}
\newcommand{\bigO}[1]{\funcrm{O}{#1}}
\newcommand{\mind}{d_0}
\newcommand{\omegamodel}{$\mathrm\Omega(1)$-model}
\DeclareMathOperator{\Input}{Input}
\DeclareMathOperator{\Output}{Output}
\DeclareMathOperator{\States}{States}
\DeclareMathOperator{\Msg}{Msg}
\DeclareMathOperator{\Init}{init}
\DeclareMathOperator{\Send}{send}
\DeclareMathOperator{\Receive}{receive}
\DeclareMathOperator{\Id}{id}
\newcommand{\algtoprule}{\rule{\columnwidth}{\heavyrulewidth}{}}
\newcommand{\algbottomrule}{\rule[1ex]{\columnwidth}{\heavyrulewidth}{}}
\newlist{descriptionb}{description}{1}
\setlist[descriptionb]{font=\normalfont\itshape,leftmargin=0pt,itemsep=1ex,style=unboxed}
% Algorithmic: atomically
\makeatletter
\AtBeginEnvironment{algorithmic}{%
\newcommand{\algorithmicupon}{\textbf{upon}}
\newcommand{\UPON}[2][default]{\ALC@it\algorithmicupon\ #2:\ %
\begin{ALC@upon}}%
\newcommand{\algorithmicendupon}{\algorithmicend\ \algorithmicupon}
\newenvironment{ALC@upon}{\begin{ALC@g}}{\end{ALC@g}}
\newcommand{\ENDUPON}{\end{ALC@upon}\ALC@it\algorithmicendupon}
}
%---- Figures ----
\newcounter{myexternalpagenum}
\newcommand{\definepage}[1]{\stepcounter{myexternalpagenum}\edef#1{\arabic{myexternalpagenum}}}
% \input{figlist.tex}
\newcommand{\mysf}[1]{\textup{\sffamily #1}}
\newcommand{\state}[1]{\mysf{#1}}
\newcommand{\longref}[2]{\ref{#2}}
\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}
% use wrapfigure for narrow images
\usepackage{wrapfig}
% Use this to compile only single chapters
% % INCLUDEONLY %
% % INCLUDEONLY % % a good start
% % INCLUDEONLY % % must come early! always fix the first 3 weeks.
% % INCLUDEONLY % % some basic definitions
% % INCLUDEONLY % % different model
% % INCLUDEONLY % % different model
% % INCLUDEONLY % % very much movable!
% % INCLUDEONLY % % randomization?
% % INCLUDEONLY % % first tough lower bound?
% % INCLUDEONLY % % different model
% % INCLUDEONLY % % maybe the first example of randomization?
% % INCLUDEONLY % % different view
% % INCLUDEONLY % % hard problems (late)
% % INCLUDEONLY % % different view
% % INCLUDEONLY %
% \includeonly{p2p} % practice, finally.
% \includeonly{dynnetworks}
% \includeonly{all2all}
%
%
% \includeonly{consensus} % schon im kernfach
% \includeonly{multicore} % todo: was soll man hier genau machen? eher in verteilten systemen?
% \includeonly{dominating}
% \includeonly{routing}
% \includeonly{routing2}
% keep the following line if you want to use build-all.sh
% INCLUDEONLY %
\begin{document}
\pagenumbering{arabic}
% \include{titlepage}
% \pagenumbering{roman}
% \setcounter{tocdepth}{1}
% \tableofcontents
% \cleardoublepage
%Uncomment TOC for final "book" version
% \tableofcontents
\mainmatter
% \pagenumbering{arabic}
% forces the new pages to start on even page nmbers according to the arabic numbering
% thus on odd pages in real life, i.e., the right side
% \makeatletter
% \renewcommand*\cleardoublepage{\clearpage\if@twoside
% \ifodd\c@page \hbox{}\newpage\if@twocolumn\hbox{}%
% \newpage\fi\fi\fi}
% \makeatother
\chapter{\chaptertitle}
\label{cha:self_stabilizing_algorithms}
Besides efficiency, fault-tolerance is arguably one of the
most important requirements of large-scale overlay networks.
At large scale, and when operating for long time periods, the
probability of even unlikely failures becomes substantial.
In particular, the assumption that all peers leave the network
gracefully, executing a pre-defined {\sc Leave} protocol, seems
unrealistic.
Rather, many peers are likely to leave unexpectedly (e.g., crash).
The situation becomes worse if the peer-to-peer system is under
attack.\\
% Intuitively, the larger and hence more popular the peer-to-peer system,
% the more attractive it also becomes for attackers.
% For example, Denial-of-Service (DoS) attacks or partitions of the underlying
% physical network may push the overlay network into an undesired state.
% Also other kinds of unexpected and uncooperative behaviors may emerge
% in large-scale networks with open membership,
% such as selfish peers aiming to obtain an unfair share of the resources.
% It is hence difficult in practice to rely on certain invariants and assumptions
% on what can and what cannot happen during the (possibly very long) lifetime of a
% peer-to-peer system. Accordingly, it is important that a distributed overlay
% network be able to recover from unexpected or even \emph{arbitrary} situations.
% This recovery should also be quick:
% once in an illegal state, the
% overlay network may be more vulnerable to further changes or attacks.
% This motivates the study of self-stabilizing peer-to-peer systems.
% Self-stabilzation is a very powerful concept in fault-tolerance.
A self-stabilizing algorithm guarantees to ``eventually'' converge to a desirable system state \emph{from any initial configuration}.
Indeed, a self-stabilizing system allows to survive arbitrary
failures, beyond Byzantine failures, including for instance a total
wipe out of volatile memory at all nodes.
Once the external or even adversarial changes stop, the system will
simply ``self-heal'' and converge to a correct state.\\
% In this chapter, we will study self-stabilizing algorithms for overlay
% networks, in the same framework as in Chapter
% \ref{cha:peer_to_peer_networks} on peer-to-peer networks.
% The idea of self-stabilization in distributed computing first appeared in a classical paper by E.W. Dijkstra
% in 1974~\cite{self-stab-di}, which considered the problem of designing a self-stabilizing token ring. Since Dijkstra's paper, self-stabilization has been studied in many contexts, including communication protocols, graph theory problems, termination detection, clock synchronization, and fault containment~\cite{shlomi-book}.
% In general, the design of self-stabilizing algorithms is fairly well-understood
% today. In particular,
% already in the late 1980s, very powerful results have been obtained
% on how any synchronous, not fault-tolerant local network algorithm can be transformed into a very robust, self-stabilizing algorithm which performs well both in synchronous and asynchronous environments~\cite{awerbuch1,awerbuch2,roger}.
% These transformations rely on synchronizers
% and on the (continuous) emulation of
% one-shot local network algorithms.
% While these transformations are attractive to strengthen the robustness of local algorithms \emph{on a given network topology}, e.g., for designing self-stabilizing spanning trees, they are not applicable, or only applicable at high costs, in overlay peer-to-peer networks whose topology is subject to change and optimization itself.
% Indeed, many decentralized overlay networks (including very well-known examples like Chord) are not self-stabilizing, in the sense that the proposed protocols only manage to recover the network from a restricted class of illegal states~\cite{jacm1,jacm2,jacm3}.
\section{Definitions}
\begin{definition}[Node State]
\label{def:node_state}
At a given time, the state of a node includes all variable
information stored at the node, excluding the messages in
transit.
\end{definition}
\begin{definition}[Node Action]
\label{def:node_action}
A node action is a local computation performed by a node that changes the node's state.
A local computation is a computation that involves only the node's state and the state of its neighbors.
\end{definition}
% \begin{definition}[Network State]
% \label{def:network_state}
% At a given time, the network state includes all messages currently
% in transit.
% \end{definition}
\begin{definition}[System State]
\label{def:system_state}
% At a given time, the system state is the state of all nodes plus the network state.
At a given time, the system state is the state of all nodes.
\end{definition}
\begin{definition}[Fair scheduler]
A scheduler determines the order in which the node actions are performed across the network.
We say that a scheduler is \emph{fair} if any enabled node action will eventually be executed.
\end{definition}
\begin{definition}[Legal State]
\label{def:legal_state}
Let $\mathcal{S}$ be the set of all system states, we call $L(\mathcal{S}) \subseteq \mathcal{S}$ the set of \emph{legal} states.
% Let $L : \mathcal{S} \mapsto \mathcal{S}$ be a function.
% Assume that a network $P$ is in a state $S \in \mathcal{S}$ at a
% given time, and that no failure or external error will ever occur.
% We say that a later network state $S ^{\prime}$ is \emph{legal} with
% respect to $S$ if $S ^{\prime} \in L(S)$.
\end{definition}
\begin{definition}[Self-Stabilization]
\label{def:self-stabilization}
A system is self-stabilizing with respect to a given set of states $\mathcal{S}$ and legal states $L(\mathcal{S})$, if the following requirements are fulfilled when no failure or external error occurs and if the graph stops changing:
\begin{itemize}
\item \emph{Convergence:}
For all initial states $S$ and all fair executions, the system eventually reaches a legal state $S'$ with $S'\in L(\mathcal{S})$.
\item \emph{Closure:}
For all legal initial states $S$, also each subsequent state is legal.
\end{itemize}
\end{definition}
\begin{remarks}
\item
A topological self-stabilizing mechanism must guarantee
\emph{convergence} and \emph{closure} properties: by local
neighborhood changes (i.e., by creating, forwarding and deleting
links with neighboring nodes), the nodes will eventually form an
overlay topology with desirable properties (e.g., polylogarithmic
degree and diameter) from any initial topology.
The system will also stay in a desirable configuration provided
that no further external topological changes occur.
\item
The self-stabilizing overlay network design problem involves an adversary which can add, remove or change any node or link in the overlay network.
\item
As soon as the adversary stops manipulating the overlay
topology, say at some unknown time $t_0$, the self-stabilization
protocols will ensure that eventually, and in the absence of
further adversarial changes, a desired topology is reached.
\item
In order for a distributed self-stabilizing algorithm to recover
any connected topology, the initial topology must at least be
\emph{weakly connected}.
\end{remarks}
% \begin{remarks}
% \item \julien{already said below}
% A topologically self-stabilizing algorithm can never cut
% a path between two nodes: it may happen that this path is the
% only connection between two otherwise disconnected components.
% Once the network is disconnected, connectivity can never be
% established again.
% \item
% We assume that all the network topology that we discuss in this
% chapter are at least weakly connected.
% \item
% We want to be able to move the network topology from any
% topology to any other topology.
% It may seem impossible since we cannot remove edges.
% \end{remarks}
\begin{condition} \label{conn}
We require that the network eventually becomes weakly connected, even for a short period of time.
We call $t_0$ the time when the network becomes weakly connected.
% At $t_0$, the peers are weakly connected to each other.
\end{condition}
\begin{remarks}
\item
The time $t_0$ when the network becomes weakly connected is not known.
A self-stabilizing algorithm must therefore run continuously and constantly check for inconsistencies.
\item
A topologically self-stabilizing algorithm can never remove a link without creating new ones: It may happen that this link is the only link connecting two otherwise disconnected components.
\item
A self-stabilizing algorithm must still be able to move from any topology to any other topology, which clearly involves edge deletion.
The solution is to locally ``move'' edges by changing its endpoints in an atomic manner.
\item
Another fundamental implication of the self-stabilization concept is that self-stabilizing algorithms cannot cycle through multiple stages during their execution.
For instance, it may be tempting to try to design an algorithm which, given the initial weakly-connected connected topology, first converts the topology into a clique graph, a ``full-mesh''; once in the clique state, any desirable target topology could be achieved efficiently, simply be removing (i.e., merging) unnecessary links.
The problem with this strategy is twofold:
\begin{enumerate}
\item
Self-stabilizing algorithms can never assume a given stage of the stabilization has been reached, and based on this assumption, move into a different mode of stabilization.
The problem is that this assumption can be violated anytime by the adversary, ruining the invariant and hence correctness of the stabilization algorithm.
\item
The \emph{transient} properties of the dynamic topology, i.e., the topological properties during convergence, may be undesirable: even though the initial and the final peer degrees may be low, the intermediate clique topology has a linear degree and hence does not scale.
\end{enumerate}
\end{remarks}
% \julien{I dont get this!!}
% Designing a topological self-stabilizing algorithm is non-trivial for several reasons.
% First, as the time $t_0$ is not known to the self-stabilizing algorithm, the self-stabilizing procedure must run continuously, respectively, \emph{local detectability} is required: \emph{at least one peer should notice (i.e., locally detect) an inconsistency}, if it exists.
% This peer can then trigger (local or global) convergence.
% Moreover, a key insight is that a topologically self-stabilizing algorithm can never remove links: it may happen that this link is the only link connecting two otherwise disconnected components.
% Clearly, once disconnected, connectivity can never be established again.
% Now one may wonder how a self-stabilizing algorithm starting (at $t_0$) from a super-graph of the target topology will ever be able to reach the desired topology without edge deletion.
% The answer is simple: while an edge cannot be removed, it can be \emph{moved} resp.~\emph{delegated} (e.g., one or both of its endpoints can be forwarded to neighboring peers) and \emph{merged} (with parallel edges).
% Another fundamental implication of the self-stabilization concept is that self-stabilizing algorithms cannot cycle through multiple stages during their execution.
% For instance, it may be tempting to try to design an algorithm which, given the initial weakly connected topology, first converts the topology into a clique graph, a ``full-mesh''; once in the clique state, any desirable target topology could be achieved efficiently, simply be removing (i.e., merging) unnecessary links.
% The problem with this strategy is twofold:
% \begin{enumerate}
% \item Self-stabilizing algorithms can never assume a given stage of the stabilization has been reached, and based on this assumption, move into a different mode of stabilization. The problem is that this assumption can be violated anytime by the adversary, ruining the invariant and hence correctness of the stabilization algorithm.
% \item The \emph{transient} properties of the dynamic topology, i.e., the topological properties during convergence, may be undesirable: even though the initial and the final peer degrees may be low, the intermediate clique topology has a linear degree and hence does not scale.
% \end{enumerate}
% Given these intuitions, we will next identify
% fundamental connectivity primitives and
% topological operations which are sufficient and necessary to transform
% any initial network into any other network.
% Subsequently, we will discuss how these primitives can be
% exploited systematically for the design of distributed algorithms.
% Finally, we present two case studies for topological self-stabilization:
% self-stabilizing linearization and the self-stabilizing construction of
% skip graphs.
% \subsection{Universal Primitives for Reliable Connectivity}
% \begin{definition}[Link]
% A directed \emph{link} $(u,v)$ means that $u$ knows $v$.
% \end{definition}
% % This section identifies \emph{universal connectivity primitives}: local graph operations which allow us to transform any topology into any other topology.
% % While we in this section focus on feasibility, we will later use these primitives to design topologically self-stabilizing algorithms.
% % Let us first define the notion of links $(u,v)$.
% % Links can either be explicit or implicit.
% % An explicit link $(u,v)$ (in the following depicted as solid line) means that $u$ knows $v$, i.e., $u$ stores a reference of $v$ (e.g., $v$'s IP address).
% % An implicit link $(u,v)$ (depicted as dashed line) means that a message including $v$'s reference is currently in transit to $u$ (from some arbitrary sender).
% % We are often interested in the union of the two kinds of links.
% % As discussed above, a first most fundamental principle in the design of distributed self-stabilizing algorithms is that links can never be deleted:
% % \begin{rulex}
% % During the execution of a topologically self-stabilizing algorithm,
% % weak connectivity must always be preserved. In particular, a pointer
% % (i.e., information about a peer) can never be deleted.
% % \end{rulex}
% \begin{definition}[Connectivity Primitives]
% \label{def:connectivity_primitives}
% We identify four basic primitives which preserve connectivity (cf.~Figure~\ref{fig:primitives}):
% % \textsc{Introduce},
% % \textsc{Forward},
% % \textsc{Merge},
% % \textsc{Invert}.
% \begin{enumerate}
% \item
% \textsc{Introduce}: Assume node $u$ has a pointer to nodes $v$ and $w$: there are two directed links $(u,v)$ and $(u,w)$.
% Then, $u$ can introduce $w$ to $v$ by sending the pointer to $w$ to $v$.
% \item
% \textsc{Forward}: Assume node $u$ has a pointer to nodes $v$ and $w$.
% Then, $u$ can send the pointer to $w$ to $v$ and delete the reference to $w$.
% \item
% \textsc{Merge}: If $u$ has two pointers to $v$, i.e., $(u,v)$ and $(u,v)$, then $u$ can merge the two.
% \item
% \textsc{Invert}: If $u$ is connected to $v$, it can invert the link $(u,v)$ to $(v,u)$ by forwarding a pointer to itself to $v$, and delete the
% reference to $v$.
% \end{enumerate}
% \end{definition}
% \begin{figure}[H]
% \begin{center}
% %\epsfig{figure=decompose.eps,width=.60\textwidth}
% \includegraphics[width=0.79\textwidth]{primitives}\\
% \end{center}
% \caption{Basic connectivity primitives.} \label{fig:primitives}
% \end{figure}
% \begin{remarks}
% \item
% Those primitives preserve connectivity.
% The \textsc{Introduce}, \textsc{Forward}, and \textsc{Merge} operations even preserve strong connectivity.
% % \item
% % In the following, we first show that three of them are sufficient to transform any weakly connected graph into any strongly connected graph.
% % In other words, they are \emph{weakly universal}.
% % \item
% % Subsequently, we show that all four of them together are even \emph{universal}: they are sufficient to transform any weakly connected graph into any weakly connected graph.
% \end{remarks}
% % It is easy to see that these primitives indeed preserve weak connectivity.
% % In fact, the \textsc{Introduce}, \textsc{Forward}, and \textsc{Merge} operations even preserve strong connectivity.
% % We also note that we need a compare operation to implement the merge operation: namely, we need to be able to test whether
% % two references point to the same node.
% % These operations turn out to be very powerful.
% % In the following, we first show that three of them are sufficient to transform any weakly connected graph into any strongly connected graph.
% % In other words, they are \emph{weakly universal}.
% % Subsequently, we show that all four of them together are even \emph{universal}: they are sufficient to transform any weakly connected graph into any weakly connected graph.
% % Finally, we prove that these primitives are also necessary.
% \begin{theorem}\label{thm:wuniversal}
% The three primitives \textsc{Introduce}, \textsc{Forward}, and \textsc{Merge} are \emph{weakly universal}: they are sufficient to turn any weakly connected graph $G=(V,E)$ into any strongly connected graph $G'=(V,E')$.
% \end{theorem}
% \begin{proof}
% Let us provide some intuition why this theorem is true.
% Note that we only need to prove feasibility, i.e., that a transformation exists; how to devise a distributed algorithm that finds such a transformation is only discussed later in this chapter.
% The proof proceeds in two stages, from $G=(V,E)$ to the clique, and from the clique to $G'=(V,E')$.
% From the definition of weak connectivity, it follows that for any two nodes $v$ and $w$, there is a path from $v$ to $w$ (ignoring link directions).
% It is easy to see that if in each communication round, each node introduces its neighbors to each other as well as itself to its neighbors, we reach a complete network (the clique) after $O(\log{n})$ communication rounds.
% So now assume $G=(V,E)$ is a clique.
% Then using \textsc{Forward} and \textsc{Merge} operations, we can transform $G$ into $G'$ using the following steps (without removing edges in $G'$):
% \begin{enumerate}
% \item Let $(u,w)$ be an arbitrary edge which
% needs to be removed, i.e., $(u,w)\not\in E'$.
% Since $G'=(V,E')$ is strongly connected,
% there is a shortest directed path
% from $u$ to $w$ in $G'$. Let
% $v$ be the next node along this path.
% \item Node $u$ forwards (``delegates'')
% $(u,w)$ to $v$, i.e., $(u,w)$ becomes $(v,w)$.
% This reduces the distance between an unused node
% pair in $G'$ by 1.
% \item Since the maximal distance is $n-1$,
% the distance of a superfluous edge
% can be reduced at most $n-1$ many times before
% it merges with an edge in $G'$.
% Thus, we eventually obtain $G'$.
% \end{enumerate}
% \end{proof}
% \begin{theorem}\label{thm:universal}
% The four primitives \textsc{Introduce},
% \textsc{Forward},
% \textsc{Merge}, and
% \textsc{Invert}
% are universal:
% they are sufficient to turn any weakly connected graph $G=(V,E)$
% into any weakly
% connected graph $G'=(V,E')$.
% \end{theorem}
% We again provide some intuition for this theorem:
% \begin{enumerate}
% \item Let $G''=(V,E'')$ be the graph in which
% for each edge $(u,v)\in E'$,
% both edges $(u,v)$ and $(v,u)$
% are in $E''$. Note that $G''$
% is strongly connected.
% \item According to Theorem~\ref{thm:wuniversal},
% it is possible to transform any $G$ to
% $G''$.
% \item In order to transform $G''$ to $G'$,
% we need the \textsc{Invert} primitive,
% to remove undesired edges:
% we invert any undesired edge $(u,v)$ to $(v,u)$
% and then merge it with $(v,u)$.
% \end{enumerate}
% Interestingly, the primitives are not only sufficient but
% also necessary.
% \begin{theorem}
% The four primitives \textsc{Introduce},
% \textsc{Forward},
% \textsc{Merge}, and
% \textsc{Invert}
% are also necessary.
% \end{theorem}
% The reason is that
% \textsc{Introduce} is the only primitive
% which generates an edge,
% \textsc{Forward} is the only primitive which
% separates a node pair,
% \textsc{Merge} is the only primitive which
% removes an edge, and
% \textsc{Inversion} is the only primitive
% rendering a node unreachable.
% \subsection{Distributed Algorithms for Self-Stabilization}
% In the previous section we have presented universal primitives
% that allow to transform any weakly-connected graph $G$
% into any weakly-connected graph $G'$.
% However, the mere \emph{existence}
% or \emph{feasibility} of such transformations
% is often not interesting in practice, if there do
% not exist efficient distributed algorithms
% to find a transformation.
% In the following, we will show how to devise
% distributed algorithms exploiting our
% primitives to render systems truly self-stabilizing.
% We first need to introduce some terminology.
% We first differentiate between the following
% notions of \emph{state}.
% \begin{enumerate}
% \item \emph{State of a process:} The state of a process
% includes all variable information stored
% at the process, excluding the messages in transit.
% \item \emph{State of the network:} The network states
% includes all messages currently
% in transit.
% \item \emph{State of the system:} The system state is the
% state of all proceses
% plus the network state.
% \end{enumerate}
% Reformulating our objective accordingly, we aim to transition from any initial network state $S$ to a legal network state $S'(S)$.
% For the algorithm design, we usually assume node actions to be \emph{locally atomic}: at each moment in time, a process executes a single action. Multiple processes however may execute multiple actions simultaneously: actions are not globally atomic.
% Moreover, it is usually assumed that the scheduler is fair: every enabled node action will eventually be executed.
% Concretely, we consider the following action types:
% \begin{enumerate}
% \item \emph{Name(Object-List) $\rightarrow$ Commands}:
% \begin{enumerate}
% \item A local call of action $A$ is executed
% immediately.
% \item \emph{Incoming Request}:
% The corresponding action will eventually be scheduled
% (the request never expires).
% \end{enumerate}
% \item \emph{Name: Predicate $\rightarrow$ Commands}:
% The rule will only be executed in finite time if the the predicate
% is always enabled, e.g., the rule does not time out.
% \end{enumerate}
% Independently of the initial states as well as
% possible messages in transit, a self-stabilizing system
% should fulfill the following crteria:
% \begin{definition}
% A system is self-stabilizing with respect to a given
% network problem $P$,
% if the following requirements are fulfilled when
% no failure or external error occurs and if nodes are static:
% \item \emph{Convergence:}
% For all initial states $S$ and all fair executions,
% the system eventually reaches a state $S'$ with $S'\in L(S)$:
% a legal state.
% \item \emph{Closure:}
% For all legal initial states $S$, also each subsequent state is legal.
% \end{definition}
% A central requirement in topologically
% self-stabilizing system is the \emph{monotonicity of reachability}:
% if $v$ is reachable from $u$ at time $t$, using
% explicit or implicit edges, then, if no further
% failures or errors occur and given a static node set,
% $v$ is also reachable from $u$
% at any time $t'>t$.
% The following theorem can easily
% be proved using induction, as long as
% there are no references to non-existent
% nodes in the system.
% \begin{theorem}\label{thm:monotonic}
% The \textsc{Introduce},
% \textsc{Forward},
% and \textsc{Merge} operations fulfill
% monotonic reachability.
% \end{theorem}
% Remarks:
% \begin{enumerate}
% \item
% One particularly annoying challenge in the design of
% self-stabilizing algorithms is due to the fact that
% there may still be corrupt messages in transit in the system.
% Such messages can threaten the correctness of an algorithm
% later.
% \item
% In particular, corrupted message may violate the closure property:
% although initially in a legal state,
% the system may move to an illegal state.
% \item
% The set of legal states is hence only a subset of
% the ``correct states''.
% \end{enumerate}
% In general, the following performance metrics are most relevant in topological self-stabilization:
% \begin{enumerate}
% \item \emph{Convergence Time:} Assuming a synchronous environment
% (or assuming an upper bound on the message transmission per link),
% the distributed convergence time measures
% how many (parallel) communication rounds are required until the final
% topology is reached.
% \item \emph{Work:} The work measures how many
% edges are inserted, changed, or removed in total, during the covergence
% process.
% \item \emph{Locality:} While a self-stabilizing algorithm by definition
% will re-establish a desired property from \emph{any} initial configuration,
% it is desirable that the parallel convergence time as well as the overall
% work is proportional to ``how far'' the initial topology is from the desired
% one. In particular, if there are only one or two links missing,
% it should be possible to handle these situations more efficiently
% than performing a complete stabilization.
% Similarly, single peer \textsc{Join}
% and \textsc{Leave} operations should be efficient
% (in terms of time and work).
% \item \emph{Transient Behavior:} While the initial and the final
% network topologies are given, it is desirable that during convergence,
% only efficient topologies transiently emerge. For example, it may be
% desirable that no topology during convergence will have a higher degree
% or diameter than the initial or the final topology.
% \end{enumerate}
% Usually, we do not assume synchronous executions
% or that nodes process requests at the same speed.
% Rather, requests may be processed asynchronously.
% In order to measure time in asynchronous
% executions, we use the notion of a round:
% in a round, each node which has to process
% one or more requests, completed
% at least one of these requests.
% The time complexity is measured in
% terms of number of rounds (usually
% in the worst-case).
% \subsubsection{Case Study Linearization}
% Linearization is a most simple example for topological self-stabilization~\cite{tocs13,tcs12ss,concur16}:
% essentially, we are looking for a local-control strategy
% for converting an arbitrary connected graph (with unique node IDs) into a sorted list.
% In order to provide some intuition and for the sake of simplicity, let us assume an undirected network topology, where peers have unique identifiers.
% In order to sort and linearize this overlay network in a distributed manner,
% two basic rules are sufficient, defined over node triples (cf.~Figure~\ref{fig:linearize}):
% \begin{enumerate}
% \item \emph{Linearize right:} Any node $u$ which currently has two neighbors $v,w$ with larger IDs than its own ID, i.e., $u<v<w$, introduces these two nodes to each other, essentially forwarding the edge. That is, the edge $\{u,w\}$ is forwarded from $u$ to $v$ and becomes
% edge $\{v,w\}$.
% \item \emph{Linearize left:} Any node $w$ which currently has two neighbors $u,v$ with lower IDs than its own ID, i.e., $u<v<w$, introduces these two nodes to each other, essentially forwarding the edge. That is, the edge $\{u,w\}$ is forwarded from $w$ to $v$ and becomes
% edge $\{u,v\}$.
% \end{enumerate}
% \begin{figure}[ht]
% \begin{center}
% %\epsfig{figure=decompose.eps,width=.60\textwidth}