Skip to content Skip to navigation

Connexions

You are here: Home » Content » Discussing Implicit Parallelism and Its Applications

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Endorsed by Endorsed (What does "Endorsed by" mean?)

This content has been endorsed by the organizations listed. Click each link for a list of all content endorsed by the organization.
  • HPC Open Edu Cup display tagshide tags

    This module is included inLens: High Performance Computing Open Education Cup 2008-2009
    By: Ken Kennedy Institute for Information Technology

    Click the "HPC Open Edu Cup" link to see all content they endorse.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • eScience, eResearch and Computational Problem Solving

    This module is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. Odegard

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Discussing Implicit Parallelism and Its Applications

Module by: Hong Lin. E-mail the author

Summary: Methodologies have been developed to allow parallel programming in a higher level. These include the Chemical Reaction Models, Linda, and Unity. We present the Chemical Reaction Models and its applications. An example in modeling a course maintenance system is given.

Higher level parallel programming models express parallelism in an implicit way. Instead of imposing programmers to create multiple tasks that can run concurrently and handle their communications and synchronizations explicitly, these models allow programs to be written without assumptions of artificial sequenciality. The programs are naturally parallel. Examples of such kind of models include the Chemical Reaction Models (CRMs) (Banatre & Le Metayer, 1990 & 1993), Linda (Carriero & Gelernter, 1989), and Unity (Chandy & Misra, 1988; Misra, 1989). These models are created to address higher level programming issues such as formal program specification, program synthesis, program derivation and verification, and software architecture. Efficient implementation of these models has limited success and therefore obscures its direct applications in software design (Creveui, 1991; Gladitz, 1996). Despite this limitation, efforts have been made in both academic and industrial settings to avail these models in real-world programming. For example, Unity has been used in industrial software design and found successful; execution efficiency of Linda has been affirmed by experiments and it is implemented by IBM Tuple Space. Recent discussions of these models in multi-agent system design have also been found in literature (Cabri, 2000). In the following discussion, we focus on the Chemical Reaction Models and its applications.

The Chemical Reaction Models describe computation as “chemical reactions”. Data (the “solution”) are represented as a multiset. A set of “reaction” rules is given to combine elements in the multiset and produce new elements. Reactions take place until the solution becomes inert, namely there are no more elements can be combined. The results of computation are represented as the inert multiset. Gamma is a kernel language in which programs are described in terms of multiset transformations. In Gamma programming paradigm, programmers can concentrate on the logic of problem solving based on an abstract machine and are free from considering any particular execution environment. It has seeded follow-up elaborations, such as Chemical Abstract Machine (Cham) (Berry & Boudol, 1992), higher-order Gamma (Le Metayer, 1994; Cohen & Muylaert-Filho, 1996), and Structured Gamma (Fradet & Le Metayer, 1998). While the original Gamma language is a first-order language, higher order extensions have been proposed to enhance the expressiveness of the language. These include higher-order Gamma, hmm-calculus, and others. The recent formalisms, γ-Calculi, of Gamma languages combine reaction rules and the multisets of data and treat reactions as first-class citizens (Banâtre, Fradet, & Radenac, 2004, 2005a, 2005b). Among γ-Calculi, γ0-Calculus is a minimal basis for the chemical paradigm; γc-Calculus extends γ0-Calculus by adding a condition term into γ-abstractions; and γn-Calculus extends γ0-Calculus by allowing abstractions to atomically capture multiple elements. Finally, γcn-Calculus combines both γc-Calculus and γn-Calculus. For notational simplicity, we use γ-Calculus to mean γcn-Calculus from this point on.

The basic term of a Gamma program is molecules (or γ-expressions), which can be simple data or programs (γ-abstractions). The execution of the Gamma program can be seen as the evolution of a solution of molecules, which react until the solution becomes inert. Molecules are recursively defined as constants, γ-abstractions, multisets or solution of molecules. The following is their syntax:

