process management

Aaron J. Grier aaron at frye.com
Wed Nov 17 22:28:35 UTC 2004


On Wed, Nov 17, 2004 at 11:05:41PM +0100, sebastian ssmoller wrote:
> are rtems tasks similar to unix processes in the way that they have
> their own address space?

for code, no, but for local data, yes, since local data lives on the
stack, and each task has its own stack.

> i mean: imagine i have two tasks A and B with A has lower prio than B.
> now A starts working. it enters a rather long function and while being
> in there it is preempted by B. B enters that function too. now A and B
> execute "theoretically" the same code. 

it is the same code.  the program counters for both tasks will be
executing over the same block of memory.

> what happens to local variables? are they protected? means: does A and
> B have separate copies of local variables?

tasks have separate stacks, so each task has its own copy of local
variables, since local variables live on the stack.

> furthermore: is it possible to create two different tasks (by
> rtems_id) using the same "entry point" (function code) ?

yes.  you can either pass a unique argument to the entry point, or use
rtems_task_ident() on RTEMS_SELF.  (the latter is similar to getting
your PID under a unix system.)

-- 
  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron at frye.com
  "Note that many bands' backline amps produce levels exceeding OSHA
   standards for industrial facilities.  Yet this is considered normal
   working conditions for musicians.  That's showbiz." -- Scott Dorsey



More information about the users mailing list