What is an active object?

In computer programming and engineering, an active object is a type of design that can be used to ensure that some service is always available in a multi -thread or parallel system. An active object is an object that implements the mechanism, so it can receive and process input from external objects without force external objects to wait for completion. This mechanism also allows many objects that could be all running simultaneously using active objects without the possibility of long blocking of times when they have to stop parallel processes and wait for access. This is most often achieved by packing active objects in a publicly accessible interface called proxy, and then implementing the type of queue system inside objects, so the messages are stored for later processing. This creates a pattern of a structure in which objects send messages to active objects and then continue to process until an active object works a message and later non -informedYects of the results to be able to update their states appropriately.

Outside the design formula, a normal object can be called a passive object. In a simple example of the program, the passive object can act as a relay of a chat server in which remote objects contact a passive object to transfer the message to all others on the server. Whenever the passive server object receives a chat message from a remote object, it must immediately process the request and then send the output immediately, while the remote object stops its own implementation until the process is performed, which is known as blocking. Creating different fibers within the program can solve the problem of blocking, but then initiates synchronization problems.

In the design pattern of an active object, the same server object in the above example would be triggered in its own thread separately oDjina objects. It would also be wrapped in a type of interface known as proxy, which also runs in a separate thread, sometimes in the main thread of the program. When a remote object wants the server object to send a chat message, contacts the proxy object, transmits all the required information to it, and then returns to its normal statement instead of waiting.

The proxy interface then converts information from a remote object to a message that it passes to the queue for the active object process. At this point, the interfaces of the proxy and the remote object are free of charge and are not blocked. Meanwhile, the active object is working to maintain the queue empty and processes each incoming message. If the calling object requires some information to be returned by an active object, a return call structure can be used to inform the remote object about any changes in the state.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?