Upload
jayson-hardy
View
213
Download
0
Tags:
Embed Size (px)
Citation preview
Outline Motivation Serializing abstraction and concurrent
aggregates Features Programming with CA Discussion
Motivation Parallel programs to take advantage of the
massive hardware concurrency Two major concerns at that time:
Programming should be relatively easy (the complexity of writing object oriented languages)
Language must allow to express sufficient concurrency
Hierarchies of abstractions are used to manage complexity by serializing the abstractions, which may cause significant loss of concurrency
Serializing Abstractions Each object accepts one msg a
time Hierarchical abstractions
(abstractions built from other abstractions) are built from single objects
Most concurrent object-oriented languages serialize hierarchical abstractions
This leaves programmers with the choice of reduced concurrency or working without useful levels of abstraction
Concurrent Aggregates
Concurrent aggregates allow programmers to build hierarchical abstractions without serialization.
Each aggregate is multi-access to receive many messages simultaneously
Result: Increased message rate for lower levels
Background J-machine: 105 nodes, 64K words local
memory, fast communication Fine grain computation: msg passing,
context switching and fast task creation and dispatch
No shared memory, and each of the nodes executes instructions from local mem.
Concurrency in CA is derived from asynchronous messages sends and synchronization through context futures
Similar settings in sensor networks?
Four important features Intra-aggregate Addressing:
allows representatives of an aggregate to compute the names of other parts of the aggregate
Delegation: to piece together one aggregate’s
behavior from the behavior of others
First Class Messages: Allow programmers to write
message manipulation abstractions First Class Continuations:
enables programs to code synchronizing abstractions such as futures
Programming with Concurrent Aggregates: Syntax
Aggregate(aggregate <aggname> instance-variable* (parameters param-name+)(initial <aggsize> exp+))
Class (class <cname> instance-variable* (parameters
param-name+)(initial exp+))
(global <gname> initial-exp)
Example of Aggregate
(aggregate counter count
(parameters number_reps icount)
(initial number_reps)(forall index from 1 below number_reps
(set_count (sibling group index) icount))
(set_count self icount)))
Method and handler Handler
(handler <aggname> <messagename> (arg*) exp+)
Method (method <cname> <messagename> (arg*)
exp+) Delegate
(delegate <agg-or-cname> <messagename> instance-variable)
Aggregation and Naming Aggregate:
Homogeneous collection of objects (representatives) which are grouped together and may be referenced by a single aggregate name
Messages sent to the aggregate are directed to arbitrary representatives
(sibling group <index>)
Delegation and Message Handling
Handlers are methods for aggregates
Delegates specify targets to handle messages
:rest delegate can handle messages with no specified handler
Bank Example Bank aggregate composed of tellers
aggregate, loan officer, and manager Unusual manages delegated to manager
Message Handling
Messages are first class objects in CA Can be created and modified programmatically Messages are passed by-value but copying is
only one level deep
Futures Value method
returns value immediately if available, otherwise adds continuation to a list
Set_value method forwards value to all continuations on deferred list
Objects as Continuations A continuation is just an object
that expects a reply Complex synchronization
structures can be implemented as continuations
Barrier Barrier object
implements reply method
Once, maxcount is reached, all computations are resumed
Conclusion CA provides a programming
abstraction for dealing with many processors
Abstraction takes much of the complexity out of parallelizing a computation
First class continuations allow for modular synchronization structures