*banner
 

Actor-Oriented Metaprogramming
Stephen Neuendorffer

Citation
Stephen Neuendorffer. "Actor-Oriented Metaprogramming". PhD thesis, University of California, Berkeley, December, 2004.

Abstract
Robust design of concurrent systems is important in many areas of engineering, from embedded systems to scientific computing. Designing such systems using dataflow-oriented models can expose large amounts of concurrency to system implementation. Utilizing this concurrency effectively enables distributed execution and increased throughput, or reduced power usage at the same throughput. Code generation can then be used to automatically transform the design into an implementation, allowing design refactoring at the dataflow level and reduced design time over hand implementation.

This thesis focuses particularly on the benefits and disadvantages that arise when constructing models from generic, parameterized, dataflow-oriented components called actors. A designer can easily reuse actors in different models with different parameter values, data types, and interaction semantics. Additionally, during execution of a model actors can be reconfigured by changing their connections or assigning new parameter values. This form of reconfiguration can conveniently represent adaptive systems, systems with multiple operating modes, systems without fixed structure, and systems that control other systems. Ptolemy II is a Java-based design environment that supports the construction and execution of hierarchical, reconfigurable models using actors.

Unfortunately, allowing unconstrained reconfiguration of actors can sometimes cause problems. If a model is reconfigured, it may no longer accurately represent the system being modeled. Reconfiguration may prevent the application of static scheduling analysis to improve execution performance. In systems with data type parameters, reconfiguration may prevent static analysis of data types, eliminating an important form of error detection. In such cases, it is therefore useful to limit which parameters or structures in a model can be reconfigured, or when during execution reconfiguration can occur.

This thesis describes a reconfiguration analysis that determines when reconfiguration occurs in a hierarchical model. Given appropriate formulated constraints, the analysis can alert a designer to potential design problems. The analysis is based on a mathematical framework for approximately describing periodic points in the behavior of a model. This framework has a lattice structure that reflects the hierarchical structure of actors in a model. Because of the lattice structure of the framework, this analysis can be performed efficiently. Models of two different systems are presented where this analysis helps verify that reconfiguration does not violate the assumptions of the model.

Run-time reconfiguration of actors not only presents difficulties for a system modeler, but can also impede efficient system implementation. In order to support run-time reconfiguration of actors in Java, Ptolemy II introduces extra levels of indirection into many operations. The overhead from this indirection is incurred in all models, even if a particular model does not use reconfiguration.

In order to remove the indirection overhead, we have developed a system called Copernicus which transforms a Ptolemy II model into self-contained Java code. In performing this transformation the Java code for each actor is specialized to its usage in a particular model. As a result, indirection overhead only remains in the generated code if it is required by reconfiguration in the model. The specialization is guided by various types of static analysis, including data type analysis and analysis of reconfiguration. In certain cases, the generated code runs 100 times faster and with almost no memory allocation, compared to the same model running in a Ptolemy II simulation. For small examples, performance close to handwritten Java code has been achieved.

Electronic downloads

Citation formats  
  • HTML
    Stephen Neuendorffer. <a
    href="http://chess.eecs.berkeley.edu/pubs/305.html"
    ><i>Actor-Oriented
    Metaprogramming</i></a>, PhD thesis,  University
    of California, Berkeley, December, 2004.
  • Plain text
    Stephen Neuendorffer. "Actor-Oriented
    Metaprogramming". PhD thesis,  University of
    California, Berkeley, December, 2004.
  • BibTeX
    @phdthesis{Neuendorffer04_ActorOrientedMetaprogramming,
        author = {Stephen Neuendorffer},
        title = {Actor-Oriented Metaprogramming},
        school = {University of California, Berkeley},
        month = {December},
        year = {2004},
        abstract = {Robust design of concurrent systems is important
                  in many areas of engineering, from embedded
                  systems to scientific computing. Designing such
                  systems using dataflow-oriented models can expose
                  large amounts of concurrency to system
                  implementation. Utilizing this concurrency
                  effectively enables distributed execution and
                  increased throughput, or reduced power usage at
                  the same throughput. Code generation can then be
                  used to automatically transform the design into an
                  implementation, allowing design refactoring at the
                  dataflow level and reduced design time over hand
                  implementation. <p> This thesis focuses
                  particularly on the benefits and disadvantages
                  that arise when constructing models from generic,
                  parameterized, dataflow-oriented components called
                  <i>actors</i>. A designer can easily reuse actors
                  in different models with different parameter
                  values, data types, and interaction semantics.
                  Additionally, during execution of a model actors
                  can be reconfigured by changing their connections
                  or assigning new parameter values. This form of
                  reconfiguration can conveniently represent
                  adaptive systems, systems with multiple operating
                  modes, systems without fixed structure, and
                  systems that control other systems. Ptolemy II is
                  a Java-based design environment that supports the
                  construction and execution of hierarchical,
                  reconfigurable models using actors. </p><p>
                  Unfortunately, allowing unconstrained
                  reconfiguration of actors can sometimes cause
                  problems. If a model is reconfigured, it may no
                  longer accurately represent the system being
                  modeled. Reconfiguration may prevent the
                  application of static scheduling analysis to
                  improve execution performance. In systems with
                  data type parameters, reconfiguration may prevent
                  static analysis of data types, eliminating an
                  important form of error detection. In such cases,
                  it is therefore useful to limit which parameters
                  or structures in a model can be reconfigured, or
                  when during execution reconfiguration can occur.
                  </p><p> This thesis describes a reconfiguration
                  analysis that determines when reconfiguration
                  occurs in a hierarchical model. Given appropriate
                  formulated constraints, the analysis can alert a
                  designer to potential design problems. The
                  analysis is based on a mathematical framework for
                  approximately describing periodic points in the
                  behavior of a model. This framework has a lattice
                  structure that reflects the hierarchical structure
                  of actors in a model. Because of the lattice
                  structure of the framework, this analysis can be
                  performed efficiently. Models of two different
                  systems are presented where this analysis helps
                  verify that reconfiguration does not violate the
                  assumptions of the model. </p><p> Run-time
                  reconfiguration of actors not only presents
                  difficulties for a system modeler, but can also
                  impede efficient system implementation. In order
                  to support run-time reconfiguration of actors in
                  Java, Ptolemy II introduces extra levels of
                  indirection into many operations. The overhead
                  from this indirection is incurred in all models,
                  even if a particular model does not use
                  reconfiguration. </p><p> In order to remove the
                  indirection overhead, we have developed a system
                  called Copernicus which transforms a Ptolemy II
                  model into self-contained Java code. In performing
                  this transformation the Java code for each actor
                  is specialized to its usage in a particular model.
                  As a result, indirection overhead only remains in
                  the generated code if it is required by
                  reconfiguration in the model. The specialization
                  is guided by various types of static analysis,
                  including data type analysis and analysis of
                  reconfiguration. In certain cases, the generated
                  code runs 100 times faster and with almost no
                  memory allocation, compared to the same model
                  running in a Ptolemy II simulation. For small
                  examples, performance close to handwritten Java
                  code has been achieved.},
        URL = {http://chess.eecs.berkeley.edu/pubs/305.html}
    }
    

Posted by Christopher Brooks on 7 Jun 2007.
Groups: ptolemy
For additional information, see the Publications FAQ or contact webmaster at chess eecs berkeley edu.

Notice: This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright.

©2002-2018 Chess