Active Object

An object executing in its own thread of control.

The nice thing about this idea is that there is a one-to-one relation between an object and a thread, simplifying the understanding and handling of concurrency in a program.

Common OO languages do not directly support this concurrency model, so one has to implement one's own wrappers and synchronization mechanisms to ensure a method invocation on such an ActiveObject from another thread (and it is usually another thread) is properly transferred into the execution of the method's implementation using the object's own thread.

Also methods usually have an asynchronous invocation behavior. That is, the method invocation returns before the method has been finished (why else would someone provide an object with an own thread of control?). This, however, means that values which are supposed to be returned from the method are not ready/available when the method returns. This can e.g. be solved by using a FutureValue.

An alternative paradigm is that of FlowBasedProgramming or Linda (see LindaLanguage) - in these systems, a process receives a stream of information packets or "tuples", applying processing to each one, and generating a stream of results. In this environment, there is usually no need for the sending process to wait for the results of the processing - they go onwards. In one of the papers on Linda, DavidGelernter and NicholasCarriero state "processes in a parallel program usually don't care what happens to their data." However, if they do care, a call can be simulated by a put followed by a get. DG and NC make this point also in their Linda paper. -- PaulMorrison

The ActiveObject pattern is described in the book PatternOrientedSoftwareArchitectureTwo.

-- ThomasWeidenfeller

Simula had active objects with the standard simset module (I might misremember de name). Altough it wasn't using threads but corutines (sometimes implemented with treads or processes). There where other modules that implemented true paralellism in the same fashion, but they weren't standardised. Most Simula objects never leaved their "class body" during the execution of an application. I really miss Simula it was superior to most of its decendents. If it had been invented in USA, a modernised version would probably have been the dominating programming language today. -- Martin Jansson


EditText of this page (last edited September 22, 2007) or FindPage with title or text search