<s>
The	O
Dijkstra	B-Operating_System
–	I-Operating_System
Scholten	I-Operating_System
algorithm	I-Operating_System
(	O
named	O
after	O
Edsger	O
W	O
.	O
Dijkstra	O
and	O
Carel	O
S	O
.	O
Scholten	O
)	O
is	O
an	O
algorithm	O
for	O
detecting	O
termination	O
in	O
a	O
distributed	B-Architecture
system	I-Architecture
.	O
</s>
<s>
First	O
,	O
consider	O
the	O
case	O
of	O
a	O
simple	O
process	O
graph	O
which	O
is	O
a	O
tree	B-Application
.	O
</s>
<s>
A	O
distributed	B-Architecture
computation	I-Architecture
which	O
is	O
tree-structured	O
is	O
not	O
uncommon	O
.	O
</s>
<s>
Such	O
a	O
process	O
graph	O
may	O
arise	O
when	O
the	O
computation	O
is	O
strictly	O
a	O
divide-and-conquer	B-Algorithm
type	O
.	O
</s>
<s>
A	O
node	B-Protocol
starts	O
the	O
computation	O
and	O
divides	O
the	O
problem	O
in	O
two	O
(	O
or	O
more	O
,	O
usually	O
a	O
multiple	O
of	O
2	O
)	O
roughly	O
equal	O
parts	O
and	O
distribute	O
those	O
parts	O
to	O
other	O
processors	O
.	O
</s>
<s>
The	O
Dijkstra	B-Operating_System
–	I-Operating_System
Scholten	I-Operating_System
algorithm	I-Operating_System
is	O
a	O
tree-based	O
algorithm	O
which	O
can	O
be	O
described	O
by	O
the	O
following	O
:	O
</s>
<s>
The	O
initiator	O
of	O
a	O
computation	O
is	O
the	O
root	O
of	O
the	O
tree	B-Application
.	O
</s>
<s>
If	O
the	O
receiving	O
process	O
is	O
currently	O
not	O
in	O
the	O
computation	O
:	O
the	O
process	O
joins	O
the	O
tree	B-Application
by	O
becoming	O
a	O
child	O
of	O
the	O
sender	O
of	O
the	O
message	O
.	O
</s>
<s>
When	O
a	O
process	O
has	O
no	O
more	O
children	O
and	O
has	O
become	O
idle	O
,	O
the	O
process	O
detaches	O
itself	O
from	O
the	O
tree	B-Application
by	O
sending	O
an	O
acknowledgment	O
message	O
to	O
its	O
tree	B-Application
parent	O
.	O
</s>
<s>
For	O
a	O
tree	B-Application
,	O
it	O
is	O
easy	O
to	O
detect	O
termination	O
.	O
</s>
<s>
The	O
algorithm	O
for	O
a	O
tree	B-Application
can	O
be	O
extended	O
to	O
acyclic	O
directed	O
graphs	O
.	O
</s>
<s>
When	O
a	O
node	B-Protocol
wishes	O
to	O
terminate	O
,	O
it	O
waits	O
until	O
it	O
has	O
received	O
signals	O
from	O
outgoing	O
edges	O
reducing	O
their	O
deficits	O
to	O
zero	O
.	O
</s>
<s>
This	O
is	O
because	O
,	O
there	O
may	O
not	O
be	O
any	O
node	B-Protocol
with	O
zero	O
outgoing	O
edges	O
.	O
</s>
<s>
So	O
,	O
potentially	O
there	O
is	O
no	O
node	B-Protocol
which	O
can	O
terminate	O
without	O
consulting	O
other	O
nodes	O
.	O
</s>
<s>
The	O
Dijkstra	B-Operating_System
–	I-Operating_System
Scholten	I-Operating_System
algorithm	I-Operating_System
solves	O
this	O
problem	O
by	O
implicitly	O
creating	O
a	O
spanning	O
tree	B-Application
of	O
the	O
graph	O
.	O
</s>
<s>
A	O
spanning-tree	O
is	O
a	O
tree	B-Application
which	O
includes	O
each	O
node	B-Protocol
of	O
the	O
underlying	O
graph	O
once	O
and	O
the	O
edge-set	O
is	O
a	O
subset	O
of	O
the	O
original	O
set	O
of	O
edges	O
.	O
</s>
<s>
The	O
tree	B-Application
will	O
be	O
directed	O
(	O
i.e.	O
,	O
the	O
channels	O
will	O
be	O
directed	O
)	O
with	O
the	O
source	O
node	B-Protocol
(	O
which	O
initiates	O
the	O
computation	O
)	O
as	O
the	O
root	O
.	O
</s>
<s>
The	O
spanning-tree	O
is	O
created	O
in	O
the	O
following	O
way	O
.	O
</s>
<s>
A	O
variable	O
First_Edge	O
is	O
added	O
to	O
each	O
node	B-Protocol
.	O
</s>
<s>
When	O
a	O
node	B-Protocol
receives	O
a	O
message	O
for	O
the	O
first	O
time	O
,	O
it	O
initializes	O
First_Edge	O
with	O
the	O
edge	O
through	O
which	O
it	O
received	O
the	O
message	O
.	O
</s>
<s>
Note	O
that	O
,	O
the	O
spanning	O
tree	B-Application
is	O
not	O
unique	O
and	O
it	O
depends	O
on	O
the	O
order	O
of	O
messages	O
in	O
the	O
system	O
.	O
</s>
<s>
Termination	O
is	O
handled	O
by	O
each	O
node	B-Protocol
in	O
three	O
steps	O
:	O
</s>
<s>
(	O
Each	O
node	B-Protocol
will	O
send	O
signals	O
which	O
reduces	O
the	O
deficit	O
on	O
each	O
incoming	O
edge	O
to	O
zero	O
.	O
)	O
</s>
<s>
(	O
Once	O
steps	O
1	O
and	O
2	O
are	O
complete	O
,	O
a	O
node	B-Protocol
informs	O
its	O
parent	O
in	O
the	O
spanning	O
tree	B-Application
about	O
its	O
intention	O
of	O
terminating	O
.	O
)	O
</s>