M :: = 0 1 . . . ' a ' ' b ' . . . ; cons tan ts γP ] C ] . M ; γ abstraction M 1 , M 2 ; multiset M > ; solution M :: = 0 1 . . . ' a ' ' b ' . . . ; cons tan ts γP ] C ] . M ; γ abstraction M 1 , M 2 ; multiset M > ; solution size 12{ matrix { M {} # "::"={} {} # 0 \lline 1 \lline "." "." "." \lline 'a' \lline 'b' \lline "." "." "." {} # ; ital "cons""tan" ital "ts" {} ## {} # \lline {} # γP \] C \] "." M {} # ;γ - ital "abstraction" {} ## {} # \lline {} # { size 10{M} } rSub { size 8{1} } , { size 10{M} } rSub { size 8{2} } {} # ; ital "multiset" {} ## {} # \lline {} # <M> {} # ; ital "solution"{} } } {} (1)

The multiset constructor “,” is associative and commutative (AC rule). Solutions encapsulate molecules. Molecules can move within solutions but not across solutions. γ-abstractions are elements of multisets, just like other elements. They can be applied to other elements of the same solution if a match to pattern P is found and condition C evaluates to true and therefore facilitate the chemical reaction. The pattern has the following syntax:

P :: = x P , P < P > P :: = x P , P < P > size 12{P"::"=x \lline P,P \lline <P>} {} (2)

where x is a variable. In addition, we allow for the use of tuples (written x1:… : xn) and names of types. For example, γ-abstraction

γ ( x : Int , y : Int ) [ x y ] . x γ ( x : Int , y : Int ) [ x y ] . x size 12{γ \( x: ital "Int",y: ital "Int" \) \[ x >= y \] "." x} {} (3)

can be interpreted as: replace x, y by x if x ≥ y, which is equivalent to finding the maximum of two integers.

The semantics of γ-Calculus is defined as the following:

(γp[c].m1), m2 = фm1 if match(p/ m2) = ф and фc ; γ-conversion

m1, m2 = m2, m1 ; commutativity

m1, (m2, m3) = (m1, m2), m3 ; associativity

E1 = E2 => E[E1] = E[E2] ; chemical law

The γ-conversion describes the reaction mechanism. When the pattern p matches m2, a substitution ф is yielded. If the condition фc holds, the reactive molecules γp[c].m1 and m2 are consumed and a new molecule фm1 is produced. match(p/m) returns the substitution corresponding to the unification of variables if the matching succeeds, otherwise it returns fail.

Chemical law formalizes the locality of reactions. E[E1] denotes the molecule obtained by replacing holes in the context E[ ] (denoted by [ ]) by the molecule E1. A molecule is said to be inert if no reaction can be made within:

Inert ( m ) ( m m ' [ ( γp [ c ] . m 1 ) , m 2 ] match ( p / m 2 ) = fail Inert ( m ) ( m m ' [ ( γp [ c ] . m 1 ) , m 2 ] match ( p / m 2 ) = fail size 12{ ital "Inert" \( m \) dlrarrow \( m equiv m' \[ \( γp \[ c \] "." { size 10{m} } rSub { size 8{1} } \) , { size 10{m} } rSub { size 8{2} } \] drarrow ital "match" \( p/ { size 10{m} } rSub { size 8{2} } \) = ital "fail"} {} (4)

A solution is inert if all molecules within are inert and normal forms of chemical reactions are inert γ-expression. Elements inside a solution can be matched only if the solution is inert. Therefore, a pattern cannot match an active solution. This ensures that solutions cannot be decomposed before they reach their normal form and therefore permits the sequentialization of reactions. The following inference rule governs the evolution of γ-expressions:

E 1 E 2 E C [ E 1 ] E ' C [ E 2 ] E E ' E 1 E 2 E C [ E 1 ] E ' C [ E 2 ] E E ' size 12{ { { matrix { { size 10{E} } rSub { size 8{1} } rightarrow { size 10{E} } rSub { size 8{2} } {} # E equiv C \[ { size 10{E} } rSub { size 8{1} } \] {} # E' equiv C \[ { size 10{E} } rSub { size 8{2} } \] {} } } over {E rightarrow E'} } } {} (5)

For example, if a list is represented by multiset M = {(a, i) | a is value and i an index and i’s are consecutive}, the following recursive γ-abstraction replaces any ill-ordered pairs by two other pairs:

sigma = γ ( ( a , i ) : M , ( b , j ) : M ) [ i < j a > b ] : ( b , i ) : M , ( a , j ) : M , sigma sigma = γ ( ( a , i ) : M , ( b , j ) : M ) [ i < j a > b ] : ( b , i ) : M , ( a , j ) : M , sigma size 12{ ital "sigma"=γ \( \( a,i \) :M, \( b,j \) :M \) \[ i<j and a>b \] : \( b,i \) :M, \( a,j \) :M, ital "sigma"} {} (6)

It specifies that any two selected pairs (a, i) and (b, j) that satisfy the condition, i < j ∧ a > b are replaced by two other pairs (b, i) and (a, j), and a copy of itself. No global control is imposed on the way multiset elements are selected to ignite the reaction. If sigma is placed in an initial set M0 of pairs, it will replace ill-ordered pairs until the entire list is sorted. So a sorting program can be defined as:

Sort M 0 =< sigma , M 0 > Sort M 0 =< sigma , M 0 > size 12{ matrix { ital "Sort" {} # { size 10{M} } rSub { size 8{0} } "=<" ital "sigma", { size 10{M} } rSub { size 8{0} } >{} } } {} (7)

We found that the dynamic nature of distributed agents makes it an ideal object for modeling using the Gamma languages (Lin, 2004). An agent shows a combination of a number of characteristics, such as autonomy, adaptability, knowledge, mobility, collaboration, and persistence. These features exist in different types of agent systems such as collaborative agents, interface agents, reactive agents, mobile agents, information agents, heterogeneous agents, and economic agents. The concurrency and automation of agents require that the modeling language does not have any sequential bias and global control structure. In addition, the dynamic nature and non-determinism of interaction between an agent and its environment are suited to a computation model with a loose mechanism for specifying the underlying data structure. For example, data, which move around the Internet, can be well modeled by chemical solution; and mobile agents, which are created dynamically and transferred from clients to servers, can be represented as molecules containing γ-abstractions that transfer among solutions. This provides a mechanism for describing inter-agent communications and agent migration in a single framework. It is notable that CRM specifications separate architectures from nonessential features of the system effectively. For example, it catches the way program units interact with one another and leaves nonessential specifications, such as the number of program units, connection links for communications, and organizations of data, to the subsequent design phases.

We refer the readers to the literature for detailed justifications for the appropriateness of using the CRM to model MAS (Lin & Yang, 2006; Lin, 2007a, 2007b, 2007c; Ma et al, 2007). Here we give the summary of the benefits of using the CRM to model MAS: (1) The architectural design of the system can be separated from the design of individual units that have to deal with proprietary features of the underlying computing resources, because CRM allows us to treat each node in the distributed networking systems as an element of a multi-set data structure, which in-turn can be an active program to be defined in a lower level of the program structure. (2) Parallelism can be easily achieved without extra efforts in designing communication and synchronization mechanism because CRM express them implicitly. (3) Concurrency and dynamic nature of MAS can be easily reflected by CRM’s non-determinism feature. (4) Autonomy can be expressed naturally by CRM’s locality of reaction feature. (5) Combining different programming technologies is made feasible in Gamma framework because no assumptions are made about the way for implementing each node in the system hierarchy. (6) The reusability of the agent systems can be promoted by higher-order CRM languages because the existing agents can be combined by using higher-order operations defined in those languages.

A special issue in a distributed system is that the system is composed of interacting, but independent program units, each has its own data domain; and the architectural design focuses on the conversation among these units (Lin, Norrie, Flores, & Kremer, 2000; Lin, Lin, & Holt, 2003). A conversation is a sequence of messages involving two or more agents and centering on a set of pre-designated topics, intended to achieve a particular purpose. To correctly and efficiently engineer software architecture, we can model and specify agent interactions in distributed learning as conversation schemata, in which interaction patterns and task constraints in collaborative agent systems are constructed within class hierarchies of conversation schemata. For example, let’s consider an online course material maintenance system. The conversation schema is shown in Figure 1. As we know of e-learning systems, the online course materials are updated often in order to keep them as current as possible, esp. in some rapidly changing fields like “computing and information systems”. As part of the duty of the course instructor in his/her effort to make the necessary adjustments for the benefit of students, whenever there’s a significant change in the content of several designated web pages of online course materials, he/she should notify by e-mails the students who are taking the course and those who are interested in the topic. The conversation model of the system consists of the following core elements:

Figure 1
Figure 1 (graphics1.png)

Figure 1: The conversation schema of course maintenance

  • Student Information Agent (ST): A Student Information Agent is designed for providing services about student information, such as providing an e-mail list for a course by automatically maintaining the email list of students taking a course; and maintaining the profile of each student. While student information agent performs various tasks, for our purpose, we use EM to denote the email domain and predicate ST(e, s) to denote that an notification email e is sent to student s.
  • Notification Agent (NT): The basic function of the Notification Agent is to send e-mails to students who take the course according to the student profiles stored in a database when the course material has been significantly changed. We use NF to denote the domain of notifications and predicate NT(n, e) to denote that email e is to disseminate notification n.
  • Monitoring Agent (MT): This agent maintains the content of the topic tree, a course material URL database, monitors updates and notifies the notification agent when a change is made to the database. The domain handled by the monitoring agent is the topic link database LK. We use predicate MT(l, n) to denote that notification n is created in accordance to the change made on topic link l.
  • Maintenance Agent (MA): The maintenance agent provides proxy services to the instructor. It takes updating instructions from the instructor and dispatches them to the monitoring agent. We use UD to denote the domain of updates made by the instructor and predicate MA(u, l) to denote that an update is made on topic link l. We assume that there is only one instructor in the system.

There are two databases used by this system:

  • Topic Tree or Link Database (LK): The course material is organized in the form of a topic tree. Each entry in the topic tree is a link to a web page. We use LK to denote the domain of topic links.
  • Student Information Database (DT): This database maintains student information and their mail boxes. We use DT to denote the domain of students.

Note that although we will focus on modeling the agent conversation in the following discussion, we would like to point out that by no means we are talking about the entire system for e-learning. Our point is to describe our methodology to specify agent conversation in a distributed system.

Based on the above conversation schema, the following constraints apply:

A1: If the instructor makes any update (u) on any topic link (l), a notification message (n) is generated to notify the change made on the topic link.

A2. For any notification message (n) that is generated to notify a change made on any topic link (l), an email (e) is sent to deliver the notice.

A3. For any email (e) that is generated to deliver any notice (n), the email to sent to all students.

The design goal of the system conversation schemata is that for any update made by the instructor, an email notification is sent to all students. A predicate logic specification of the goal is:

goal e : EM . s : DT . ST ( e , s ) goal e : EM . s : DT . ST ( e , s ) size 12{ ital "goal" equiv exists e: ital "EM" "." forall s: ital "DT" "." ital "ST" \( e,s \) } {} (8)

However, the goal is not verifiable with respect to the given input because the input (viz., the update u) and the output (viz., the email e) are not handled by the same agent. Based on constraint A3, we can create a sub-goal (goal2) to check that any notice (n) leads to the creation of an email (e). This can be done by the Notification Agent (NT). However, although goal2 checks domain NF, it still does not contain input u. Using A2, we obtain another sub-goal (goal1) to check that a notification (n) is created when a change is made on a topic link (l) and this can be done by the Monitoring Agent (MT). With a similar deduction using A1, we obtain goal0 to ensure a change on the topic link (l) is made according to the update (u) and this is done by the Maintenance Agent (MA). Note that the input and output of the sub-goals form a pipelining structure:

u goal 0 l goal 1 n goal 2 e goal u goal 0 l goal 1 n goal 2 e goal size 12{ { size 24{ rightarrow } } rSub { size 8{u} } ital "goal"0 { size 24{ rightarrow } } rSub { size 8{l} } ital "goal"1 { size 24{ rightarrow } } rSub { size 8{n} } ital "goal"2 { size 24{ rightarrow } } rSub { size 8{e} } ital "goal"} {} (9)

A Gamma program of goal0 can be constructed as:

Figure 2
Figure 2 (graphics2.jpg)

where MA[u, l] denote the molecule constructed to verify specification MA(u, l).

Similarly, <goal1> can be constructed as:

Figure 3
Figure 3 (graphics3.jpg)

Because the input l in <goal1[l]> is computed using expression:

extract , fail , result , < goal 0 > extract , fail , result , < goal 0 > size 12{ ital "extract", ital "fail", ital "result",< { size 10{ ital "goal"} } rSub { size 8{0} } >} {} (10)

the verification program should be:

Figure 4
Figure 4 (graphics4.jpg)

With similar reasoning, we can construct:

Figure 5
Figure 5 (graphics5.jpg)

To construct the program for

goal = e : EM . s : DT . ST ( e , s ) goal = e : EM . s : DT . ST ( e , s ) size 12{ ital "goal"= exists e: ital "EM" "." forall s: ital "DT" "." ital "ST" \( e,s \) } {} (11)

we firstly construct the program for

s : DT . ST ( e , s ) s : DT . ST ( e , s ) size 12{ forall s: ital "DT" "." ital "ST" \( e,s \) } {} (12)

we get:

Figure 6
Figure 6 (graphics6.jpg)

Then we have:

Figure 7
Figure 7 (graphics7.jpg)

Though we omitted some details of the construction process of the above program, we would like to point out that these programs can be constructed using predefined rules and the process can be semi-automated (Lin, 2007a). This sample application of the Chemical Reaction Model shows that parallelism can be achieved in a very high level and this approach is especially suitable to address architectural design issues of a large software system. Interested readers are welcome to contact the author at linh@uhd.edu.

Bibliography

Banatre, J.-P., & Le Metayer, D. (1990). The Gamma model and its discipline of programming. Science of Computer Programming, 15, 55-77.

Banatre J.-P., & Le Metayer, D. (1993). Programming by multiset transformation. CACM, 36(1), 98-111.

Banâtre, J.-P., Fradet, P., & Radenac, Y. (2004). Chemical specification of autonomic systems. In Proc. of the 13th International Conference on Intelligent and Adaptive Systems and Software Engineering (IASSE'04), July 2004.

Banâtre, J.-P., Fradet, P., & Radenac, Y. (2005a). Principles of chemical programming. In S. Abdennadher and C. Ringeissen (eds.): Proc. of the 5th International Workshop on Rule-Based Programming (RULE'04), 124, ENTCS, 133-147.

Banâtre, J.-P., Fradet, P., & Radenac, Y. (2005b). Higher-order Chemical Programming Style. In Proceedings of Unconventional Programming Paradigms, Springer-Verlag, LNCS, 3566, 84-98.

Berry, G., & Boudol, G. (1992). The Chemical Abstract Machine. Theoretical Computer Science, 96, 217-248.

Cabri, et al. (2000). Mobile-Agent Coordination Models for Internet Applications. Computer, 2000 February, http://dlib.computer.org/co/books/co2000/pdf/r2082.pdf.

Carriero, N., & Gelernter, D. (1989). Linda in context. CACM, 32(4), 444-458.

Cohen, D., & Muylaert-Filho, J. (1996). Introducing a calculus for higher-order multiset programming. In Coordination Languages and Models, LNCS, 1061, 124-141.

Creveuil, C. (1991). Implementation of Gamma on the Connection Machine. Proc. Workshop on Research Directions in High-Level Parallel Programming Languages, Mont-Saint Michel, Springer-Verlag, LNCS 574, 219-230.

Chandy, K.M., & Misra, J. (1988). Parallel Program Design: A Foundation. Addison-Wesley.

Gladitz, K., & Kuchen, H. (1996). Shared memory implementation of the Gamma-operation. Journal of Symbolic Computation 21, 577-591.

Le Metayer, D. (1994). Higher-order multiset processing. DIMACS Series in Discrete Mathematics and Theoretical Computer Science, 18, 179-200.

Lin F., Norrie D. H., Flores, R.A., & Kremer R.C. (2000). Incorporating Conversation Managers into Multi-agent Systems, in M. Greaves, F. Dignum, J. Bradshaw & B. Chaib-draa (Eds.), Proc. of the Workshop on Agent Communication and Languages, 4th Inter. Conf. on Autonomous Agents (Agents 2000), Barcelona, Spain, June, 3-7, 2000, 1-9.

Lin, F.O., Lin, H., & Holt, P. (2003). A Method for Implementing Distributed Learning Environments, Proc. 2003 Information Resources Management Association International Conference, May 18-21, 2003, Philadelphia, Pennsylvania, USA, 484-487.

Lin, H. (2004). A language for specifying agent systems in E-Learning environments. in: F.O. Lin (ed.), Designing Distributed Learning Environments with Intelligent Software Agents, 242-272.

Lin, H., & Yang, C. (2006). Specifying Distributed Multi-Agent Systems in Chemical Reaction Metaphor. The International Journal of Artificial Intelligence, Neural Networks, and Complex Problem-Solving Technologies, Springer-Verlag, 24(2), 155-168.

Lin, H. (2007a). From Logic Specification to -Calculus: A Method for Designing Multi-agent Systems, International Journal of Intelligent Information Technologies, 3(3), pp. 21-40.

Lin, H. (2007b). A Module Language for Implementing Multi-Agent Systems Specified by Gamma Calculus. Journal of System and Management Sciences, Communications of the ICISA, 8(2), 25-48.

Lin, H. (2007c). Agent-Based Architecture of a Distributed Laboratory System, International Journal of Information & Communication Technology Education (IJICTE). 3(1), 45-57. Also included in reference collection: Craig Van Slyke (Ed.), Information Communication Technologies: Concepts, Methodologies, Tools, and Applications, 1130 – 1142.

Ma, W., Tran, D., Sharma, D., Lin, H., & Anderson, M. (2007). Concurrent Programming with Multi-Agents and the Chemical Abstract Machine, in: H. Lin (ed.): Architectural Design of Multi-Agent Systems: Technologies and Techniques, Idea Group Inc., 26-47.

Misra, J. (1989). A foundation of parallel programming. In M. Broy (ed.). Constructive Methods in Computing Science. NATO ASI Series, Vol. F55, 397-443.

Fradet, P., & Le Metayer, D. (1998). Structured Gamma, Science of Computer Programming, 31(2-3), 263-289.

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks