This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a question about the thread stack


Hi,

Thank you for your kind reply, then may I ask you which function or which source file in ecos defined such thread property? As in standard C/C++, normally we use malloc() to allocate memory to variables or pointers, but eCos seems not need that process. So I'm a bit curious how you guys manage that?

Regards,
Yi Tang

----- Original Message ----- From: "Paul D. DeRocco" <pderocco@ix.netcom.com>
To: "eCos Discuss" <ecos-discuss@ecos.sourceware.org>
Sent: Friday, January 12, 2007 2:04 PM
Subject: RE: [ECOS] a question about the thread stack



From: Yi Tang

I have got one question about the stack for thread. As stated
in Massa's
book, thread is used for local variables and .... It seems
that all variable
excepts those globals are assigned to certain address in the
stack, right?

Here is a question. If I have serveral threads running and
all of them will
call the same device driver, then the address of the local
variables in the
device driver will be different (in each thread's stack) or not?

Of course. All addressing of local variables is relative to a pointer into
the stack area for the current thread. Even if a function recursively calls
itself, each entry to the function has its own set of local variables (and
parameters) on the stack.


--

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss





-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]