dynamic loading tasks and address space

Stanley Jobson stanley.jobson at gmx.ch
Mon Nov 14 09:18:08 UTC 2005


> >question: what about this file? each instance of the task mentioned
> >above would need its own copy (especially of the global (static)
> >variables), right?
> >  
> >
> no. There is a single copy of the program text and all non-automatic 
> variables.
> Hence, if your code needs 'global' variables you must make it 
> 're-entrant' first.
> E.g., by putting all globals into a 'struct', malloc'ing memory for that 
> struct
> at task initialization and passing a pointer to all routines that need 
> to access the
> global data. Instead of explicitely passing a pointer you can use RTEMS 
> features
> such as notepads or task variables [avoid task vars if possible - they 
> add to
> the context switching overhead] -- (RTM).

thx for this detailed info - finally i found a way to solve my prob and i
exactly did as u said: the code is loaded only once - a task must be
reentrant, which will be impl. using rtems notepad ...


More information about the users mailing list