-
Notifications
You must be signed in to change notification settings - Fork 1
/
actorgc.lyx
4753 lines (3760 loc) · 104 KB
/
actorgc.lyx
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
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass extreport
\use_default_options true
\begin_modules
fixltx2e
fix-cm
theorems-ams-bytype
\end_modules
\maintain_unincluded_children false
\language british
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 1
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Chapter
\begin_inset CommandInset label
LatexCommand label
name "chap:Actor-Collection"
\end_inset
Actor Collection
\end_layout
\begin_layout Standard
The disposal of dead actors (those no longer required for computation or
I/O) in actor-model languages is as important as disposal of unreachable
objects in object-oriented languages.
Actor-model languages must know when an actor has terminated in order to
free resources dedicated to the actor.
Most existing actor-model languages and libraries do not attempt to solve
this problem, instead requiring the programmer to explicitly manage every
actor's lifetime
\begin_inset CommandInset citation
LatexCommand cite
key "armstrong2007history,haller2009scala,van2008ambient,varela2001programming,srinivasan2008kilim"
\end_inset
.
\end_layout
\begin_layout Standard
The very problems that actor-model programming excels at addressing (including
concurrency, scalability, and simplicity) have made actor garbage collection
problematic, due to the difficulty of observing the global state of a program.
As a result, actor-model systems in applications which create many short-lived
actors become either more difficult to program (when they require manually
terminating actors) or encounter performance problems (when they have actor
garbage collection that is not fully concurrent).
\end_layout
\begin_layout Standard
A language which does not provide garbage collection of actors will require
a facility to explicitly terminate actors.
This will also require the language to provide a default behaviour when
a message is sent to a terminated actor, the ability to distinguish at
runtime between terminated and non-terminated actors, and possibly notification
mechanisms for actor termination.
\end_layout
\begin_layout Standard
Pony uses a novel technique for garbage collection of actors, called Message-bas
ed Actor Collection (
\emph on
MAC
\emph default
), that satisfies the following goals:
\end_layout
\begin_layout Enumerate
\emph on
Soundness:
\emph default
the technique collects only dead actors.
\end_layout
\begin_layout Enumerate
\emph on
Completeness:
\emph default
the technique collects all dead actors eventually.
\end_layout
\begin_layout Enumerate
\emph on
Concurrency:
\emph default
the technique does not require a stop-the-world step, thread coordination,
actor introspection, shared memory, read/write barriers or cache coherency.
\end_layout
\begin_layout Standard
When an actor has completed local execution and has no pending messages
on its queue, it is
\emph on
blocked
\emph default
.
An actor is
\emph on
dead
\emph default
if it is blocked and all actors that have a reference to it are blocked,
transitively.
Collection of dead actors depends on being able to collect closed cycles
of blocked actors.
\end_layout
\begin_layout Standard
This approach is inspired by previous work on distributed garbage collection
of passive objects using distributed reference counting and a secondary
mechanism to collect cyclic garbage
\begin_inset CommandInset citation
LatexCommand cite
key "lisk86,bacon2001concurrent,moreau2001construction,moreau2005birrell"
\end_inset
.
Detection of cycles of objects is based on their
\emph on
topology,
\emph default
which is essentially the number of incoming references and the identities
of all outgoing references.
As such, the topology of an actor consists of the number of incoming references
from actors, the set of outgoing references to actors, and a flag indicating
whether the actor is blocked.
A dedicated actor, called the
\emph on
cycle detector
\emph default
, keeps track of the actor topology and detects any cycles.
\end_layout
\begin_layout Standard
The core challenge is that the true topology of an actor is a concept distribute
d across all of the actors: it changes not only when the actor mutates,
but also when other actors mutate.
An actor's view of its topology may be out of sync with the true topology,
and the cycle detector's view of an actor's topology may be out of sync
with the actor's view of its topology.
This differs radically from previous work on distributed object cycle detection
, where objects must either be immutable or cycle detection must monitor
mutation
\begin_inset CommandInset citation
LatexCommand cite
key "lins2003lazy,jones1993cyclic,de2007new"
\end_inset
.
\end_layout
\begin_layout Standard
This technique uses the message passing paradigm at the heart of the actor-model
: when an actor blocks, it sends a snapshot of its view of its topology
to the cycle detector.
The cycle detector in turn detects cycles based on its view of the topology
of blocked actors.
Because the cycle detector operates on its own view of the blocked actor
topology rather than stopping execution or monitoring mutation, cycles
may be detected based on a view of the topology that is out of date.
This is overcome with a confirmation protocol that allows the cycle detector
to determine whether or not its view of the blocked actor topology is the
same as the true topology, without stopping execution, monitoring mutation,
or examining any actor's state.
\end_layout
\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:Background"
\end_inset
Background on Garbage Collection of Actors
\end_layout
\begin_layout Standard
Existing actor-model languages and libraries use three approaches to garbage
collection of actors.
\end_layout
\begin_layout Standard
The first approach is to require the programmer to manually terminate actors.
Many existing actor-model languages and libraries, such as Erlang
\begin_inset CommandInset citation
LatexCommand cite
key "armstrong2007history"
\end_inset
, Scala
\begin_inset CommandInset citation
LatexCommand cite
key "haller2009scala"
\end_inset
, AmbientTalk
\begin_inset CommandInset citation
LatexCommand cite
key "van2008ambient"
\end_inset
, SALSA 2.0
\begin_inset CommandInset citation
LatexCommand cite
key "varela2001programming"
\end_inset
, Kilim
\begin_inset CommandInset citation
LatexCommand cite
key "srinivasan2008kilim"
\end_inset
, and Akka, do not garbage collect actors at all.
All of these except Kilim support actors on distributed nodes, although
only SALSA supports manual migration of actors to new nodes.
None support distributed scheduling or automatic migration.
\end_layout
\begin_layout Standard
The second approach is to transform the actor graph into an object graph
and use a tracing garbage collector to collect actors
\begin_inset CommandInset citation
LatexCommand cite
key "kafura1990garbage,vardhan2002using,wang2010actor"
\end_inset
, as done in ActorFoundry.
This requires shared memory, cache coherency, and a stop-the-world step.
This approach allows actors to be collected using the same collector used
for passive objects, but cannot be used across distributed nodes.
\end_layout
\begin_layout Standard
The third approach, used in SALSA 1.0
\begin_inset CommandInset citation
LatexCommand cite
key "wang2006distributed"
\end_inset
, uses reference listing (whereby an actor keeps a complete list of every
other actor that references it) and monitoring of actor mutation to build
conservative local snapshots which are assembled into a global snapshot.
This requires write barriers for actor mutation (which requires shared
memory and cache coherency), a global synchronisation agent, and coordination
of local snapshots within an overlapping time range.
These snapshots are used with the pseudo-root algorithm, which additionally
requires acknowledgement messages for all asynchronous messages, inverse
reference listing, and a multiple-message protocol for reference passing
\begin_inset CommandInset citation
LatexCommand cite
key "wang2006non,wang2013conservative"
\end_inset
.
Like SALSA 2.0, SALSA 1.0 supports distributed nodes and manual actor migration.
\end_layout
\begin_layout Standard
None of these approaches provides a fully concurrent method for garbage
collection of actors.
\end_layout
\begin_layout Subsection
Distributed Passive Object Collection
\end_layout
\begin_layout Standard
The literature on distributed passive object collection is vast, and so
only key differences will be briefly mentioned here.
Pony's
\emph on
MAC
\emph default
has been inspired not just by previous work in actor collection, but also
by work in concurrent cycle detection
\begin_inset CommandInset citation
LatexCommand cite
key "bacon2001concurrent"
\end_inset
and distributed reference counting
\begin_inset CommandInset citation
LatexCommand cite
key "moreau2001construction,moreau2005birrell,jones1993cyclic,lins2003lazy,de2007new"
\end_inset
for passive object collection.
Some of these approaches do not address cyclic garbage
\begin_inset CommandInset citation
LatexCommand cite
key "moreau2001construction,moreau2005birrell"
\end_inset
.
Others require either immutable passive objects or a synchronisation mechanism
between the cycle detector and the mutator, which makes them inapplicable
to actor collection
\begin_inset CommandInset citation
LatexCommand cite
key "bacon2001concurrent,jones1993cyclic,lins2003lazy,de2007new"
\end_inset
.
Others use dynamic process groups to partially trace the distributed object
graph, trading completeness for promptness, and requiring mutators to pause
only during the local portion of such a partial trace
\begin_inset CommandInset citation
LatexCommand cite
key "rodr98,rodr98a"
\end_inset
.
\end_layout
\begin_layout Subsection
Differences From Existing Approaches
\end_layout
\begin_layout Standard
\emph on
MAC
\emph default
differs significantly from previous work.
Unlike distributed passive object collection, no restriction on actor mutation
or monitoring of mutation is required in order to detect cyclic garbage,
and no reference listing, indirection cells, or diffusion trees (a technique
whereby nodes keep a trail of object references they have passed, which
can lead to zombie nodes) are required.
Unlike the pseudo-root approach, acknowledgement messages are only required
when actors are actually collected, no reference listing is required, no
message round-trips are required, and no snapshot integration or time ranges
are required.
As a result,
\emph on
MAC
\emph default
requires significantly less overhead.
In addition, because
\emph on
MAC
\emph default
does not require thread coordination or cache coherency, it does not become
less efficient as core count increases.
\end_layout
\begin_layout Standard
Some approaches to distributed passive object collection are fault-tolerant
\begin_inset CommandInset citation
LatexCommand cite
key "plainfosse1995survey"
\end_inset
.
In order to make distributed garbage collection fault-tolerant, it is necessary
to detect and handle failure and often also to track a global view of time.
\end_layout
\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:The-Algorithm"
\end_inset
Message-based Actor Collection Algorithm
\end_layout
\begin_layout Standard
The
\emph on
MAC
\emph default
algorithm extends the operational semantics from chapter
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Syntax-and-Operational"
\end_inset
to allow actors to be garbage collected when they have no pending messages
and will never again have pending messages, that is, when the actor is
\emph on
dead
\emph default
.
To do so, firstly, the definition of an actor is extended to keep track
of its own
\emph on
local reference count
\emph default
, a map of actor addresses to
\emph on
foreign reference counts
\emph default
, and a flag to indicate whether or not the actor is
\emph on
blocked
\emph default
.
Secondly, new message types are added to allow reference counts to be changed
in an asynchronous way.
Finally, a
\emph on
cycle detector
\emph default
actor is added to the system that can correctly detect and collect isolated
cyclic graphs of dead actors.
\end_layout
\begin_layout Standard
Effectively,
\emph on
MAC
\emph default
is an eventual consistency algorithm for for communicating the
\emph on
true topology
\emph default
of an actor graph to a cycle detector without any actor (including the
cycle detector) examining another actor's state.
\end_layout
\begin_layout Standard
Note that without causality,
\emph on
MAC
\emph default
does not hold without modification.
This is discussed in section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:distributed-actor-GC"
\end_inset
, where an extension of
\emph on
MAC
\emph default
is proposed that does not require causal ordering.
\end_layout
\begin_layout Subsection
Topology
\end_layout
\begin_layout Standard
The
\emph on
true topology
\emph default
of the system is the directed graph of actor reachability.
Because actors execute concurrently, it is not possible to efficiently
track the true topology.
Instead, each actor maintains a view of its own topology, consisting of
a reference count (indicating the number of incoming graph edges) and an
\emph on
external map
\emph default
of potentially reachable actors (the outgoing edges) to
\emph on
foreign reference counts
\emph default
for those actors.
\end_layout
\begin_layout Standard
The actor's view can disagree with the true topology.
When an actor
\begin_inset Formula $\iota_{1}$
\end_inset
sends a reference to itself to another actor
\begin_inset Formula $\iota_{2}$
\end_inset
, it can immediately update its reference count, maintaining agreement with
the true topology.
However, if
\begin_inset Formula $\iota_{2}$
\end_inset
drops its reference to
\begin_inset Formula $\iota_{1}$
\end_inset
,
\begin_inset Formula $\iota_{2}$
\end_inset
cannot directly mutate
\begin_inset Formula $\iota_{1}$
\end_inset
's reference count.
Now
\begin_inset Formula $\iota_{1}$
\end_inset
's reference count is out of sync.
To correct this,
\begin_inset Formula $\iota_{2}$
\end_inset
sends a reference count decrement message (
\emph on
DEC
\emph default
) to
\begin_inset Formula $\iota_{1}$
\end_inset
.
When
\begin_inset Formula $\iota_{1}$
\end_inset
processes that message, it updates its view to restore agreement with the
true topology.
\end_layout
\begin_layout Standard
Similarly, if
\begin_inset Formula $\iota_{2}$
\end_inset
sends a reference to
\begin_inset Formula $\iota_{1}$
\end_inset
to a third actor
\begin_inset Formula $\iota_{3}$
\end_inset
, it may first send a reference count increment message (
\emph on
INC
\emph default
) to
\begin_inset Formula $\iota_{1}$
\end_inset
, allowing
\begin_inset Formula $\iota_{2}$
\end_inset
to increase its foreign reference count, without requiring
\begin_inset Formula $\iota_{2}$
\end_inset
to mutate any other actor's state or wait for a message in reply.
\end_layout
\begin_layout Standard
These
\emph on
INC
\emph default
and
\emph on
DEC
\emph default
messages allow the actor's view of its topology to be eventually consistent
with the true topology.
\end_layout
\begin_layout Subsection
Deferred Reference Counting
\end_layout
\begin_layout Standard
The
\emph on
external map
\emph default
is an over-approximation of the set of actor references reachable from
some actor's local state.
It differs from the local state in order to allow reference counting to
be lazy.
Rather than tracking all references from
\begin_inset Formula $\iota_{1}$
\end_inset
to
\begin_inset Formula $\iota_{2}$
\end_inset
, a reference exists if
\begin_inset Formula $\iota_{2}$
\end_inset
appears one or more times in
\begin_inset Formula $\iota_{1}$
\end_inset
's local state.
The external map contains all actors that have been in the actor's local
state or were received in a message since the last local garbage collection
pass.
When an actor performs local garbage collection, the external map is compacted
so as to contain only the actors still reachable from the local state.
Actors removed from the external map when it is compacted represent dropped
references, and are sent
\emph on
DEC
\emph default
messages.
\end_layout
\begin_layout Standard
Similarly, when an actor
\begin_inset Formula $\iota_{1}$
\end_inset
receives another actor
\begin_inset Formula $\iota_{2}$
\end_inset
in a message,
\begin_inset Formula $\iota_{1}$
\end_inset
adds
\begin_inset Formula $\iota_{2}$
\end_inset
to its external map.
If
\begin_inset Formula $\iota_{2}$
\end_inset
is not present in
\begin_inset Formula $\iota_{1}$
\end_inset
's external map, the reference held by the message is transferred to
\begin_inset Formula $\iota_{1}$
\end_inset
, giving
\begin_inset Formula $\iota_{1}$
\end_inset
a foreign reference count of 1 for
\begin_inset Formula $\iota_{2}$
\end_inset
, and
\begin_inset Formula $\iota_{2}$
\end_inset
's view of its topology remains in agreement with the true topology.
If
\begin_inset Formula $\iota_{2}$
\end_inset
is already present in
\begin_inset Formula $\iota_{1}$
\end_inset
's external map,
\begin_inset Formula $\iota_{1}$
\end_inset
already has an outgoing edge to
\begin_inset Formula $\iota_{2}$
\end_inset
.
To maintain the reference count invariant of
\begin_inset Formula $\iota_{2}$
\end_inset
,
\begin_inset Formula $\iota_{1}$
\end_inset
increments its foreign reference count for
\begin_inset Formula $\iota_{2}$
\end_inset
by 1.
\end_layout
\begin_layout Standard
This is based on, but differs from, deferred increments
\begin_inset CommandInset citation
LatexCommand cite
key "baker1994minimizing"
\end_inset
, where ephemeral reference count updates can be skipped, and update coalescing,
where redundant reference count updates are combined for efficiency
\begin_inset CommandInset citation
LatexCommand cite
key "levanoni2001fly"
\end_inset
.
\end_layout
\begin_layout Standard
In
\emph on
MAC
\emph default
, reference counts are not updated when references are created or destroyed
on the stack or in the heap, but only when references are sent and received
in messages and when local garbage collection indicates no references to
an actor are reachable from actor's local state.
The messages act as the mechanism for deferring increments, and the external
map, in combination with local garbage collection, acts as the mechanism
for coalescing updates.
\end_layout
\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "subsec:Cycle-Detection"
\end_inset
Cycle Detection
\end_layout
\begin_layout Standard
As in any reference counting system, cyclic garbage cannot be collected
by reference counting alone.
\emph on
MAC
\emph default
uses a
\emph on
cycle detector
\emph default
that has a message queue like an actor, and can both send and receive messages.
\end_layout
\begin_layout Standard
When an actor has no pending messages on its queue, it is
\emph on
blocked
\emph default
.
When an actor blocks, it sends a block message (
\emph on
BLK
\emph default
) to the cycle detector containing the actor's view of its topology, i.e.
its reference count and its external map.
When a blocked actor processes a message, it becomes
\emph on
unblocked
\emph default
and sends an unblock message (
\emph on
UNB
\emph default
) to the cycle detector, informing the cycle detector that its view of that
actor's topology is invalid and that actor is no longer blocked.
\end_layout
\begin_layout Standard
This allows the cycle detector to maintain a view of the topology of all
blocked actors that is eventually consistent with each actor's view of
its topology, which is in turn eventually consistent with the true topology.
However, a naive implementation can result in actors emptying their message
queue during every scheduling turn.
This would result in a block message being sent at the end of the scheduling
turn and, similarly, an unblock message being sent at the beginning of
the next scheduling turn, which in turn results in the cycle detector spending
excessive time handling block and unblock messages.
The solution is for an actor to delay sending a block message until the
runtime is confident that the actor will not be rescheduled soon.
There are several strategies for such a heuristic, including delaying by
a number of scheduling turns, using processor cycle count timestamps to
track previous rescheduling delays, or using a timer on a central service,
such as the cycle detector itself, to poll for blocked actors.
\end_layout
\begin_layout Standard
It would be possible but not efficient for application actors to perform
cycle detection when no messages are pending on their queue (i.e.
just before blocking): this would require every actor in the system to
maintain a view of every other actor's topology, which for
\begin_inset Formula $n$
\end_inset
actors would require
\begin_inset Formula $n$
\end_inset
messages upon each block and unblock and duplication of blocked actor topology
in every actor.
A separate cycle detector reduces this to one message upon block or unblock
regardless of the number of actors.
\end_layout
\begin_layout Subsection
Application Messages
\end_layout
\begin_layout Standard
Application-level messages are presented in examples as a single message
type (
\emph on
APP
\emph default
) that allows an actor
\begin_inset Formula $\iota_{1}$
\end_inset
to send a set of actors
\begin_inset Formula $\iota s$
\end_inset
to another actor
\begin_inset Formula $\iota_{2}$
\end_inset
.
In fact, there are multiple application message types, which can contain
passive objects as well as actors.
However, since actor collection relies only on the topology of actors,
and not objects, the set of actors
\begin_inset Formula $\iota s$
\end_inset
is used to present all explicit actor references contained in the message,
as well as all implicit actor references (i.e.
the allocating actors for any passive objects included in the message).
\end_layout
\begin_layout Standard
This is done for convenience in examples, but the operational semantics
and associated definitions express actual messages and define reachability
fully.
\end_layout
\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "subsec:Dead-Actors"
\end_inset
Dead Actors
\end_layout
\begin_layout Standard
An actor is
\emph on
dead
\emph default
if it is blocked and all actors that have a reference to it are blocked,
transitively.
Because messaging is required to be causal on a single node, a blocked
actor with a reference count of zero is unreachable by any other actor
and is therefore dead (acyclic garbage).
\end_layout
\begin_layout Standard
For cyclic garbage, the cycle detector uses a standard cycle detection algorithm
to find isolated cycles in its view of the topology of blocked actors.
However, the cycle detector's view of the topology may disagree with an
actor's view of its topology (when a
\emph on
BLK
\emph default
or
\emph on
UNB
\emph default
message is on the cycle detector's queue but as yet unprocessed), and the
actor's view of its topology may in turn disagree with the true topology
(when an
\emph on
INC
\emph default
or
\emph on
DEC
\emph default
message is on the actor's queue but as yet unprocessed).
If cyclic garbage is detected on the basis of a view of the topology that
disagrees with the true topology, that cycle must not be collected.
A cycle that has been detected is termed a
\emph on
perceived cycle
\emph default
, and a cycle that has been detected using a view of the topology that agrees
with the true topology is termed a
\emph on
true cycle.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide true
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Float figure