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

Re: dynamic loading tasks and address space



Just a 'reminder' for the record

RTEMS 'events' and 'notepads' are limited resources also sometimes
used by 'semi-kernel' code (e.g., networking uses some events, NFS some
more, EPICS uses a notepad etc.). Usually, these are allocated an arbitrary
number from the middle or end of the available range.

a) make sure the notepad you use isn't in use
b) by 'convention', using low numbers for applications should be ok.

IMO it would be a good idea to
a) setup a wiki-page to document use of events + notepads etc. by different
software packages/'libraries'
b) maybe come up with a dynamic allocation scheme (like for device numbers)


T.

Stanley Jobson wrote:

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