Completely Unanticipated Dynamic Adaptation of Software
Total Page:16
File Type:pdf, Size:1020Kb
Completely Unanticipated Dynamic Adaptation of Software A thesis submitted to the University of Dublin, Trinity College, in fulfilment of the requirements for the degree of Doctor of Philosophy (Computer Science) John Keeney Distributed Systems Group, Department of Computer Science, Trinity College, University of Dublin. October 2004 Declaration I, the undersigned, declare that this work has not previously been submitted to this or any other University, and that unless otherwise stated, it is entirely my own work. John Keeney ___________________________________ May 2005 ii Permission to Lend and/or Copy I, the undersigned, agree that Trinity College Library may lend or copy this thesis upon request. John Keeney ___________________________________ May 2005 iii Acknowledgments Firstly, I must thank my supervisor Prof. Vinny Cahill, who prised this thesis out of me with his subtle but effective prodding. Thanks for the support and guidance over the years while still letting me get on with my procrastination. Thanks to Microsoft Research Ltd., for the happy days that comes from financial support, as Donal and myself ploughed the long furrow. Thanks to the Coyote team, Tilman, Peter, Jim, and Barry who introduced me to the big bad world of reflection, and brought metatypes to us all. In particular Barry for Iguana/J, without which this thesis would not have been possible. In addition thanks to Mads for his help and guidance with ALICE, and for his useful and insightful comments to improve the thesis. Thanks to the buckos in DSG for keeping me idle all these years, while I was keeping them idle too. I bet you guys won't read the rest of this thesis! Thanks to the Girlies (that includes Owen and Paul) for the sanity. Special thanks to my family for me, for the support, and the instilled desire to achieve. Most of all, thanks to Niamh for the "minds". I promise I'll come home and shave now. iv Summary Dynamic adaptation of software behaviour refers to the act of changing the behaviour of some part of a software system as it executes, without stopping or restarting it. It is difficult to dynamically adapt software if the need for adaptation arises while the software is executing, and especially so if the program is compiled and the source code is unavailable. Ideally, it would be possible for adaptations to be applied to a running application without any anticipation of the adaptation itself, preparation of the location for that adaptation, or even anticipation of the need for some adaptation. Even with the best planning and foresight it is virtually impossible to anticipate at design and production stages all of the dynamic behaviour adaptations that may be required for a piece software, especially if the need for adaptation is triggered by unpredictable and erratic changes in the operating context, the application's resources and demands, and the users’ requirements. The need for dynamic adaptation arises in various circumstances, from the very simple desire to dynamically customise a piece of software to suit current needs, through to a necessity to continually evolve a long-running program as its requirements and operating context change. These adaptations may simply involve pre- or post-processing of operations, for example, to support consistency checking, through to dynamically adapting the core behaviours of an application as its operating context or requirements change, for example to support dynamic upgrading or repair of the system. While it may be necessary to adapt the core functional behaviours of an application, it may also be necessary to change or insert new non-functional behaviours that do not change what the software does, but rather how it does it. Examples here include dynamically inserting debugging or tracing statements, through to making some object in an application persistent or remotely accessible. To perform these changes it should not be necessary to restart the application, or indeed have access to the source code of the application since the core problem domain being modelled by the application has not changed. v If dynamic adaptation is to be completely unanticipated, the management and control of the adaptation process must also be dynamically adaptable. It is unrealistic to expect an adaptation framework using a hard-coded, static, or inflexible approach to adaptation management, to perform adequately in a generalised manner. Only by decoupling the adaptation mechanism from the adaptation control, and dynamically specifying and adapting the adaptation control strategies, can completely unforeseen dynamic adaptation of running software become a realistic goal. This thesis provides an in depth discussion of unanticipated dynamic adaptation, introduces the term “completely unanticipated dynamic adaptation” to refer to adaptations where all properties of the adaptation can remain unanticipated until during runtime, and identifies the set of requirements that must be met to achieve this. This thesis presents the Chisel adaptation framework, and demonstrates that a general- purpose, context-aware dynamic adaptation framework is achievable. This system can be used to perform almost any unforeseen behavioural adaptation without stopping the application, and without changing the application itself. In this system a human-readable, dynamically updatable policy script was chosen as the favoured approach to drive the adaptation mechanism in a responsive manner by monitoring changes in the user, application, and environmental context. The Chisel framework also demonstrates that behavioural reflection, using the managed but unforeseen dynamic selection of Iguana/J metatypes, is a valid and powerful technique for completely unanticipated dynamic software adaptation. In addition, the Chisel framework provides a structured mechanism to allow a user to inspect and probe the internal operation of compiled software without access to the software's source code to allow that software to be adapted or extended as appropriate. To evaluate Chisel and validate our claims, a number of examples and case studies are used, including the use of the Chisel framework to dynamically adapt an off the shelf network application, as it ran, to use ALICE, a middleware for mobile computing environments, and how, using an Iguana/J metatype to implement a snap-on non-functional behaviour to implement a naming mechanism for individual objects, those named objects can be individually adapted or queried as context sources. vi Contents CHAPTERTU 1 INTRODUCTIONUT ............................................................................... 20 1.1TU Aims and objectivesUT .......................................................................................................21 1.2TU Completely unanticipated dynamic software adaptationUT ..........................................22 1.2.1TU Software adaptation and evolutionUT ...........................................................................22 1.2.2TU Anticipation of the adaptation's attributesUT ................................................................24 AdaptationTU anticipated at design and production stageUT ................................................25 AdaptationTU anticipated at compile-timeUT ........................................................................25 AdaptationTU anticipated at the start of runtimeUT ...............................................................26 AdaptationTU anticipated at load-timeUT ..............................................................................26 AdaptationTU anticipation during executionUT .....................................................................27 SummaryTU of anticipation of an adaptation's characteristicsUT ..........................................27 1.2.3TU Completely unanticipated dynamic adaptationUT ........................................................28 ButTU completely unanticipated dynamic adaptation must itself be anticipatedUT ..............28 1.3TU MotivationUT ......................................................................................................................29 1.4TU Dynamic adaptation using metatypesUT ..........................................................................31 1.4.1TU What is a metatypeUT ...................................................................................................31 1.5TU Policy-based management of adaptationsUT ...................................................................32 1.6TU The Chisel adaptation frameworkUT ...............................................................................33 1.7TU General-purpose dynamic adaptation supportUT ...........................................................34 1.8TU ContributionsUT .................................................................................................................35 vii 1.9TU Orthogonal research topicUT ............................................................................................36 1.10TU Thesis roadmapUT ...........................................................................................................37 CHAPTERTU 2 RELATED WORK ON ADAPTABLE SYSTEMSUT ............................. 38 2.1TU Adaptation using reflective techniquesUT ........................................................................39 2.1.1TU IguanaUT .......................................................................................................................40 MetatypesTU and IguanaUT ...................................................................................................40