
Three significant trends have under- scored the central role of concurrency in computing. First, there is in- creased use of interacting processes by individual users, for example, ap- plication programs running on X windows. Second, workstation net- works have become a cost-effective CONCURRENT OBJECT-ORIENTED mechanism for resource sharing and distributed problem solving. For ex- ample, loosely coupled problems, such as finding all the factors of large prime numbers, have been solved by utilizing ideal cycles on networks of hundreds of workstations. A loosely coupled problem is one which can be easily partitioned into many smaller subproblems so that interactions between the subproblems is quite limited. Finally, multiprocessor tech- CCYY”NlCITlCYICCT”EACCY/September 199O/Vol.33, No.9 125 I I I I I I I I I I I nology has advanced to the point of led to different models of com- to rapid prototyping applications. providing supercomputing power at munication between objects. Object- a fraction of the traditional cost. oriented programming builds on the Patterns oi Concurrent At the same time, software engi- concepts of objects by supporting Problem Solvlng neering considerations such as the patterns of reuse and classification, Three common patterns of parallel- need for data abstraction to promote for example, through the use of in- ism in problems have been found in program modularity underlie the heritance which allows all instances practice (For example, see [8, 131). rapid acceptance: of object-oriented of a particular class to share the same First, pipeline concurrency involves the programming methodology. By sep- method. enumeration of potential solutions arating the specification of what is In the following section, we outline and the concurrent testing of these done (the abstraction) from how it is some common patterns of concur- solutions as they are enumerated. done (the imjhwrltation), the concept rent problem solving. These patterns Second, divide and conquer concur- of objects provides modularity neces- can be easily expressed in terms of rency involves the concurrent elabo- sary for programming in the large. It the rich variety of structures provid- ration of different subproblems and turns out that concurrency is a nat- ed by COOP. In particular, we dis- the joining of (some or all) of their ural consequence of the concept of cuss the actor model as a framework solutions in order to obtain a solution objects. In fact Simula, the first for concurrent systems’ and some to the overall problem. In divide and object-oriented language, simulated concepts which are useful in building conquer concurrency, there is no in- a simple form of concurrency using actor systems. We will then describe teraction between the procedures coroutines on conventional architec- some other models of objects and solving the subproblems. A third pat- tures. Current development of con- their relation to the actor model tern can be characterized as cooperative current object-oriented programming along with novel techniques for sup- probh-solving Cooperative problem- (COOP) is providing a solid software porting reusability and modularity in solving involves a dynamic complex foundation for concurrent comput- concurrent object-oriented program- interconnection network. As each ing on multiprocessors, Future gen- ming. The last section briefly out- object carries out its own computa- eration computing systems are likely lines some major on-going projects in tional process, it may communicate to be based on the foundations being COOP. with other objects, for example, to developed by this emerging software It is important to note that the ac- share the intermediate results it has technology. tor languages give special emphasis computed. An example of this kind The goal of this article is to discuss to developing flexible program struc- of a system is a simulation where the the foundations and methodology of tures which simplify reasoning about physical objects are represented by COOP. Concurrency) refers to the poten- programs. By reasoning we do not logical (computational) objects. tially parallel exe:cution of parts of a narrowly restrict ourselves to the Consider some canonical exam- computation. In a concurrent com- problem of program verification- ples illustrating different patterns of putation, the components of a pro- an important program of research parallelism. A simple example of gram may be executed sequentially, whose direct practical utility has yet pipeline concurrency is the prime or they may be executed in parallel. to be established. Rather our interest sieve. To generate all the prime Concurrency provides us with the is in the ability to understand the numbers, one could generate all flexibility to interleave the execution properties of software because of numbers and remove multiples of of components of a program on a clarity in the structure of the code. 2357I , I I-**, up to the largest prime single processor, or to distribute it Such an understanding may be computed thus far. As soon as a among several processors. Concur- gained by reasoning either infor- number is identified as prime, it is rency abstracts away some of the mally or formally about programs. added to the sieve and numbers are details in an execution, allowing us to The ease with which we can carry out also eliminated by testing for divisi- concentrate on conceptual issues such reasoning is aided by two fac- bility by this prime (see Figure 1). without having to be concerned with tors: by modularity in code which is The earlier stages of this particular a particular order of execution which the result of the ability to separate pipeline are a bottleneck because may result from the quirks of a given design concerns, and by the ability to many more numbers are divisible by system. abstract program structures which smaller primes. The linear pipeline Objects can be defined as entities occur repeatedly. In particular, be- can be improved by changing it to a which encapsula.te data and opera- cause of their flexible structure, actor tree with the numbers sent to dif- tions into a single computational languages are particularly well-suited ferent identically behaving objects, unit. Object models differ in how the each testing for divisibility by a given internal behavior of objects is IThe term Actor was introduced by Carl Hewitt at MIT in the early 1970s to describe the concept of (low) prime, and then merging the specified. Further, models of concur- reasoning agents. It has been refkd over the years results. This can be achieved by us- rent computation based on objects into a model of concurrency. It should be noted that ing demand-driven evaluation which our use of the term bears no relation to the languqe must specify how the objects interact, Actor-the latter being a commercial product in- dynamically creates context objects and different design concerns have troduced in the late 1980s. to filter the numbers for divisibility of 126 September 19901Vo1.33,No.9ICOYYUNICITlONSOFT"EICY I I I I I I I I I I I I I I I 111111111~ OBlBCT-OBlBN7BD DESIDN the primes below it. Specifically, each number can create its own copies of the elements of the sieve as it goes along. This scheme provides tree pipelining for testing divisibility. I It should be observed that because Sieve ) 2 5 7 I a large number of unnecessary tests 3 are performed, the technique of gen- erating all numbers and then filter- ing is quite inefficient in the first place. An improved version would avoid generating multiples of the low primes, 2,3,5,.. (up to some prime). Athas describes the behavior of an algorithm designed precisely to do this [7]. Divide-and-conquer concurrency algorithms can often be expressed as functions. Arguments to a function are evaluated concurrently and their values collected to determine the foal result. Consider the problem of de- termining the product of a list of numbers [4]. We can represent the list as a tree as in Figure 2. The prob- lem can be recursively subdivided into the problem of multiplying two sublists, each of which is concur- (define tree-product rently evaluated, and their results are (lambda [tree] multiplied (see Figure 3). The prod- (if (number? tree) tree FlCURE q. A S/mp/e /W/me Sieve. (’ (tree-product (left-tree tree)) Numbers generated and successively tested (* (tree-product (right-tree tree)))))) for dlvlsiblllty by a linear plpellne of primes. The circled numbers represent numbers which are being generated. The boxed ItUmbWS are ellmlnatlng numbers which are not prime. New primes are added at the end of the sieve. 1 2 n n+l . FIGURE 2. A list of numbers to be mail queue I I I multiplied. The numbers are represented as leaves of a tree. FBGURE 3. The code for multlplylng a list of numbers represented as a tree. In the X” -_ above code, a tree Is passed to tree-product dj -* Xn+l ’ \ which tests to see If the tree Is a number creates tasks,/ (I.e. a singleton). If so It returns the tree, I \ t otherwise It subdlvldes the problem Into two \ L specifies replacement reCUrSlIfe Calls. left-tree and right-tree \ are functions which pick off the left and task \,creates actors right branches of the tree. Note that the cl arguments to * may be evaluated concurrently. k 1 mail queue . FicuRE 4. A pictorial representation I of the behavior of an actor. when the actor processesthe nn communlcatlon, It deter- mines the behavior which will be used to process the n +I” communlcatlon. The mall address of the actor remains Invariant. The actor may alS0 Send communlcatlons to specific target actors and create new actors. COMY”WlC*TIOWIOFT”E~.C~/Septe”,bcr 199o/vo1.33, No.9 I I I I I I I I I I uct is then returned.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-