Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
research:dsal:cool [2009/02/12 19:36] – jfabry | research:dsal:cool [2009/02/13 12:15] (current) – jfabry | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== COOL ===== | ||
+ | (Internal classification: | ||
+ | Reference paper: **" | ||
+ | |||
+ | Another source of detailed information is Lopes' PHD Thesis, which was was published later: **"D: A Language Framework for Distributed Programming" | ||
+ | |||
+ | ===== Domain of the language ===== | ||
+ | |||
+ | Both COOL and [[RIDL]] are designed as part of the **D** framework. "D is a language framework that supports new | ||
+ | kinds of modules for addressing some of the distribution issues that are hard to capture in classes. [...]. The language framework proposed here focuses only on a subset of [distributed system] applications [...]: applications over the Internet, the Web, corporate-wide applications such as calendar managers, network managers, document management systems [...], hospital management systems, front-end applications for database access, interactive multi-user environments, | ||
+ | |||
+ | "[D] really consists of two languages: (1) COOL, for controlling thread synchronization over the execution of the components; and (2) RIDL, for programming interactions between remote components." | ||
+ | |||
+ | ===== Intent of the language ===== | ||
+ | |||
+ | "COOL provides means for dealing with mutual exclusion of threads, synchronization state, guarded suspension and notification [...] A COOL program consists of a set of coordinator modules [...] [These] are helpers with respect to | ||
+ | the implementation of the classes: they take care of thread synchronization over the execution of | ||
+ | the methods" | ||
+ | |||
+ | ===== Join Point Model and Advice Model ===== | ||
+ | * JPM: General-Purpose : Coordinators act on method invocations to the target object. | ||
+ | * AM: Domain-Specific : A coordinator defines exclusion constraints and pre-conditions for methods. | ||
+ | |||
+ | ===== Anatomy of the language ===== | ||
+ | |||
+ | A coordinator has a signature part and a body part. | ||
+ | |||
+ | The signature defines a list of class names of where the coordinator applies, and whether the coordinator is per instance or per class. Note that the list of class names does not support wildcarding, | ||
+ | |||
+ | The body defines the behavior of the coordinator, | ||
+ | * Condition Variables: declarations of initialized boolean variable (array), used for guarded suspension | ||
+ | * Ordinary Variables: declarations of variables of primitive types, used as auxiliary state for the coordinator. (Note that these values are immutable if they are not boolean, due to restrictions of the language discussed later.) | ||
+ | * Self-Exclusive Methods: a set that " | ||
+ | * Mutual Exclusion Declarations: | ||
+ | * Method Managers: for a list of method names it defines | ||
+ | * Guarded Suspension: a boolean expression on condition variables. While false, the thread calling the method remains suspended. | ||
+ | * On Entry and On Exit Statements: code to be executed just before or just after the method runs, to update coordinator state. | ||
+ | |||
+ | The coordinator has complete access to instance variables declared in the classes it is coordinating (+ the non-private variables of their superclasses). | ||
+ | |||
+ | If a method is not mentioned in the coordinator, | ||
+ | |||
+ | The grammar of COOL and RIDL is fully described in appendix A of the thesis. | ||
+ | |||
+ | ===== Typical Example ===== | ||
+ | |||
+ | The classical bounded buffer in COOL, taken from Lopes' thesis: | ||
+ | |||
+ | coordinator BoundedBuffer { | ||
+ | selfex put, take; | ||
+ | mutex {put, take}; | ||
+ | condition empty = true, full = false; | ||
+ | put: requires !full; | ||
+ | | ||
+ | if (empty) empty = false; | ||
+ | if (usedSlots == capacity) full = true; | ||
+ | | ||
+ | take: requires !empty; | ||
+ | | ||
+ | if (full) full = false; | ||
+ | if (usedSlots == 0) empty = true; | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | ===== Enforced Restrictions ===== | ||
+ | |||
+ | Advice in COOL is very restricted. Self-exclusive and mutual exclusive declarations have no extra programmable behavior, in method managers guarded suspension is only a boolean expression. Expressions are only allowed in on entry and on exit statements. However these expressions may only contain if-statements or assignment statements. The test of the if-statement can be an expression, excluding method calls. Assignment statements only assign to variables declared in the coordinator, | ||
+ | |||
+ | ===== Implementation description ===== | ||
+ | |||
+ | The aspect weaver for both COOL and [[RIDL]] is discussed in detail in Appendix C of the dissertation: |