I am reading an article on active object at following location
http://www.cs.wustl.edu/~schmidt/PDF/Act-Obj.pdf
This paper describes the Active Object pattern, which decouples method execution from method invocation in order to simplify synchronized access to an object that resides in its own thread of control. The Active Object pattern allows one or more independent threads of execution to interleave their access to data modeled as a single object. A broad class of producer/consumer and reader/writer applications are wellsuited to this model of concurrency.
I understood how method execution which decouples method invocation.
My question on what does author mean by how active object pattern allows one or more independent threads of execution to interleave their access to data modeled as a singled object?
Request to give an example on what does authore mean by data modeled as single object and how threads interleave in this case.
Thanks for your time and help.
In a nutshell: the pattern says you can put the status inside an object whose methods are all executed in the same thread. Usually, this is achieved with a synchronized queue inside the object. Its public methods don't do the work directly, but they simply put a request in the queue. Then, there is a thread that processes the requests in the queue one by one.
In this way, the data inside the active object are accessed only by a unique thread, so you don't need to worry about explicit synchronization (i.e.: you don't need to use mutexes).
To get to the point: the "data modeled as a singled object" are the data contained in the active object. They are accessed by other objects by means of its unique thread: each method invocation is represented by a request in an internal queue so the requests do interleave!
In his paper, Schmidt explains in detail how active object works with examples.