[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic loading tasks and address space



hi,

> >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 ...

thx,
regards,
stan