# Transforming threads into actors: learning concurrency structure from execution traces

By and

DOI:
10.1007/978-3-319-95246-8_2
https://doi.org/10.1007/978-3-319-95246-8_2

## Abstract

The threads and shared memory model is still the most commonly used programming model. However, programs written using threads interacting with shared memory model are notoriously bug-prone and hard to comprehend. An important reason for this lack of comprehensibility is thread based programs obscure the natural structure of concurrency in a distributed world: actors executing autonomously with their own internal logic and interacting at arms length with each other. While actors encapsulate their internal state, enabling consistency invariants of the data structures to be maintained locally, thread-based programs use control-centric synchronization primitives (such as locks) that are divorced from the concurrency structure of a program. Making the concurrency structure explicit provides useful documentation for developers. Moreover, it may be useful for refactoring thread-based object-oriented programs into an actor-oriented programs based on message-passing and isolated state. We present a novel algorithm based on Bayesian inference that automatically infers the concurrency structure of programs from their traces. The concurrency structure is inferred as consistency invariants of program data, and expressed in terms of annotations on data fields and method parameters. We illustrate our algorithm on Java programs using type annotations in Java classes and suggest how such annotations may be useful.

## BibTeX

@inproceedings{conf/birthday/AghaP18,
author = "Agha, Gul and Palmskog, Karl",
editor = "Lohstroh, Marten and Derler, Patricia and Sirjani,
Marjan",
title = "Transforming Threads into Actors: Learning Concurrency
Structure from Execution Traces",
biburl = "https://dblp.org/rec/bib/conf/birthday/AghaP18",
booktitle = "Principles of Modeling - Essays Dedicated to
Edward A. Lee on the Occasion of His 60th Birthday",
crossref = "conf/birthday/2018lee",
doi = "10.1007/978-3-319-95246-8\_2",
pages = "16--37",
timestamp = "Fri, 20 Jul 2018 10:53:40 +0200",
url = "https://doi.org/10.1007/978-3-319-95246-8\_2",
year = "2018",
}

@proceedings{conf/birthday/2018lee,
editor = "Lohstroh, Marten and Derler, Patricia and Sirjani,
Marjan",
title = "Principles of Modeling - Essays Dedicated to Edward A.
Lee on the Occasion of His 60th Birthday",
biburl = "https://dblp.org/rec/bib/conf/birthday/2018lee",
doi = "10.1007/978-3-319-95246-8",
isbn = "978-3-319-95245-1",
publisher = "Springer",
series = "Lecture Notes in Computer Science",
timestamp = "Fri, 20 Jul 2018 10:53:40 +0200",
url = "https://doi.org/10.1007/978-3-319-95246-8",
volume = "10760",
year = "2018",
}