90 likes | 265 Views
ABCL/1. ABCL1. Actor Based Concurrent Language More pragmatic approach than ACTORS. Types of Message Passing in ABCL. Message sending order from one object to another is preserved in ABCL. Three types of message passing mechanisms Past Non-blocking messages without a reply Now
E N D
ABCL\1 • Actor Based Concurrent Language • More pragmatic approach than ACTORS
Types of Message Passing in ABCL • Message sending order from one object to another is preserved in ABCL. • Three types of message passing mechanisms • Past Non-blocking messages without a reply • Now Blocking messages with sender waiting for a reply • Future Non-blocking messages with a reply expected in the future
Mode of Message Passing • Two mode of message passing • Express • Higher priority • Interrupting current message processing • Non interrupting current message processing • Ordinary
The Concept of Future EObject subclass: #Future instanceVariables: ‘value semaphore’ initialize semaphore := Semaphore new value semaphore wait. ^value reply: aValue value := aValue. semaphore signal doesNotUnderstand: aMessage ^self value performMessage: aMessage Future class new ^super new initialize
Eager Communication Actor subclass: #ABCLActor futureCall: aMessage | aFuture | aFuture := Future new. aMessage arguments at: aMessage arguments size put: aFuture. self asynchronousSend: aMessage. ^aFuture • The future is transmitted as the reply destination of the message • We assume that the reply destination is always specified as the last argument of the message
Synchronous Communication Actor subclass: #ABCLActor nowCall: aMessage ^(self futureCall: aMessage) value
Implementation of the 3 types of message passing Actor subclass: #ABCLActor doesNotUnderstand: aMessage ^aMessage isEmpty ifTrue: [self asynchronousSend: aMessage] ifFalse: [aMessage arguments last == #future ifTrue: [self futureCall: aMessage] ifFalse: [aMessage arguments last == #now] ifTrue: [self nowCall: aMessage] ifFalse: [self asynchronousSend: aMessage]]]
References • Yonezawa, A., et al., Object-Oriented Concurrent Programming in ABCL/1, OOPSLA 86 Proceedings, SIGPLAN Notices, vol. 21, no 11, pp. 258-268