Transforming Threads into Actors: Learning Concurrency Structure from Execution Traces

Gul A Agha, Karl Palmskog

Research output: Chapter in Book/Report/Conference proceedingChapter

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.

Original languageEnglish (US)
Title of host publicationLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
PublisherSpringer-Verlag
Pages16-37
Number of pages22
DOIs
StatePublished - Jan 1 2018

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume10760 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Fingerprint

Concurrency
Thread
Trace
Data storage equipment
Message passing
Computer programming
Annotation
Data structures
Synchronization
Memory Model
Shared Memory
Java
Internal
Actors
Learning
Refactoring
Invariant
Bayesian inference
Message Passing
Object-oriented

Keywords

  • Actors
  • Bayesian inference
  • Concurrency
  • Dynamic analysis
  • Java
  • Shared memory
  • Threads

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)

Cite this

Agha, G. A., & Palmskog, K. (2018). Transforming Threads into Actors: Learning Concurrency Structure from Execution Traces. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (pp. 16-37). (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Vol. 10760 LNCS). Springer-Verlag. https://doi.org/10.1007/978-3-319-95246-8_2

Transforming Threads into Actors : Learning Concurrency Structure from Execution Traces. / Agha, Gul A; Palmskog, Karl.

Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). Springer-Verlag, 2018. p. 16-37 (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Vol. 10760 LNCS).

Research output: Chapter in Book/Report/Conference proceedingChapter

Agha, GA & Palmskog, K 2018, Transforming Threads into Actors: Learning Concurrency Structure from Execution Traces. in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), vol. 10760 LNCS, Springer-Verlag, pp. 16-37. https://doi.org/10.1007/978-3-319-95246-8_2
Agha GA, Palmskog K. Transforming Threads into Actors: Learning Concurrency Structure from Execution Traces. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). Springer-Verlag. 2018. p. 16-37. (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)). https://doi.org/10.1007/978-3-319-95246-8_2
Agha, Gul A ; Palmskog, Karl. / Transforming Threads into Actors : Learning Concurrency Structure from Execution Traces. Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). Springer-Verlag, 2018. pp. 16-37 (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)).
@inbook{370aa43268884416ab14ae03a13342fc,
title = "Transforming Threads into Actors: Learning Concurrency Structure from Execution Traces",
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.",
keywords = "Actors, Bayesian inference, Concurrency, Dynamic analysis, Java, Shared memory, Threads",
author = "Agha, {Gul A} and Karl Palmskog",
year = "2018",
month = "1",
day = "1",
doi = "10.1007/978-3-319-95246-8_2",
language = "English (US)",
series = "Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)",
publisher = "Springer-Verlag",
pages = "16--37",
booktitle = "Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)",

}

TY - CHAP

T1 - Transforming Threads into Actors

T2 - Learning Concurrency Structure from Execution Traces

AU - Agha, Gul A

AU - Palmskog, Karl

PY - 2018/1/1

Y1 - 2018/1/1

N2 - 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.

AB - 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.

KW - Actors

KW - Bayesian inference

KW - Concurrency

KW - Dynamic analysis

KW - Java

KW - Shared memory

KW - Threads

UR - http://www.scopus.com/inward/record.url?scp=85052690619&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=85052690619&partnerID=8YFLogxK

U2 - 10.1007/978-3-319-95246-8_2

DO - 10.1007/978-3-319-95246-8_2

M3 - Chapter

AN - SCOPUS:85052690619

T3 - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)

SP - 16

EP - 37

BT - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)

PB - Springer-Verlag

ER -