An active class is considered a task in IBM® Rational® Rhapsody®.
The message queue is a buffer that is used in non-shared memory environments, where tasks communicate by passing messages to each other rather than by accessing shared variables. Tasks share a common buffer pool, with OMOSMessageQueue implementing the buffer. The message queue is an unbounded FIFO queue that is protected from concurrent access by different threads.
Events are asynchronous. When a class sends an event to another class, rather than sending it directly to the target reactive class, it passes the event to the operating system message queue and the target class retrieves the event from the head of the message queue when it is ready to process it. Synchronous events can be passed using triggered operations instead.
Many tasks can write messages into the queue, but only one can read messages from the queue at a time. The reader waits on the message queue until there is a message to process. Messages can be of any size.
Processes that want to communicate with each other must be linked somehow. A communication link consists of a relation, as in the form of an association line drawn between classes in an object model diagram. The link can be either unidirectional or bidirectional (symmetric). If a unidirectional link from class A to class B, class A can send messages to class B, but class B cannot send messages to class A. With bidirectional links, both classes can send messages to each other. The message queue is attached to the link, and allows the sender and receiver of the message to continue on with their own processing activities independently of each other.
In operating systems with memory protection, one active class can call an operation of another active class, given an association relation between them, if the operating system itself supports such direct calls. For operating systems with shared memory, the product passes events using the operating system messaging. Whether direct function calls are supported with memory protection depends on the operating system itself, not the Rational Rhapsody framework.
In Rational Rhapsody applications, the BaseNumberOfInstances property (under CG::Event) specifies the initial size of the memory pool that is allocated for events. This pool is dynamically allocated at program initialization. The AdditionalNumberOfInstances property (under CG::Event) specifies the size of any additional memory that needs to be allocated during run time if the initial pool becomes full. Additional memory allocation is done on the heap and includes rearranging of the initial memory pool.