Active objects

From Wikipedia, the free encyclopedia

Active Objects are a form of multitasking for computer systems. Specifically, they are a form of cooperative multitasking. They are an important feature of Symbian OS.

In the scheme, objects may make requests of asynchronous services. (For example, an application may request to send an SMS.) Once the request has been made, control returns to the object immediately. It may choose to do other things, or return control back to the operating system, which typically will schedule other tasks or put the machine to sleep. When making the request, the object includes a reference to itself.

When the asynchronous task has completed, the operating system will identify the thread containing the requesting active object, and wake up that thread. An "active scheduler" in that thread will identify the object that made the request, and pass control back to that object.

The implementation of active objects in Symbian OS is based around each thread having a "request semaphore". This is incremented when a thread is due to complete an asynchronous request, and decremented when the request has been completed. When there are no outstanding requests, the thread is put to sleep.

In practice, there may be many objects in a thread, each doing their own task. They can interact by requesting things of each other, and of active objects in other threads. They may even request things of themselves.

Notice that this is a software implementation of a very old idea that was developed to handle software interruptions in the 70's. The operating system was acting as the first object and the peripheral as the second one.