On the way back from the US I decided to write something about a question that I received multiple times.
What is a task in Rhapsody? Or equivalent questions using different words but are all about the same topic: task, process, thread.
You can use Wikipedia to read about it, I did too and it will help you, but I will give you my interpretation. which is not necessarily the correct one but I can live with it.
The main difference between a process and a thread is the memory space. threads share the same space, processes have their own memory space. A task can be both, it just indicates that something is running independent from other tasks.
So what is an active class in Rhapsody? That is not specified in particular but for most frameworks it is a thread. “Normal” Rhapsody code runs in the same memory space, it has to, if you send an event to another object, you need to know the “me-Pointer” of that object, which, inevitably has to be in the same memory space.
Hmm so it is not possible to use processes as Rhapsody “tasks”? Oh that is possible but you need a different framework. And a not so easy framework, It is called “distributed Framework” or short”DOX”. The adaptation to an operating system is much trickier in such a system since there is a lot of difference between the methods of inter process communication. You basically have to “register” all tasks and create a function that can communicate between tasks using shared memory or whatever mechanism your OS offers you.
Sending an event means that you have to serialize the event (and, if there, its parameters) then store it in shared memory, notify the OS. Than the OS in its turn will provide it to the receiver that receives it, unserializes it and put it back in the structure.
There are other ways to still use Processes when writing an Application in Rhapsody.
- You can, as described above, implement a different Framework and use the available interprocess communication. The advantaged is that the Rhapsody model can be kept unaware of that and is still portable to other environments.
- On some CPU’s (for instance ARM Cortex) you can use memory protection in a special way. In that way you can use the same memory space but only allow certain functions access to certain memory ranges. This is a proprietary solution, not portable but since the hardware will checked everything, safe and small.
- The last way is to use a normal framework, create processes when you have an active class and then implement the shared memory in a class that has all communication addresses “Pre-compiled” You can take an instance of that class in each process. You cannot send events since the message queues are in different memory spaces so you have to communicate differently.
There is no real difference between a single app with multiple processes at multiple apps. You might as well create a component for every process and include the communication in each and every one.
So. Hope this helps. Happy Modeling with Rhapsody!
Walter van der Heiden ( email@example.com)