An
active object framework is a
callback-based form of
multitasking for computer systems. Specifically, it is a form of
cooperative multitasking and is an important feature of the
Symbian operating system.
Within the framework, active
objects may make requests of
asynchronous services (e.g. sending an
SMS message). When an asynchronous request is made, control is returned to the calling object immediately (i.e. without waiting for the call to complete). The caller may choose to do other things before it returns control back to the operating system, which typically schedules other tasks or puts the machine to sleep. When it makes the request, the calling object includes a reference to itself.
When the asynchronous task completes, the
operating system identifies the
thread containing the requesting active object, and wakes it up. An "active scheduler" in the thread identifies the object that made the request, and passes control back to that object.
The implementation of active objects in
Symbian is based around each thread having a "request
semaphore". This is incremented when a thread makes an asynchronous request, and decremented when the request is completed. When there are no outstanding requests, the thread is put to sleep.
In practice there may be many active objects in a thread, each doing its 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.
This is an...
Read More